{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/state-farm/main/json-schema/state-farm-renters-policy-schema.json",
  "title": "Renters Insurance Policy",
  "description": "Schema for a State Farm renters insurance policy",
  "type": "object",
  "properties": {
    "policyNumber": {
      "type": "string",
      "description": "State Farm policy number",
      "pattern": "^[0-9]{3}-[0-9]{4}-[A-Z][0-9]{2}$",
      "examples": ["987-6543-B12"]
    },
    "status": {
      "type": "string",
      "description": "Current policy status",
      "enum": ["ACTIVE", "PENDING", "CANCELLED", "EXPIRED", "LAPSED"]
    },
    "effectiveDate": {
      "type": "string",
      "format": "date",
      "description": "Date the policy coverage begins"
    },
    "expirationDate": {
      "type": "string",
      "format": "date",
      "description": "Date the policy coverage expires"
    },
    "annualPremium": {
      "type": "number",
      "description": "Annual premium amount in USD",
      "minimum": 0
    },
    "monthlyPremium": {
      "type": "number",
      "description": "Monthly premium amount in USD",
      "minimum": 0
    },
    "insuredName": {
      "type": "string",
      "description": "Full name of the primary insured"
    },
    "propertyAddress": {
      "$ref": "#/definitions/Address"
    },
    "coverageSummary": {
      "$ref": "#/definitions/CoverageSelection"
    }
  },
  "required": ["policyNumber", "status", "effectiveDate", "expirationDate", "insuredName", "propertyAddress"],
  "definitions": {
    "Address": {
      "type": "object",
      "description": "US property address",
      "properties": {
        "street": {
          "type": "string",
          "description": "Street address including unit number"
        },
        "city": {
          "type": "string",
          "description": "City name"
        },
        "state": {
          "type": "string",
          "description": "Two-letter US state code",
          "pattern": "^[A-Z]{2}$"
        },
        "zipCode": {
          "type": "string",
          "description": "ZIP or ZIP+4 postal code",
          "pattern": "^[0-9]{5}(-[0-9]{4})?$"
        }
      },
      "required": ["street", "city", "state", "zipCode"]
    },
    "CoverageSelection": {
      "type": "object",
      "description": "Renters insurance coverage selections",
      "properties": {
        "personalPropertyLimit": {
          "type": "integer",
          "description": "Personal property coverage limit in USD",
          "minimum": 0
        },
        "liabilityLimit": {
          "type": "integer",
          "description": "Personal liability coverage limit in USD",
          "minimum": 0
        },
        "medicalPaymentsLimit": {
          "type": "integer",
          "description": "Medical payments to others limit in USD",
          "minimum": 0
        },
        "deductible": {
          "type": "integer",
          "description": "Policy deductible amount in USD",
          "minimum": 0
        },
        "additionalLivingExpenses": {
          "type": "boolean",
          "description": "Whether additional living expenses coverage is included"
        },
        "identityRestorationCoverage": {
          "type": "boolean",
          "description": "Whether identity restoration coverage is included"
        }
      }
    }
  }
}
