{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://maisonmontres.com/downloads/private-watch-collection-register.schema.json",
  "title": "Private Watch Collection Register",
  "description": "A portable record format for privately managed watch collections. Store sensitive identifiers in an appropriately controlled system.",
  "type": "object",
  "required": ["schema_version", "records"],
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "exported_at": {
      "type": "string",
      "format": "date-time"
    },
    "records": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/watchRecord"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "watchRecord": {
      "type": "object",
      "required": ["record_id", "brand", "model"],
      "properties": {
        "record_id": {"type": "string", "minLength": 1},
        "brand": {"type": "string", "minLength": 1},
        "model": {"type": "string", "minLength": 1},
        "reference": {"type": "string"},
        "serial_token": {"type": "string", "description": "Masked serial or controlled token; avoid exporting a full serial."},
        "year": {
          "anyOf": [
            {"const": ""},
            {"type": "string", "pattern": "^[12][0-9]{3}$"},
            {"type": "integer", "minimum": 1700, "maximum": 2100}
          ]
        },
        "case_material": {"type": "string"},
        "acquisition_date": {"$ref": "#/$defs/optionalDate"},
        "acquisition_source": {"type": "string"},
        "acquisition_currency": {"type": "string", "pattern": "^(|[A-Z]{3})$"},
        "acquisition_cost": {"$ref": "#/$defs/optionalAmount"},
        "current_location": {"type": "string"},
        "custody_status": {"type": "string"},
        "condition_date": {"$ref": "#/$defs/optionalDate"},
        "photo_record": {"type": "string"},
        "invoice_record": {"type": "string"},
        "authenticity_record": {"type": "string"},
        "service_last_date": {"$ref": "#/$defs/optionalDate"},
        "service_provider": {"type": "string"},
        "valuation_purpose": {"type": "string"},
        "valuation_date": {"$ref": "#/$defs/optionalDate"},
        "valuation_currency": {"type": "string", "pattern": "^(|[A-Z]{3})$"},
        "valuation_amount": {"$ref": "#/$defs/optionalAmount"},
        "insurance_status": {"type": "string"},
        "policy_reference": {"type": "string"},
        "next_review_date": {"$ref": "#/$defs/optionalDate"},
        "beneficial_owner": {"type": "string"},
        "authorized_contact": {"type": "string"},
        "disposition_instruction": {"type": "string"},
        "notes": {"type": "string"}
      },
      "additionalProperties": false
    },
    "optionalDate": {
      "anyOf": [
        {"const": ""},
        {"type": "string", "format": "date"}
      ]
    },
    "optionalAmount": {
      "anyOf": [
        {"const": ""},
        {"type": "number", "minimum": 0},
        {"type": "string", "pattern": "^[0-9]+(?:\\.[0-9]{1,2})?$"}
      ]
    }
  }
}
