{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pestprocrm-com/json-schema/pestprocrm-com-customer-schema.json",
  "title": "Customer",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pestprocrm-com-openapi.yml#/components/schemas/Customer",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique customer ID"
    },
    "name": {
      "type": "string",
      "description": "Customer name"
    },
    "contact": {
      "type": "string",
      "description": "Contact person name"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "Email address"
    },
    "mobilePhone": {
      "type": "string",
      "description": "Mobile phone number"
    },
    "homePhone": {
      "type": "string",
      "description": "Home phone number"
    },
    "workPhone": {
      "type": "string",
      "description": "Work phone number"
    },
    "address": {
      "type": "string",
      "description": "Service address"
    },
    "services": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of services"
    },
    "serviceType": {
      "type": "string",
      "enum": [
        "interior",
        "exterior",
        "both"
      ],
      "description": "Service type"
    },
    "serviceCategory": {
      "type": "string",
      "enum": [
        "routine",
        "initial",
        "callback"
      ],
      "description": "Service category"
    },
    "mrr": {
      "type": "number",
      "description": "Monthly recurring revenue"
    },
    "nextService": {
      "type": "string",
      "format": "date",
      "description": "Next scheduled service date"
    },
    "serviceTime": {
      "type": "string",
      "description": "Preferred service time (HH:MM)"
    },
    "visitNumber": {
      "type": "integer",
      "description": "Current visit number"
    },
    "totalVisits": {
      "type": "integer",
      "description": "Total visits in plan"
    },
    "recurringFrequency": {
      "type": "string",
      "enum": [
        "one-time",
        "monthly",
        "bi-monthly",
        "quarterly",
        "annually"
      ],
      "description": "Service frequency"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive",
        "deleted"
      ],
      "description": "Customer status"
    },
    "paymentStatus": {
      "type": "string",
      "enum": [
        "paid",
        "outstanding",
        "advance"
      ],
      "description": "Payment status"
    },
    "appointmentConfirmed": {
      "type": "boolean",
      "description": "Appointment confirmed"
    },
    "notes": {
      "type": "string",
      "description": "Customer notes"
    },
    "properties": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Linked property IDs"
    },
    "lifetimeValue": {
      "type": "number",
      "description": "Computed lifetime value from payments"
    },
    "riskScore": {
      "type": "number",
      "description": "Risk score based on pest history severity"
    },
    "contractType": {
      "type": "string",
      "description": "Contract type (monthly, annual, etc.)"
    },
    "contractStartDate": {
      "type": "string",
      "format": "date",
      "description": "Contract start date"
    },
    "contractEndDate": {
      "type": "string",
      "format": "date",
      "description": "Contract end date"
    },
    "preferredTechnician": {
      "type": "string",
      "description": "Preferred technician ID"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Created timestamp"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Updated timestamp"
    }
  },
  "required": [
    "id",
    "name"
  ]
}