{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://systemstheology.com/research/schema/corpus.schema.json",
  "title": "Systems Theology agent corpus",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "corpusVersion",
    "contentHashSha256",
    "generatedAt",
    "defaultLanguage",
    "languages",
    "publisher",
    "corpusUrl",
    "schemaUrl",
    "agentGuideUrl",
    "usePolicyUrl",
    "aiUseDisclosure",
    "books"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.0.0"
    },
    "corpusVersion": {
      "type": "string",
      "pattern": "^content-[a-f0-9]{12}$"
    },
    "contentHashSha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "defaultLanguage": {
      "type": "string",
      "minLength": 2
    },
    "languages": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "publisher": {
      "type": "string",
      "minLength": 1
    },
    "corpusUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "schemaUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "agentGuideUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "usePolicyUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "aiUseDisclosure": {
      "type": "string",
      "minLength": 1
    },
    "books": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/book"
      }
    }
  },
  "$defs": {
    "section": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "title",
        "level",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "level": {
          "type": "integer",
          "minimum": 1,
          "maximum": 6
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      }
    },
    "chapter": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "workId",
        "bookId",
        "chapterId",
        "slug",
        "position",
        "title",
        "bookTitle",
        "language",
        "sourceLanguage",
        "translationStatus",
        "authors",
        "editorialOwner",
        "editors",
        "reviewStatus",
        "reviewers",
        "contentVersion",
        "contentHashSha256",
        "publishedAt",
        "modifiedAt",
        "canonicalUrl",
        "markdownUrl",
        "license",
        "licenseUrl",
        "correctionUrl",
        "citation",
        "wordCount",
        "sections"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "workId": {
          "type": "string",
          "pattern": "^urn:systemstheology:"
        },
        "bookId": {
          "type": "string",
          "minLength": 1
        },
        "chapterId": {
          "type": "string",
          "minLength": 1
        },
        "slug": {
          "type": "string",
          "pattern": "^chapter-[0-9]+$"
        },
        "position": {
          "type": "integer",
          "minimum": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "bookTitle": {
          "type": "string",
          "minLength": 1
        },
        "language": {
          "type": "string",
          "minLength": 2
        },
        "sourceLanguage": {
          "type": "string",
          "minLength": 2
        },
        "translationStatus": {
          "enum": [
            "source",
            "translation"
          ]
        },
        "authors": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "editorialOwner": {
          "type": "string",
          "minLength": 1
        },
        "editors": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "reviewStatus": {
          "enum": [
            "not_specified"
          ]
        },
        "reviewers": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "contentVersion": {
          "type": "string",
          "pattern": "^content-[a-f0-9]{12}$"
        },
        "contentHashSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "modifiedAt": {
          "type": "string",
          "format": "date-time"
        },
        "canonicalUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "markdownUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "license": {
          "type": "string",
          "minLength": 1
        },
        "licenseUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "correctionUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "citation": {
          "type": "string",
          "minLength": 1
        },
        "wordCount": {
          "type": "integer",
          "minimum": 0
        },
        "sections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/section"
          }
        }
      }
    },
    "localization": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "language",
        "languageLabel",
        "sourceLanguage",
        "translationStatus",
        "title",
        "description",
        "canonicalUrl",
        "markdownIndexUrl",
        "contentVersion",
        "contentHashSha256",
        "publishedAt",
        "modifiedAt",
        "chapterCount",
        "wordCount",
        "chapters"
      ],
      "properties": {
        "language": {
          "type": "string",
          "minLength": 2
        },
        "languageLabel": {
          "type": "string",
          "minLength": 1
        },
        "sourceLanguage": {
          "type": "string",
          "minLength": 2
        },
        "translationStatus": {
          "enum": [
            "source",
            "translation"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string"
        },
        "canonicalUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "markdownIndexUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "contentVersion": {
          "type": "string",
          "pattern": "^content-[a-f0-9]{12}$"
        },
        "contentHashSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "modifiedAt": {
          "type": "string",
          "format": "date-time"
        },
        "chapterCount": {
          "type": "integer",
          "minimum": 1
        },
        "wordCount": {
          "type": "integer",
          "minimum": 0
        },
        "chapters": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/chapter"
          }
        }
      }
    },
    "book": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "slug",
        "title",
        "description",
        "authors",
        "publisher",
        "editorialOwner",
        "editors",
        "reviewStatus",
        "reviewers",
        "defaultLanguage",
        "license",
        "licenseUrl",
        "contentVersion",
        "contentHashSha256",
        "publishedAt",
        "modifiedAt",
        "chapterCount",
        "markdownIndexUrl",
        "manifestUrl",
        "localizations"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "slug": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string"
        },
        "authors": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "editorialOwner": {
          "type": "string",
          "minLength": 1
        },
        "editors": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "reviewStatus": {
          "enum": [
            "not_specified"
          ]
        },
        "reviewers": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "publisher": {
          "type": "string",
          "minLength": 1
        },
        "defaultLanguage": {
          "type": "string",
          "minLength": 2
        },
        "license": {
          "type": "string",
          "minLength": 1
        },
        "licenseUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "contentVersion": {
          "type": "string",
          "pattern": "^content-[a-f0-9]{12}$"
        },
        "contentHashSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "modifiedAt": {
          "type": "string",
          "format": "date-time"
        },
        "chapterCount": {
          "type": "integer",
          "minimum": 1
        },
        "markdownIndexUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "manifestUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "localizations": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/localization"
          }
        }
      }
    }
  }
}
