{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://altheia.local/schemas/altheia-master-farm-2.5.1.schema.json",
  "title": "ALTHEIA Identity Corpus Master Farm 2.5.1",
  "description": "Granja maestra con identidad dimensional canónica y compatibilidad estricta por semántica, medición, asignación y marca.",
  "type": "object",
  "additionalProperties": false,
  "required": ["module", "module_version", "export_version", "profile_schema_version", "farm_contract_version", "dimension_identity", "semantic_hash", "measurement_hash", "assignment_hash", "sector_pack_hash", "sector_context", "brand_context", "sector_pack", "brand_pack", "exported_at", "master_farm"],
  "properties": {
    "module": {"const": "identity_corpus_master_farm_2.5.1"},
    "module_version": {"const": "2.5.1"},
    "export_version": {"const": "2.5.1"},
    "profile_schema_version": {"const": "altheia_profile_2.5"},
    "farm_contract_version": {"const": "altheia_master_farm_2.5.1"},
    "dimension_identity": {"const": "canonical_dimension_id"},
    "semantic_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
    "measurement_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
    "assignment_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
    "sector_pack_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
    "voice_style_contract": {"const": "altheia_voice_style_1.0"},
    "voice_style_distribution_mode": {"enum": ["balanced", "natural", "mixed", "unknown"]},
    "sector_context": {"type": "object"},
    "brand_context": {"type": "object"},
    "sector_pack": {"$ref": "altheia_sector_pack_1.1.schema.json"},
    "brand_pack": {"$ref": "altheia_brand_pack_1.1.schema.json"},
    "exported_at": {"type": "string", "format": "date-time"},
    "master_farm": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract_version", "profile_schema_version", "dimension_identity", "compatibility_policy", "semantic_hash", "measurement_hash", "assignment_hash", "sector_pack_hash", "sector_context", "brand_context", "sector_pack", "brand_pack", "dimension_lineage", "product_catalog_version", "created_or_updated_at", "id_strategy", "summary", "duplicates_last_run", "source_packages", "profiles"],
      "properties": {
        "contract_version": {"const": "altheia_master_farm_2.5.1"},
        "profile_schema_version": {"const": "altheia_profile_2.5"},
        "dimension_identity": {"const": "canonical_dimension_id"},
        "compatibility_policy": {"const": "strict_semantic_measurement_assignment_and_brand_hashes"},
        "semantic_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
        "measurement_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
        "assignment_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
        "sector_pack_hash": {"type": "string", "pattern": "^fnv1a-[a-f0-9]{8}$"},
        "voice_style_contract": {"const": "altheia_voice_style_1.0"},
        "voice_style_distribution_mode": {"enum": ["balanced", "natural", "mixed", "unknown"]},
        "sector_context": {"type": "object"},
        "brand_context": {"type": "object"},
        "sector_pack": {"$ref": "altheia_sector_pack_1.1.schema.json"},
        "brand_pack": {"$ref": "altheia_brand_pack_1.1.schema.json"},
        "dimension_lineage": {"type": "array", "minItems": 45, "maxItems": 45, "items": {"type": "object", "required": ["slot", "canonical_dimension_id", "label", "scope"], "properties": {"slot": {"pattern": "^D(?:0[1-9]|[1-3][0-9]|4[0-5])$"}, "canonical_dimension_id": {"type": "string"}, "label": {"type": "string"}, "scope": {"type": "string"}}}},
        "product_catalog_version": {"const": "altheia_financial_products_2.0"},
        "created_or_updated_at": {"type": "string", "format": "date-time"},
        "id_strategy": {"const": "profile_uuid_primary_profile_id_consistency_check"},
        "summary": {"type": "object"},
        "duplicates_last_run": {"type": "array", "items": {"type": "object"}},
        "source_packages": {"type": "array", "minItems": 1, "items": {"type": "object", "required": ["source_name", "source_type", "dimension_identity", "semantic_hash", "measurement_hash", "assignment_hash", "profiles_count", "loaded_at", "sector_pack_id", "brand_pack_id", "brand_pack_hash"], "properties": {"voice_style_contract": {"type": ["string", "null"]}, "voice_style_distribution_mode": {"enum": ["balanced", "natural", "mixed", "unknown"]}}}},
        "profiles": {"type": "array", "minItems": 1, "items": {"type": "object", "required": ["schema_version", "profile_uuid", "profile_id", "sector_context", "brand_context", "dimensions", "dimension_evidence", "extensions"]}}
      }
    }
  }
}
