{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pestprocrm-com/json-schema/pestprocrm-com-property-schema.json",
  "title": "Property",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pestprocrm-com-properties-api-openapi.yml#/components/schemas/Property",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique property ID"
    },
    "customerId": {
      "type": "string",
      "description": "Associated customer ID"
    },
    "customerName": {
      "type": "string",
      "description": "Customer name"
    },
    "address": {
      "type": "string",
      "description": "Property address"
    },
    "lat": {
      "type": "number",
      "description": "Latitude coordinate"
    },
    "lng": {
      "type": "number",
      "description": "Longitude coordinate"
    },
    "propertyType": {
      "type": "string",
      "enum": [
        "residential",
        "commercial"
      ],
      "description": "Property type"
    },
    "squareFootage": {
      "type": "number",
      "description": "Property size in square feet"
    },
    "yearBuilt": {
      "type": "integer",
      "description": "Year property was built"
    },
    "constructionType": {
      "type": "string",
      "description": "Type of construction (wood, concrete, etc.)"
    },
    "knownIssues": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/KnownIssue"
      },
      "description": "Known pest issues"
    },
    "treatmentPlan": {
      "$ref": "#/$defs/TreatmentPlan"
    },
    "inspectionHistory": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Linked service record IDs"
    },
    "notes": {
      "type": "string",
      "description": "Property notes"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Created timestamp"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Updated timestamp"
    }
  },
  "required": [
    "id",
    "address"
  ],
  "$defs": {
    "KnownIssue": {
      "type": "object",
      "properties": {
        "pestType": {
          "type": "string",
          "description": "Type of pest issue"
        },
        "severity": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high",
            "critical"
          ],
          "description": "Severity level"
        },
        "location": {
          "type": "string",
          "description": "Location of issue on property"
        },
        "firstReported": {
          "type": "string",
          "format": "date-time",
          "description": "When issue was first reported"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "monitoring",
            "resolved"
          ],
          "description": "Current status"
        }
      },
      "required": [
        "pestType"
      ]
    },
    "TreatmentPlan": {
      "type": "object",
      "properties": {
        "frequency": {
          "type": "string",
          "description": "Treatment frequency"
        },
        "nextDueDate": {
          "type": "string",
          "format": "date",
          "description": "Next treatment due date"
        },
        "services": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of services in plan"
        }
      }
    }
  }
}