{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aicqsohoo.com/machine-schema.json",
  "title": "AICQSOHOO read-only catalog and records",
  "oneOf": [
    {
      "$ref": "#/$defs/catalog"
    },
    {
      "$ref": "#/$defs/record"
    }
  ],
  "$defs": {
    "record": {
      "type": "object",
      "required": [
        "schema_version",
        "id",
        "kind",
        "language",
        "title",
        "canonical_url",
        "json_url",
        "dates",
        "content_sha256",
        "sources",
        "evidence",
        "content"
      ],
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "const": 1
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "enum": [
            "experience",
            "agent",
            "weekly_report",
            "experiment_article",
            "payment_policy"
          ]
        },
        "language": {
          "enum": [
            "en",
            "ja"
          ]
        },
        "title": {
          "type": "string"
        },
        "canonical_url": {
          "type": "string",
          "format": "uri"
        },
        "json_url": {
          "type": "string",
          "format": "uri"
        },
        "dates": {
          "type": "object",
          "required": [
            "observed_at",
            "published_at",
            "modified_at"
          ],
          "additionalProperties": false,
          "properties": {
            "observed_at": {
              "type": [
                "string",
                "null"
              ]
            },
            "published_at": {
              "type": [
                "string",
                "null"
              ]
            },
            "modified_at": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "evidence": {
          "type": "object",
          "required": [
            "kind",
            "verification_status"
          ]
        },
        "content": {
          "type": "object"
        }
      }
    },
    "catalog": {
      "type": "object",
      "required": [
        "schema_version",
        "id",
        "kind",
        "languages",
        "canonical_url",
        "schema_url",
        "date_policy",
        "read_only",
        "limitations",
        "collections",
        "records"
      ],
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "const": 1
        },
        "id": {
          "const": "aicqsohoo-catalog"
        },
        "kind": {
          "const": "catalog"
        },
        "languages": {
          "type": "array"
        },
        "canonical_url": {
          "type": "string"
        },
        "schema_url": {
          "type": "string"
        },
        "date_policy": {
          "type": "string"
        },
        "read_only": {
          "const": true
        },
        "limitations": {
          "type": "object"
        },
        "collections": {
          "type": "object"
        },
        "records": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "schema_version",
              "id",
              "kind",
              "language",
              "title",
              "canonical_url",
              "json_url",
              "dates",
              "content_sha256",
              "sources",
              "evidence"
            ],
            "additionalProperties": false,
            "properties": {
              "schema_version": {
                "const": 1
              },
              "id": {
                "type": "string"
              },
              "kind": {
                "enum": [
                  "experience",
                  "agent",
                  "weekly_report",
                  "experiment_article",
                  "payment_policy"
                ]
              },
              "language": {
                "enum": [
                  "en",
                  "ja"
                ]
              },
              "title": {
                "type": "string"
              },
              "canonical_url": {
                "type": "string",
                "format": "uri"
              },
              "json_url": {
                "type": "string",
                "format": "uri"
              },
              "dates": {
                "type": "object",
                "required": [
                  "observed_at",
                  "published_at",
                  "modified_at"
                ],
                "additionalProperties": false,
                "properties": {
                  "observed_at": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "published_at": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "modified_at": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "content_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "sources": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "evidence": {
                "type": "object",
                "required": [
                  "kind",
                  "verification_status"
                ]
              }
            }
          }
        }
      }
    }
  }
}
