{
  "openapi": "3.1.0",
  "info": {
    "title": "VanWest Painting API",
    "version": "0.1.0",
    "description": "Ballpark estimates and quote requests for VanWest Painting, downtown Vancouver."
  },
  "servers": [
    {
      "url": "https://vanwestpainting.ca"
    }
  ],
  "paths": {
    "/api/info": {
      "get": {
        "summary": "Business info",
        "responses": {
          "200": {
            "description": "Services, area, contact."
          }
        }
      }
    },
    "/api/estimate": {
      "post": {
        "summary": "Ballpark price range (CAD, before GST). Not a quote.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "projectType"
                ],
                "properties": {
                  "projectType": {
                    "type": "string",
                    "enum": [
                      "interior",
                      "cabinets",
                      "drywall"
                    ]
                  },
                  "areaSqFt": {
                    "type": "number",
                    "minimum": 100,
                    "maximum": 20000,
                    "description": "Interior only (required): floor area of the space being painted, in square feet."
                  },
                  "includeCeilings": {
                    "type": "boolean",
                    "description": "Interior only. Default false."
                  },
                  "includeTrim": {
                    "type": "boolean",
                    "description": "Interior only: trim, doors and baseboards. Default false."
                  },
                  "highCeilings": {
                    "type": "boolean",
                    "description": "Interior only: ceilings over 9 ft. Default false."
                  },
                  "smallRepairs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 40,
                    "description": "Drywall only: nail or screw holes, dents and hairline cracks under 4 in. Default 0."
                  },
                  "largeRepairs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 40,
                    "description": "Drywall only: holes 4 to 12 in, e.g. doorknob holes. Default 0. Anything bigger needs a site visit."
                  },
                  "includePaint": {
                    "type": "boolean",
                    "description": "Drywall only: prime and paint the repaired areas. Default true."
                  },
                  "textureMatch": {
                    "type": "boolean",
                    "description": "Drywall only: the wall or ceiling is textured and the patch must match. Default false."
                  },
                  "fronts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Cabinets only: number of doors plus drawer fronts."
                  },
                  "condition": {
                    "type": "string",
                    "enum": [
                      "good",
                      "fair",
                      "poor"
                    ],
                    "description": "Interior and cabinets only. good = clean, sound surfaces; fair = some patching; poor = heavy repair or peeling. Default good."
                  },
                  "paintTier": {
                    "type": "string",
                    "enum": [
                      "standard",
                      "premium"
                    ],
                    "description": "Interior and cabinets only. Default standard."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Estimate range with line items."
          },
          "400": {
            "description": "Validation errors, listed in `errors`."
          }
        }
      }
    },
    "/api/intake": {
      "post": {
        "summary": "Submit a quote request for a customer who has agreed to be contacted.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "propertyType",
                  "services",
                  "consent"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "propertyType": {
                    "type": "string",
                    "enum": [
                      "condo",
                      "townhouse",
                      "house",
                      "commercial",
                      "strata_common_area",
                      "other"
                    ]
                  },
                  "services": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "enum": [
                        "interior",
                        "drywall",
                        "cabinets",
                        "commercial",
                        "other"
                      ]
                    }
                  },
                  "location": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Neighbourhood or street address of the job."
                  },
                  "timeline": {
                    "type": "string",
                    "enum": [
                      "asap",
                      "1_3_months",
                      "3_plus_months",
                      "flexible"
                    ],
                    "description": "Default flexible."
                  },
                  "details": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Anything useful: rooms, colours, access, strata rules."
                  },
                  "estimateInput": {
                    "type": "object",
                    "required": [
                      "projectType"
                    ],
                    "properties": {
                      "projectType": {
                        "type": "string",
                        "enum": [
                          "interior",
                          "cabinets",
                          "drywall"
                        ]
                      },
                      "areaSqFt": {
                        "type": "number",
                        "minimum": 100,
                        "maximum": 20000,
                        "description": "Interior only (required): floor area of the space being painted, in square feet."
                      },
                      "includeCeilings": {
                        "type": "boolean",
                        "description": "Interior only. Default false."
                      },
                      "includeTrim": {
                        "type": "boolean",
                        "description": "Interior only: trim, doors and baseboards. Default false."
                      },
                      "highCeilings": {
                        "type": "boolean",
                        "description": "Interior only: ceilings over 9 ft. Default false."
                      },
                      "smallRepairs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 40,
                        "description": "Drywall only: nail or screw holes, dents and hairline cracks under 4 in. Default 0."
                      },
                      "largeRepairs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 40,
                        "description": "Drywall only: holes 4 to 12 in, e.g. doorknob holes. Default 0. Anything bigger needs a site visit."
                      },
                      "includePaint": {
                        "type": "boolean",
                        "description": "Drywall only: prime and paint the repaired areas. Default true."
                      },
                      "textureMatch": {
                        "type": "boolean",
                        "description": "Drywall only: the wall or ceiling is textured and the patch must match. Default false."
                      },
                      "fronts": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 200,
                        "description": "Cabinets only: number of doors plus drawer fronts."
                      },
                      "condition": {
                        "type": "string",
                        "enum": [
                          "good",
                          "fair",
                          "poor"
                        ],
                        "description": "Interior and cabinets only. good = clean, sound surfaces; fair = some patching; poor = heavy repair or peeling. Default good."
                      },
                      "paintTier": {
                        "type": "string",
                        "enum": [
                          "standard",
                          "premium"
                        ],
                        "description": "Interior and cabinets only. Default standard."
                      }
                    },
                    "description": "Optional. Same shape as the estimate request; the range is recomputed and attached."
                  },
                  "consent": {
                    "type": "boolean",
                    "const": true,
                    "description": "Must be true. The customer agrees to be contacted by VanWest Painting about this request."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Accepted, with a reference code."
          },
          "400": {
            "description": "Validation errors, listed in `errors`."
          },
          "429": {
            "description": "Rate limited."
          }
        }
      }
    }
  }
}