{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://altheia.local/schemas/altheia_product_ownership_assessment_1.0.schema.json",
  "title": "ALTHEIA Product Ownership Assessment 1.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "status",
    "policy_hash",
    "profile_context_hash",
    "population_size",
    "realization",
    "seed",
    "attempts",
    "products"
  ],
  "properties": {
    "schema_version": {
      "const": "altheia_product_ownership_assessment_1.0"
    },
    "status": {
      "const": "passed"
    },
    "policy_hash": {
      "type": "string",
      "pattern": "^fnv1a-[a-f0-9]{8}$"
    },
    "profile_context_hash": {
      "type": "string",
      "pattern": "^fnv1a-[a-f0-9]{8}$"
    },
    "population_size": {
      "type": "integer",
      "minimum": 1
    },
    "realization": {
      "enum": [
        "exact_quota",
        "balanced_randomized_rounding"
      ]
    },
    "seed": {
      "type": [
        "string",
        "integer"
      ]
    },
    "attempts": {
      "type": "integer",
      "minimum": 1
    },
    "products": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "offer_id",
          "configured_rate",
          "target_count",
          "actual_count"
        ],
        "properties": {
          "offer_id": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
          },
          "configured_rate": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1
          },
          "target_count": {
            "type": "integer",
            "minimum": 0
          },
          "actual_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    }
  }
}
