{
  "openapi": "3.1.0",
  "info": {
    "title": "Codexpert quote API",
    "version": "1.0.0",
    "description": "Request a quote for a Codexpert WordPress service. The request becomes a project in the Codexpert portal.",
    "contact": {
      "name": "Codexpert",
      "url": "https://codexpert.io/contact/",
      "email": "hello@codexpert.io"
    }
  },
  "servers": [
    {
      "url": "https://codexpert.io"
    }
  ],
  "paths": {
    "/api/quote/": {
      "post": {
        "operationId": "requestQuote",
        "summary": "Request a quote",
        "description": "Validates the request and recomputes the budget server-side; any price sent by the client is ignored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request received.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed; use POST.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The email already has a portal account; the client must log in to create a project.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The request could not be delivered to the portal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "QuoteRequest": {
        "type": "object",
        "required": [
          "service",
          "name",
          "email",
          "description",
          "terms_accepted"
        ],
        "properties": {
          "service": {
            "type": "string",
            "enum": [
              "site-audit",
              "custom-development",
              "ecommerce-development",
              "website-development",
              "website-maintenance",
              "bug-fixes",
              "speed-optimization",
              "white-label-development"
            ],
            "description": "Service slug."
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 200
          },
          "url": {
            "type": "string",
            "maxLength": 300,
            "description": "Site the work is for."
          },
          "description": {
            "type": "string",
            "maxLength": 5000,
            "description": "What the project needs."
          },
          "type": {
            "type": "string",
            "enum": [
              "basic",
              "intermediate",
              "advanced"
            ],
            "description": "Build services only."
          },
          "complexity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "description": "Build services only."
          },
          "deadline": {
            "type": "string",
            "enum": [
              "flexible",
              "this-month",
              "2-3-weeks",
              "urgent"
            ],
            "description": "Build services only."
          },
          "terms_accepted": {
            "const": true,
            "description": "Must be true: acceptance of https://codexpert.io/terms-of-service/."
          }
        }
      },
      "Ok": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}