{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentCover hypothetical estimate API",
    "version": "1.0.0",
    "description": "Hypothetical arithmetic only; no risk prediction or insurance issued."
  },
  "servers": [
    {
      "url": "https://agentcover-risk.pages.dev"
    }
  ],
  "paths": {
    "/api/insurance/estimate": {
      "post": {
        "operationId": "estimateRisk",
        "summary": "Compute a hypothetical risk scenario; no policy or coverage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RiskAssumptions"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Assumptions, numeric result, status HYPOTHETICAL_ONLY_NOT_A_QUOTE, currency CAD and limitations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "result"
                  ],
                  "properties": {
                    "status": {
                      "const": "HYPOTHETICAL_ONLY_NOT_A_QUOTE"
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "payout": {
                          "type": "number"
                        },
                        "expected": {
                          "type": "number"
                        },
                        "annual": {
                          "type": "number"
                        },
                        "monthly": {
                          "type": "number"
                        },
                        "retained": {
                          "type": "number"
                        },
                        "expenseCost": {
                          "type": "number"
                        },
                        "profit": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid fields"
          },
          "413": {
            "description": "Payload over 8192 bytes"
          },
          "415": {
            "description": "application/json required"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RiskAssumptions": {
        "type": "object",
        "required": [
          "loss",
          "deductible",
          "limit",
          "capital",
          "fixed",
          "probability",
          "expenses",
          "margin"
        ],
        "properties": {
          "loss": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "deductible": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "limit": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "capital": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "fixed": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "probability": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "expenses": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "margin": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "description": "Ratios are decimals. expenses + margin < 1. Annual result <= 1e12. CAD; hypothetical only."
      }
    }
  }
}