{
  "openapi": "3.0.3",
  "info": {
    "title": "Auth API",
    "version": "1.0.0",
    "description": "Shared authentication service for Puglieseweb products. Owns the pre-sign-up email verification flow used across Noteble, FaceGov, and the puglieseweb.com portal. Cognito sign-in itself is handled directly (via Amplify/hosted UI)."
  },
  "servers": [
    {
      "url": "https://api.puglieseweb.com/auth/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/verification/send": {
      "post": {
        "tags": [
          "Verification"
        ],
        "summary": "Send a verification code",
        "description": "Generates a one-time 6-digit code, stores it with a 10-minute TTL, and emails it using the product-branded template.",
        "operationId": "send_code_verification_send_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCodeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/verification/verify": {
      "post": {
        "tags": [
          "Verification"
        ],
        "summary": "Verify an emailed code",
        "description": "Validates the one-time code emailed by `/verification/send`. On success, extends the record TTL to give the caller time to complete sign-up.",
        "operationId": "verify_code_verification_verify_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyCodeResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "SendCodeRequest": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "pattern": "^[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}$",
            "title": "Email",
            "examples": [
              "user@example.com"
            ]
          },
          "product": {
            "type": "string",
            "maxLength": 30,
            "title": "Product",
            "description": "Product slug for branded email templates (e.g. `noteble`, `facegov`)",
            "default": ""
          },
          "locale": {
            "type": "string",
            "maxLength": 10,
            "title": "Locale",
            "default": "en-GB",
            "examples": [
              "en-GB"
            ]
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "SendCodeRequest"
      },
      "SendCodeResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "default": true
          }
        },
        "type": "object",
        "title": "SendCodeResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "ResponseValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "ResponseValidationError"
      },
      "VerifyCodeRequest": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "pattern": "^[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}$",
            "title": "Email",
            "examples": [
              "user@example.com"
            ]
          },
          "code": {
            "type": "string",
            "pattern": "^\\d{6}$",
            "title": "Code",
            "examples": [
              "123456"
            ]
          }
        },
        "type": "object",
        "required": [
          "email",
          "code"
        ],
        "title": "VerifyCodeRequest"
      },
      "VerifyCodeResponse": {
        "properties": {
          "verified": {
            "type": "boolean",
            "title": "Verified",
            "default": true
          }
        },
        "type": "object",
        "title": "VerifyCodeResponse"
      }
    }
  }
}