{
  "openapi": "3.1.0",
  "info": {
    "title": "The Caretakers Agent Inquiry API",
    "version": "1.0.0",
    "description": "Submit a project inquiry only with the user's explicit approval. Do not invent personal or project data; omit budget and timeline unless the user volunteered them."
  },
  "servers": [
    {
      "url": "https://api.caretakers.io"
    }
  ],
  "paths": {
    "/api/agent-inquiries": {
      "post": {
        "summary": "Submit an explicitly user-authorized project inquiry",
        "description": "Use only after the user explicitly approves this submission. Do not invent data. Omit budget and timeline unless the user volunteered them.",
        "operationId": "submitAgentInquiry",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "email",
                  "project_summary",
                  "user_authorized_submission"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "project_summary": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 5000
                  },
                  "user_authorized_submission": {
                    "type": "boolean",
                    "const": true,
                    "description": "Must be true only after the user explicitly authorizes this submission."
                  },
                  "organisation": {
                    "type": "string",
                    "maxLength": 160
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 50
                  },
                  "service_areas": {
                    "type": "array",
                    "maxItems": 8,
                    "items": {
                      "type": "string",
                      "maxLength": 100
                    }
                  },
                  "budget": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Omit unless the user volunteered this information."
                  },
                  "timeline": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Omit unless the user volunteered this information."
                  },
                  "source_agent": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "idempotency_key": {
                    "type": "string",
                    "maxLength": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Inquiry accepted; the duplicate flag indicates whether it was previously received.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data"],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "inquiry_id",
                        "status",
                        "duplicate",
                        "message",
                        "expected_response"
                      ],
                      "properties": {
                        "inquiry_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": ["accepted"]
                        },
                        "duplicate": {
                          "type": "boolean"
                        },
                        "message": {
                          "type": "string"
                        },
                        "expected_response": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The inquiry did not satisfy the request contract."
          },
          "429": {
            "description": "Too many inquiry requests; retry later."
          }
        }
      }
    }
  }
}
