{
  "openapi": "3.1.0",
  "info": {
    "title": "Lex Aquila Advocates enquiry API",
    "description": "Submit a legal enquiry to Lex Aquila Advocates, a chambers of barristers in Port-Louis, Mauritius. Submissions are delivered to chambers and answered personally.",
    "version": "1.0.0",
    "contact": {
      "name": "Lex Aquila Advocates",
      "url": "https://lexaquilaadvocates.com/contact"
    }
  },
  "servers": [{ "url": "https://lexaquilaadvocates.com" }],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "submitEnquiry",
        "summary": "Submit a legal enquiry",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Enquiry" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enquiry accepted and sent to chambers.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Result" }
              }
            }
          },
          "400": { "description": "Validation failed; response lists invalid fields." },
          "405": { "description": "Method not allowed. Only POST is accepted." },
          "413": { "description": "Request body exceeds 32 KB." },
          "415": { "description": "Content-Type must be application/json." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Enquiry": {
        "type": "object",
        "required": ["name", "email", "matterType", "message", "consent"],
        "properties": {
          "name": { "type": "string", "minLength": 2, "maxLength": 120 },
          "email": { "type": "string", "format": "email", "maxLength": 254 },
          "phone": { "type": "string", "maxLength": 50, "description": "Optional." },
          "matterType": {
            "type": "string",
            "enum": [
              "family-law-divorce",
              "property-estates-wills",
              "employment-workers-rights",
              "civil-commercial",
              "high-value-high-profile",
              "gender-advisory-international",
              "other"
            ]
          },
          "message": { "type": "string", "minLength": 20, "maxLength": 5000 },
          "consent": { "type": "boolean", "const": true, "description": "Must be true: consent to be contacted about the enquiry." }
        }
      },
      "Result": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "message": { "type": "string" }
        }
      }
    }
  }
}
