{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://altheia.local/schemas/altheia_product_ownership_1.0.schema.json",
  "title": "altheia_product_ownership_1.0 candidate — lot B",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "state",
    "catalog_reference",
    "policy_reference",
    "holdings",
    "provenance"
  ],
  "properties": {
    "schema_version": {
      "const": "altheia_product_ownership_1.0"
    },
    "state": {
      "enum": [
        "known",
        "partial",
        "unknown"
      ]
    },
    "catalog_reference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sector_id",
        "catalog_id",
        "catalog_version",
        "catalog_hash"
      ],
      "properties": {
        "sector_id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
        },
        "catalog_id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
        },
        "catalog_version": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$"
        },
        "catalog_hash": {
          "type": "string",
          "pattern": "^fnv1a-[a-f0-9]{8}$"
        }
      }
    },
    "policy_reference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "policy_id",
        "policy_version",
        "policy_hash"
      ],
      "properties": {
        "policy_id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
        },
        "policy_version": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$"
        },
        "policy_hash": {
          "type": "string",
          "pattern": "^fnv1a-[a-f0-9]{8}$"
        }
      }
    },
    "holdings": {
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "offer_id",
          "provider_scope",
          "provider_id"
        ],
        "properties": {
          "offer_id": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
          },
          "provider_scope": {
            "enum": [
              "focal",
              "other",
              "unknown"
            ]
          },
          "provider_id": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1
          }
        }
      },
      "uniqueItems": true
    },
    "provenance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "source_reference",
        "as_of"
      ],
      "properties": {
        "method": {
          "enum": [
            "generated",
            "imported",
            "replayed",
            "declared"
          ]
        },
        "source_reference": {
          "type": "string",
          "minLength": 1
        },
        "as_of": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}
