{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://loop.firmiana.si/filings/v1/filings.schema.json",
  "title": "Loop: China generative-AI service filings and registrations, from the Cyberspace Administration of China's published lists",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "version", "generated_at", "license", "source", "totals", "batches", "records", "changes"],
  "properties": {
    "schema": { "const": "https://loop.firmiana.si/filings/v1/filings.schema.json" },
    "version": { "const": 1 },
    "generated_at": { "type": "string", "format": "date-time" },
    "license": { "const": "CC-BY-4.0" },
    "source": { "type": "string", "format": "uri" },
    "totals": {
      "type": "object",
      "additionalProperties": false,
      "required": ["filing", "registration"],
      "properties": { "filing": { "type": "integer" }, "registration": { "type": "integer" } }
    },
    "batches": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["batch", "label", "period", "file", "filing", "registration", "change"],
        "properties": {
          "batch": { "type": "string" },
          "label": { "type": "string" },
          "period": { "type": ["string", "null"] },
          "file": { "type": "string", "format": "uri" },
          "filing": { "type": "integer" },
          "registration": { "type": "integer" },
          "change": { "type": "integer" }
        }
      }
    },
    "records": { "type": "array", "items": { "$ref": "#/$defs/record" } },
    "changes": { "type": "array", "items": { "$ref": "#/$defs/record" } }
  },
  "$defs": {
    "record": {
      "type": "object",
      "additionalProperties": false,
      "required": ["kind", "scene", "seq", "region", "name", "org", "id", "date", "late", "unverified", "batch", "period", "source"],
      "properties": {
        "kind": { "enum": ["filing", "registration", "change"] },
        "scene": { "type": ["string", "null"] },
        "seq": { "type": "integer" },
        "region": { "type": "string" },
        "name": { "type": "string" },
        "org": { "type": "string" },
        "id": { "type": "string" },
        "date": { "type": ["string", "null"], "format": "date" },
        "unverified": { "type": "array", "items": { "enum": ["id"] }, "description": "Fields whose text could not be read whole from the PDF" },
        "late": { "type": "boolean" },
        "changed": { "type": "string", "format": "date" },
        "batch": { "type": "string", "description": "Batch (attachment month) the record was published in" },
        "period": { "type": ["string", "null"] },
        "source": { "type": "string", "format": "uri", "description": "The official attachment that lists the record" }
      }
    }
  }
}
