{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Home Services",
    "version": "0.8.0",
    "description": "Request quotes from independent home-service providers in Canada and the United States. GTA trade pages are https://gethomeservice.now/gta/<trade>. A received request is not a confirmed appointment. The customer chooses and pays the provider directly."
  },
  "servers": [
    {
      "url": "https://gethomeservice.now"
    }
  ],
  "paths": {
    "/api/quotes": {
      "post": {
        "operationId": "requestQuotes",
        "summary": "Request quotes from independent home-service providers",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "trade": {
                    "type": "string",
                    "enum": [
                      "plumber",
                      "hvac",
                      "electrician",
                      "roofer",
                      "appliance-repair",
                      "locksmith",
                      "garage-door",
                      "pest-control",
                      "handyman",
                      "house-cleaning",
                      "other"
                    ],
                    "description": "Home-service trade. Use 'other' with trade_detail for anything not listed."
                  },
                  "trade_detail": {
                    "type": "string",
                    "description": "Required when trade is 'other': the kind of contractor needed."
                  },
                  "country": {
                    "type": "string",
                    "enum": [
                      "CA",
                      "US"
                    ]
                  },
                  "region": {
                    "type": "string",
                    "description": "Province or state code or name, for example 'ON' or 'Texas'."
                  },
                  "city": {
                    "type": "string",
                    "description": "City or municipality where service is needed."
                  },
                  "district": {
                    "type": "string",
                    "enum": [
                      "Old Toronto",
                      "North York",
                      "Scarborough",
                      "Etobicoke",
                      "East York",
                      "York"
                    ],
                    "description": "Optional Toronto district. Use only when city is Toronto."
                  },
                  "service_address": {
                    "type": "string",
                    "description": "Full street address where service is needed."
                  },
                  "postal_code": {
                    "type": "string",
                    "description": "Postal or ZIP code."
                  },
                  "problem": {
                    "type": "string",
                    "description": "What is needed or wrong, with relevant details."
                  },
                  "urgency": {
                    "type": "string",
                    "enum": [
                      "emergency",
                      "today",
                      "next_day",
                      "flexible"
                    ]
                  },
                  "preferred_time": {
                    "type": "string",
                    "description": "Preferred appointment window in local time."
                  },
                  "contact_name": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "preferred_channel": {
                    "type": "string",
                    "enum": [
                      "sms",
                      "email",
                      "phone"
                    ],
                    "description": "How the customer prefers to hear from us. Defaults from the contact details."
                  },
                  "callback_requested": {
                    "type": "boolean",
                    "description": "True when the customer asked for a callback."
                  },
                  "consent_to_contact": {
                    "type": "boolean",
                    "description": "Must be true. Allows us and prospective providers to contact the customer about this request."
                  },
                  "source_platform": {
                    "type": "string",
                    "description": "Calling agent or platform, if known."
                  }
                },
                "required": [
                  "trade",
                  "country",
                  "region",
                  "city",
                  "service_address",
                  "problem",
                  "urgency",
                  "contact_name",
                  "consent_to_contact"
                ],
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "phone"
                    ]
                  },
                  {
                    "required": [
                      "email"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Request received. No appointment is confirmed."
          },
          "400": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "healthCheck",
        "responses": {
          "200": {
            "description": "Service is available"
          }
        }
      }
    }
  }
}