{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://events.outerfab.com/schema/event.schema.json",
  "title": "Open Source Silicon Event",
  "description": "One event in the Open Source Silicon Events calendar. All timestamps are UTC.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id", "name", "summary", "type", "status", "mode",
    "start", "end", "timezone", "url", "organizers", "responsibleOrganizer", "languages",
    "price", "source", "lastVerified"
  ],
  "properties": {
    "$schema": { "type": "string" },
    "id": {
      "description": "UUID v4, lowercase. Must equal the file name (<id>.event.json). Never changes, even if the event moves.",
      "type": "string",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
    },
    "name": { "type": "string", "minLength": 3, "maxLength": 140 },
    "summary": {
      "description": "One or two sentences, plain text. Used in tiles, feeds and llms.txt.",
      "type": "string", "minLength": 20, "maxLength": 280
    },
    "description": {
      "description": "Plain text. Paragraphs are separated by a blank line (\\n\\n).",
      "type": "string", "maxLength": 4000
    },
    "type": { "$ref": "#/$defs/eventType" },
    "topics": {
      "description": "Lowercase kebab-case tags, e.g. sky130, openroad, tiny-tapeout. See schema/README.md for a suggested vocabulary.",
      "type": "array", "maxItems": 15, "uniqueItems": true,
      "items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" }
    },
    "series": {
      "description": "Name of the recurring series this event belongs to, e.g. \"SZOSS\".",
      "type": "string", "maxLength": 100
    },
    "status": { "$ref": "#/$defs/status" },
    "statusNote": {
      "description": "Why the event was cancelled, postponed or rescheduled. Required unless status is scheduled.",
      "type": "string", "maxLength": 500
    },
    "revision": {
      "description": "Increment on every change after publication. Becomes SEQUENCE in the calendar file so calendar apps update existing entries.",
      "type": "integer", "minimum": 0, "default": 0
    },
    "start": { "$ref": "#/$defs/utc" },
    "end": { "$ref": "#/$defs/utc" },
    "previousStart": {
      "description": "Only for status rescheduled: the old start, shown struck through.",
      "$ref": "#/$defs/utc"
    },
    "previousEnd": { "$ref": "#/$defs/utc" },
    "timezone": {
      "description": "IANA time zone of the event venue (or of the organizer for online events), e.g. Asia/Shanghai. Used only to show the event's local time next to UTC.",
      "type": "string", "pattern": "^[A-Za-z_]+(/[A-Za-z_+\\-0-9]+)+$|^UTC$"
    },
    "mode": { "type": "string", "enum": ["in-person", "online", "hybrid"] },
    "location": {
      "type": "object", "additionalProperties": false,
      "required": ["name", "address"],
      "properties": {
        "name": { "description": "Venue name.", "type": "string", "maxLength": 140 },
        "address": {
          "type": "object", "additionalProperties": false,
          "required": ["locality", "country"],
          "properties": {
            "street": { "type": "string", "maxLength": 200 },
            "locality": { "description": "City.", "type": "string", "maxLength": 100 },
            "region": { "type": "string", "maxLength": 100 },
            "postalCode": { "type": "string", "maxLength": 20 },
            "country": { "description": "ISO 3166-1 alpha-2, e.g. CN.", "type": "string", "pattern": "^[A-Z]{2}$" }
          }
        },
        "geo": {
          "type": "object", "additionalProperties": false,
          "required": ["lat", "lon"],
          "properties": {
            "lat": { "type": "number", "minimum": -90, "maximum": 90 },
            "lon": { "type": "number", "minimum": -180, "maximum": 180 }
          }
        }
      }
    },
    "onlineUrl": {
      "description": "Where to join. Required for online and hybrid events.",
      "type": "string", "format": "uri", "pattern": "^https?://"
    },
    "url": {
      "description": "Official event page.",
      "type": "string", "format": "uri", "pattern": "^https?://"
    },
    "registration": {
      "type": "object", "additionalProperties": false,
      "required": ["required"],
      "properties": {
        "required": { "type": "boolean" },
        "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
        "opensAt": { "$ref": "#/$defs/utc" },
        "closesAt": { "$ref": "#/$defs/utc" }
      }
    },
    "cfp": {
      "description": "Call for proposals / participation.",
      "type": "object", "additionalProperties": false,
      "required": ["url", "deadline"],
      "properties": {
        "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
        "deadline": { "$ref": "#/$defs/utc" },
        "note": { "type": "string", "maxLength": 300 }
      }
    },
    "price": {
      "type": "object", "additionalProperties": false,
      "required": ["free"],
      "properties": {
        "free": { "type": "boolean" },
        "currency": { "description": "ISO 4217, e.g. EUR.", "type": "string", "pattern": "^[A-Z]{3}$" },
        "minAmount": { "type": "number", "minimum": 0 },
        "maxAmount": { "type": "number", "minimum": 0 },
        "note": { "type": "string", "maxLength": 300 }
      },
      "if": { "properties": { "free": { "const": false } }, "required": ["free"] },
      "then": { "required": ["currency", "minAmount"] }
    },
    "capacity": { "type": "integer", "minimum": 1 },
    "organizers": {
      "type": "array", "minItems": 1,
      "items": {
        "type": "object", "additionalProperties": false, "required": ["name"],
        "properties": {
          "name": { "type": "string", "maxLength": 140 },
          "url": { "type": "string", "format": "uri", "pattern": "^https?://" }
        }
      }
    },
    "sponsors": {
      "description": "Optional sponsors or supporters, e.g. a location sponsor.",
      "type": "array",
      "items": {
        "type": "object", "additionalProperties": false, "required": ["name"],
        "properties": {
          "name": { "type": "string", "maxLength": 140 },
          "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
          "role": { "type": "string", "maxLength": 80 }
        }
      }
    },
    "responsibleOrganizer": {
      "description": "The one person who is personally responsible for this event. Public name and optional public page only; no e-mail address or phone number.",
      "type": "object", "additionalProperties": false, "required": ["name"],
      "properties": {
        "name": { "type": "string", "maxLength": 140 },
        "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
        "role": { "type": "string", "maxLength": 140 }
      }
    },
    "speakers": {
      "description": "Either a reference to a profile in speakers/ ({speakerId}) or an inline public name. Public names only, no contact data.",
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object", "additionalProperties": false, "required": ["speakerId"],
            "properties": {
              "speakerId": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
              "talk": { "type": "string", "maxLength": 200 }
            }
          },
          {
            "type": "object", "additionalProperties": false, "required": ["name"],
            "properties": {
              "name": { "type": "string", "maxLength": 140 },
              "affiliation": { "type": "string", "maxLength": 140 },
              "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
              "talk": { "type": "string", "maxLength": 200 }
            }
          }
        ]
      }
    },
    "languages": {
      "description": "BCP 47 language tags of the event, e.g. en, zh-CN.",
      "type": "array", "minItems": 1, "uniqueItems": true,
      "items": { "type": "string", "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$" }
    },
    "image": {
      "type": "object", "additionalProperties": false, "required": ["url", "alt"],
      "properties": {
        "url": { "type": "string", "format": "uri", "pattern": "^https://" },
        "alt": { "type": "string", "maxLength": 200 }
      }
    },
    "codeOfConductUrl": { "type": "string", "format": "uri", "pattern": "^https?://" },
    "contactUrl": {
      "description": "Public contact page. Do not put personal e-mail addresses into this public repository.",
      "type": "string", "format": "uri", "pattern": "^https?://"
    },
    "sameAs": {
      "description": "Other canonical pages of the same event (social media, lu.ma, Meetup, ...).",
      "type": "array", "uniqueItems": true,
      "items": { "type": "string", "format": "uri", "pattern": "^https?://" }
    },
    "source": {
      "description": "Where the information was verified. Agents read this data, so wrong data spreads.",
      "type": "object", "additionalProperties": false, "required": ["url"],
      "properties": {
        "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
        "note": { "type": "string", "maxLength": 300 }
      }
    },
    "lastVerified": {
      "description": "Date (YYYY-MM-DD, UTC) on which the data was last checked against the source.",
      "type": "string", "format": "date"
    },
    "updated": {
      "description": "UTC timestamp of the last content change. Optional; used for feeds and calendar LAST-MODIFIED.",
      "$ref": "#/$defs/utc"
    }
  },
  "allOf": [
    {
      "if": { "properties": { "status": { "const": "rescheduled" } }, "required": ["status"] },
      "then": { "required": ["previousStart", "previousEnd"] }
    },
    {
      "if": { "properties": { "status": { "enum": ["rescheduled", "postponed", "cancelled"] } }, "required": ["status"] },
      "then": { "required": ["statusNote"] }
    },
    {
      "if": { "properties": { "mode": { "enum": ["in-person", "hybrid"] } }, "required": ["mode"] },
      "then": { "required": ["location"] }
    },
    {
      "if": { "properties": { "mode": { "enum": ["online", "hybrid"] } }, "required": ["mode"] },
      "then": { "required": ["onlineUrl"] }
    }
  ],
  "$defs": {
    "utc": {
      "description": "UTC timestamp, always with a trailing Z, e.g. 2026-11-19T09:00:00Z.",
      "type": "string",
      "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\dZ$"
    },
    "eventType": {
      "type": "string",
      "enum": [
        "conference", "trade-show", "meetup", "workshop", "hackathon", "webinar",
        "course", "competition", "tapeout-deadline", "community-call", "other"
      ]
    },
    "status": {
      "type": "string",
      "enum": ["scheduled", "rescheduled", "postponed", "cancelled"]
    }
  }
}
