{
  "openapi": "3.1.0",
  "info": {
    "title": "Tankyu Distillery Forms API",
    "version": "1.0.0",
    "description": "Form submission endpoints for contact, tour booking, cask inquiry, newsletter, and product notifications. All endpoints accept JSON and return JSON. Rate-limited per IP."
  },
  "servers": [
    { "url": "https://tankyudistillery.jp" }
  ],
  "paths": {
    "/api/forms/contact": {
      "post": {
        "operationId": "submitContactForm",
        "summary": "Submit a general contact inquiry",
        "description": "Rate limit: 5 requests per 60 seconds per IP",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "email", "subject", "message"],
                "properties": {
                  "name": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "phone": { "type": "string" },
                  "subject": { "type": "string" },
                  "message": { "type": "string" },
                  "locale": { "type": "string", "enum": ["ja", "en", "zh-Hant"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Submission accepted", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "submissionId": { "type": "string" } } } } } },
          "400": { "description": "Validation failed" },
          "429": { "description": "Rate limited" },
          "500": { "description": "Internal server error" }
        }
      }
    },
    "/api/forms/tour-booking": {
      "post": {
        "operationId": "submitTourBooking",
        "summary": "Submit a distillery tour booking request",
        "description": "Rate limit: 5 requests per 60 seconds per IP",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "email", "preferredDate", "numberOfGuests"],
                "properties": {
                  "name": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "phone": { "type": "string" },
                  "message": { "type": "string" },
                  "locale": { "type": "string", "enum": ["ja", "en", "zh-Hant"] },
                  "preferredDate": { "type": "string", "format": "date" },
                  "numberOfGuests": { "type": "integer", "minimum": 1 },
                  "languagePreference": { "type": "string", "enum": ["ja", "en"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Booking request accepted", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "submissionId": { "type": "string" } } } } } },
          "400": { "description": "Validation failed" },
          "429": { "description": "Rate limited" },
          "500": { "description": "Internal server error" }
        }
      }
    },
    "/api/forms/cask-inquiry": {
      "post": {
        "operationId": "submitCaskInquiry",
        "summary": "Submit a private cask consultation inquiry",
        "description": "Rate limit: 5 requests per 60 seconds per IP",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "email", "customerType", "consultationLanguage", "preferredSlot1", "preferredSlot2", "preferredSlot3"],
                "properties": {
                  "name": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "phone": { "type": "string" },
                  "message": { "type": "string" },
                  "locale": { "type": "string", "enum": ["ja", "en", "zh-Hant"] },
                  "customerType": { "type": "string", "enum": ["individual", "business"] },
                  "businessName": { "type": "string" },
                  "consultationLanguage": { "type": "string", "enum": ["en", "ja", "zh-Hant"] },
                  "preferredSlot1": { "type": "string" },
                  "preferredSlot2": { "type": "string" },
                  "preferredSlot3": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Inquiry accepted", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "submissionId": { "type": "string" } } } } } },
          "400": { "description": "Validation failed" },
          "429": { "description": "Rate limited" },
          "500": { "description": "Internal server error" }
        }
      }
    },
    "/api/forms/newsletter": {
      "post": {
        "operationId": "subscribeNewsletter",
        "summary": "Subscribe to the distillery newsletter",
        "description": "Rate limit: 5 requests per 60 seconds per IP. Duplicate emails return success silently.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "locale": { "type": "string", "enum": ["ja", "en", "zh-Hant"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Subscribed", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "submissionId": { "type": "string" }, "duplicate": { "type": "boolean" } } } } } },
          "400": { "description": "Validation failed" },
          "429": { "description": "Rate limited" },
          "500": { "description": "Internal server error" }
        }
      }
    },
    "/api/forms/product-notify": {
      "post": {
        "operationId": "subscribeProductNotify",
        "summary": "Subscribe to product availability notifications",
        "description": "Rate limit: 10 requests per 60 seconds per IP",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "productSlug"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "locale": { "type": "string", "enum": ["ja", "en", "zh-Hant"] },
                  "productSlug": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Notification subscription created", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "submissionId": { "type": "string" } } } } } },
          "400": { "description": "Validation failed" },
          "429": { "description": "Rate limited" },
          "500": { "description": "Internal server error" }
        }
      }
    }
  }
}
