{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agrodt.github.io/agrotool-knowledge-portal/schemas/v1/sources.schema.json",
  "title": "PublicSources",
  "type": "array",
  "items": {
    "type": "object",
    "allOf": [
      { "$ref": "common.schema.json#/$defs/recordMetadata" },
      {
        "type": "object",
        "required": [
          "source_id",
          "title",
          "url",
          "source_type",
          "source_class",
          "authority_level",
          "accessed_at"
        ],
        "properties": {
          "source_id": { "type": "string", "pattern": "^S[A-Z0-9_-]{3,63}$" },
          "title": { "type": "string", "minLength": 1 },
          "url": { "type": "string", "format": "uri" },
          "source_type": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
          "source_class": {
            "enum": [
              "author_repository",
              "bibliographic_registry",
              "conference_archive",
              "institutional",
              "library_catalog",
              "other",
              "publisher",
              "secondary",
              "web_archive"
            ]
          },
          "authority_level": {
            "enum": ["primary", "authoritative_metadata", "secondary"]
          },
          "accessed_at": { "type": "string", "format": "date" }
        }
      }
    ],
    "unevaluatedProperties": false
  }
}
