{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://elsegundo.xyz/checkins/here.schema.json",
  "title": "Here check-in, version 0.1",
  "description": "One check-in: who (optional), where (coarse), when, what (optional) and what it was like there. Open format, CC0. Fork it.",
  "type": "object",
  "required": ["v", "id", "at", "kind"],
  "additionalProperties": true,
  "properties": {
    "v": { "const": "here/0.1" },
    "id": { "type": "string", "maxLength": 200, "description": "Unique within the publishing origin. Readers key on origin + id." },
    "code": { "type": "string", "maxLength": 32, "description": "Optional short human code, like GULL-382." },
    "at": { "type": "string", "format": "date-time", "description": "When, in UTC." },
    "kind": { "enum": ["person", "bot"], "description": "People and bots check in side by side. A bot says so." },
    "site": { "type": "string", "maxLength": 60, "description": "Which site or room in the publisher's network took the check-in." },
    "name": { "type": ["string", "null"], "maxLength": 32, "description": "Only when the person chose to be named." },
    "status": { "type": ["string", "null"], "maxLength": 80, "description": "What I'm doing, in plain words. Only when the person chose public." },
    "answer": { "type": ["string", "null"], "maxLength": 120, "description": "The response to the site's call, if the site uses calls." },
    "place": {
      "type": ["object", "null"],
      "description": "Coarse place: a town, city, ZIP or neighborhood. Never a street address or a GPS fix.",
      "required": ["label", "slug"],
      "properties": {
        "label": { "type": "string", "maxLength": 48 },
        "slug": { "type": "string", "pattern": "^[a-z0-9-]{1,60}$" }
      },
      "additionalProperties": false
    },
    "stamp": {
      "type": ["object", "null"],
      "description": "The postmark: local time and conditions at the place. Any field may be null when its source did not answer; null means unavailable, never zero.",
      "properties": {
        "line": { "type": ["string", "null"], "maxLength": 200 },
        "localTime": { "type": ["string", "null"], "maxLength": 16 },
        "tempF": { "type": ["integer", "null"] },
        "sky": { "type": ["string", "null"], "maxLength": 32 },
        "sunset": { "type": ["string", "null"], "maxLength": 16 },
        "tide": { "type": ["object", "null"], "properties": { "next": { "enum": ["high", "low"] }, "at": { "type": ["string", "null"] }, "trend": { "enum": ["rising", "falling"] } } },
        "moon": { "type": ["string", "null"], "maxLength": 20 }
      }
    },
    "badges": { "type": "array", "items": { "type": "string", "maxLength": 40 }, "maxItems": 20, "description": "Labels, never prizes." }
  }
}
