{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trp.ecoclaim.ca/schemas/v3/claim.schema.json",
  "title": "TRP Claim",
  "description": "Stable root record for an insured loss. Draft 3.0.0-draft.",
  "allOf": [{ "$ref": "common.schema.json#/$defs/envelope" }],
  "type": "object",
  "required": ["claim_id", "loss"],
  "properties": {
    "type": { "const": "trp.claim" },
    "claim_id": { "$ref": "common.schema.json#/$defs/identifier" },
    "property": {
      "type": "object",
      "properties": {
        "country": { "type": "string", "pattern": "^[A-Z]{2}$" },
        "region": { "type": "string", "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$" },
        "structure_count": { "type": "integer", "minimum": 1 }
      }
    },
    "loss": {
      "type": "object",
      "required": ["peril", "date_of_loss"],
      "properties": {
        "peril": { "enum": ["water", "fire", "smoke", "flood", "wind", "wildfire", "hail", "seismic", "freeze", "heat", "other"] },
        "date_of_loss": { "$ref": "common.schema.json#/$defs/date" },
        "description": { "type": "string" }
      }
    },
    "parties": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["actor_id", "role"],
        "properties": {
          "actor_id": { "$ref": "common.schema.json#/$defs/identifier" },
          "role": { "enum": ["policyholder", "insurer", "tpa", "adjuster", "estimator", "contractor", "subcontractor", "engineer", "architect", "supplier", "recycler", "hauler", "facility", "verifier", "other"] }
        }
      }
    }
  }
}
