{
  "openapi": "3.0.0",
  "info": {
    "title": "DwellMint Studio Public API",
    "description": "Public endpoints for accessing project metadata and business details at DwellMint Studio. All endpoints return rate limit information in headers.",
    "version": "1.3.0"
  },
  "servers": [
    {
      "url": "https://dwellmint.studio"
    }
  ],
  "components": {
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://dwellmint.studio/api/token",
            "scopes": {
              "read:projects": "Access to project metadata and styles.",
              "read:leads": "Access to business lead logs.",
              "write:leads": "Submit new leads programmatically."
            }
          }
        }
      },
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Lead": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "description": "Full name of the prospect." },
          "email": { "type": "string", "format": "email", "description": "Contact email address." },
          "phone": { "type": "string", "description": "Contact phone number." }
        },
        "required": ["name", "email", "phone"]
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": { "type": "string" },
          "message": { "type": "string" },
          "hint": { "type": "string" }
        },
        "required": ["code", "message"]
      }
    },
    "headers": {
      "X-RateLimit-Limit": { "schema": { "type": "integer" }, "description": "Maximum requests per window." },
      "X-RateLimit-Remaining": { "schema": { "type": "integer" }, "description": "Requests left in current window." },
      "Retry-After": { "schema": { "type": "integer" }, "description": "Seconds until window resets." }
    }
  },
  "paths": {
    "/project_metadata.json": {
      "get": {
        "operationId": "getProjects",
        "summary": "Retrieve all project metadata",
        "description": "Returns a comprehensive list of luxury interior projects including designer styles and locations.",
        "security": [{ "OAuth2": ["read:projects"] }],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" }
            },
            "content": { "application/json": {} }
          },
          "404": {
            "description": "Not Found",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          }
        }
      }
    },
    "/scripts/enquiry_backend.php": {
      "post": {
        "operationId": "submitLead",
        "summary": "Submit a new lead",
        "description": "Programmatically submit prospect contact information for architectural consultation.",
        "security": [{ "OAuth2": ["write:leads"] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Lead" }
            }
          }
        },
        "responses": {
          "200": { "description": "Lead submitted successfully." },
          "400": { "description": "Invalid input.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/leads.json": {
      "get": {
        "operationId": "getLeads",
        "summary": "Retrieve public leads log",
        "security": [{ "OAuth2": ["read:leads"] }],
        "responses": {
          "200": { "description": "Success", "content": { "application/json": {} } },
          "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    }
  }
}
