{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agrodt.github.io/agrotool-knowledge-portal/schemas/v3/issue_snapshots.schema.json",
  "title": "PublicIssueSnapshotsV3",
  "type": "array",
  "items": {
    "type": "object",
    "allOf": [
      { "$ref": "../v1/common.schema.json#/$defs/recordMetadata" },
      {
        "type": "object",
        "required": [
          "issue_snapshot_id",
          "repository",
          "repository_url",
          "issue_number",
          "title",
          "state",
          "labels",
          "url",
          "captured_at",
          "source_api_identity",
          "snapshot_sha256",
          "component_ids",
          "gap_candidate_ids",
          "source_ids"
        ],
        "properties": {
          "issue_snapshot_id": {
            "type": "string",
            "pattern": "^IS[A-Z0-9_-]{2,62}$"
          },
          "repository": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
          },
          "repository_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://github\\.com/"
          },
          "issue_number": { "type": "integer", "minimum": 1 },
          "title": { "type": "string", "minLength": 1, "maxLength": 500 },
          "state": { "enum": ["open", "closed"] },
          "labels": {
            "type": "array",
            "items": { "type": "string", "minLength": 1, "maxLength": 100 },
            "uniqueItems": true
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://github\\.com/"
          },
          "captured_at": { "type": "string", "format": "date-time" },
          "source_api_identity": { "type": "string", "minLength": 1 },
          "snapshot_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "component_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^CMP[A-Z0-9_-]{1,61}$"
            },
            "uniqueItems": true
          },
          "gap_candidate_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^GAP[A-Z0-9_-]{1,60}$"
            },
            "uniqueItems": true
          },
          "source_ids": {
            "allOf": [
              { "$ref": "../v1/common.schema.json#/$defs/sourceIds" },
              { "type": "array", "minItems": 1 }
            ]
          }
        }
      }
    ],
    "unevaluatedProperties": false
  }
}
