{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.delmaragency.com/quote.schema.json",
  "title": "DelMarQuoteRequest",
  "description": "Soft quote intake for Del Mar Insurance personal and specialty lines. Broker follow-up only — never returns a premium, binds coverage, or accepts carrier-portal credentials.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "fullName",
    "phone",
    "email",
    "preferredContact",
    "zip",
    "coverageType",
    "howFound",
    "bestTime"
  ],
  "anyOf": [
    {
      "properties": {
        "submitted_by": { "enum": ["self", "authorized_agent"] }
      },
      "required": ["submitted_by"]
    },
    {
      "properties": {
        "authorizedByCustomer": { "const": true }
      },
      "required": ["authorizedByCustomer"]
    }
  ],
  "properties": {
    "fullName": { "type": "string", "minLength": 2 },
    "phone": { "type": "string", "minLength": 10 },
    "email": { "type": "string", "format": "email" },
    "preferredContact": { "type": "string", "enum": ["phone", "email", "text"] },
    "zip": { "type": "string", "pattern": "^\\d{5}(-\\d{4})?$" },
    "coverageType": {
      "type": "string",
      "enum": [
        "auto",
        "home",
        "multi",
        "renters",
        "motorcycle",
        "condo",
        "boat",
        "windstorm",
        "landlord",
        "mobile-home"
      ],
      "description": "Life and health are not offered and are rejected by the API. Business is call/text only."
    },
    "currentCarrier": { "type": "string" },
    "currentExpiration": { "type": "string" },
    "howFound": { "type": "string" },
    "bestTime": { "type": "string" },
    "vehicleYear": { "type": "string" },
    "vehicleMake": { "type": "string" },
    "vehicleModel": { "type": "string" },
    "vin": { "type": "string" },
    "vehicleUse": { "type": "string" },
    "annualMiles": { "type": "string" },
    "garagingZip": { "type": "string" },
    "drivers": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string" },
          "name": {
            "type": "string",
            "description": "Optional driver name."
          },
          "relationship": {
            "type": "string",
            "description": "Optional relationship to the applicant (self, spouse, child, parent, other)."
          },
          "dob": { "type": "string" },
          "txLicenseStatus": { "type": "string" }
        }
      }
    },
    "autoClaims": { "type": "string" },
    "liabilityLimit": { "type": "string" },
    "compDeductible": { "type": "string" },
    "collDeductible": { "type": "string" },
    "financed": { "type": "string" },
    "lienholder": { "type": "string" },
    "homeAddress": {
      "type": "string",
      "description": "Required for homeowners, multi, condo, boat, windstorm, landlord, and mobile home."
    },
    "ownerOccupied": { "type": "string" },
    "yearBuilt": { "type": "string" },
    "construction": { "type": "string" },
    "sqFt": { "type": "string" },
    "roofAge": { "type": "string" },
    "roofType": { "type": "string" },
    "alarms": { "type": "string" },
    "homeClaims": { "type": "string" },
    "dwellingValue": { "type": "string" },
    "homeDeductible": { "type": "string" },
    "windHailDeductible": { "type": "string" },
    "mortgagee": { "type": "string" },
    "includeRenters": { "type": "string" },
    "rentersAddress": { "type": "string" },
    "personalPropertyLimit": { "type": "string" },
    "rentersLiability": { "type": "string" },
    "hasDog": { "type": "string" },
    "dogBreed": { "type": "string" },
    "rentersClaims": { "type": "string" },
    "specialtyNotes": {
      "type": "string",
      "minLength": 10,
      "description": "Required for motorcycle, condo, boat, windstorm, landlord, and mobile home."
    },
    "submitted_by": {
      "type": "string",
      "enum": ["self", "authorized_agent"],
      "description": "Human form sets self. Agents completing intake for a customer use authorized_agent."
    },
    "authorizedByCustomer": {
      "type": "boolean",
      "description": "Accepted as an alternative consent flag. Must be true only after the customer authorizes submit."
    },
    "source": { "type": "string", "description": "e.g. web, assistant" }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "coverageType": {
            "enum": [
              "motorcycle",
              "condo",
              "boat",
              "windstorm",
              "landlord",
              "mobile-home"
            ]
          }
        },
        "required": ["coverageType"]
      },
      "then": {
        "required": ["specialtyNotes"]
      }
    },
    {
      "if": {
        "properties": {
          "coverageType": {
            "enum": ["condo", "boat", "windstorm", "landlord", "mobile-home"]
          }
        },
        "required": ["coverageType"]
      },
      "then": {
        "required": ["homeAddress"]
      }
    }
  ]
}
