{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zaptu-ai/json-schema/zaptu-ai-service-request-schema.json",
  "title": "ServiceRequest",
  "description": "A structured home-service request from an AI agent or the website form.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zaptu-ai-openapi.json#/components/schemas/ServiceRequest",
  "properties": {
    "service_type": {
      "description": "Kind of service the customer needs.",
      "enum": [
        "house_cleaning",
        "deep_cleaning",
        "move_in_out_cleaning",
        "recurring_cleaning",
        "pest_control",
        "garage_door",
        "plumbing",
        "hvac",
        "handyman",
        "other"
      ],
      "title": "Service Type",
      "type": "string"
    },
    "zip_code": {
      "description": "US 5-digit ZIP code where the work will happen.",
      "title": "Zip Code",
      "type": "string"
    },
    "city": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "City name, if known.",
      "title": "City"
    },
    "state": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Two-letter US state code, if known.",
      "title": "State"
    },
    "address_line": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Street address. Optional at intake; required by some buyers later.",
      "title": "Address Line"
    },
    "bedrooms": {
      "anyOf": [
        {
          "maximum": 20,
          "minimum": 0,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Bedrooms"
    },
    "bathrooms": {
      "anyOf": [
        {
          "maximum": 20,
          "minimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Bathrooms"
    },
    "square_feet": {
      "anyOf": [
        {
          "maximum": 50000,
          "minimum": 100,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Square Feet"
    },
    "home_type": {
      "anyOf": [
        {
          "enum": [
            "apartment",
            "condo",
            "townhouse",
            "single_family",
            "other"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Home Type"
    },
    "frequency": {
      "default": "one_time",
      "enum": [
        "one_time",
        "weekly",
        "biweekly",
        "monthly"
      ],
      "title": "Frequency",
      "type": "string"
    },
    "preferred_date": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Preferred service date (YYYY-MM-DD).",
      "title": "Preferred Date"
    },
    "flexible_dates": {
      "default": true,
      "title": "Flexible Dates",
      "type": "boolean"
    },
    "notes": {
      "anyOf": [
        {
          "maxLength": 2000,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Notes"
    },
    "customer_name": {
      "maxLength": 120,
      "minLength": 2,
      "title": "Customer Name",
      "type": "string"
    },
    "customer_phone": {
      "description": "US phone number. Digits, dashes, or +1 are accepted.",
      "title": "Customer Phone",
      "type": "string"
    },
    "customer_email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Customer Email"
    },
    "consent_to_contact": {
      "description": "True if the customer consented to be called or texted about this request (TCPA). This includes sharing details with Polyares and its service-provider partners.",
      "title": "Consent To Contact",
      "type": "boolean"
    },
    "source_agent": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Agent or product that originated the request, e.g. muse.",
      "title": "Source Agent"
    },
    "consent_source_page": {
      "anyOf": [
        {
          "maxLength": 500,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional page/path where consent was collected, e.g. /pest-control/phoenix-az/. Server falls back to source_agent.",
      "title": "Consent Source Page"
    }
  },
  "required": [
    "service_type",
    "zip_code",
    "customer_name",
    "customer_phone",
    "consent_to_contact"
  ],
  "type": "object"
}