{
  "openapi": "3.1.0",
  "info": {
    "title": "튼튼우리한의원 API",
    "version": "1.0.0",
    "description": "서울 강서구 튼튼우리한의원의 진료 정보 및 온라인 문의 API",
    "contact": {
      "name": "튼튼우리한의원",
      "url": "https://tntnwoori.com",
      "email": "contact@tntnwoori.com"
    }
  },
  "servers": [
    {
      "url": "https://tntnwoori.com",
      "description": "운영 서버"
    }
  ],
  "paths": {
    "/api/clinic-info": {
      "get": {
        "operationId": "getClinicInfo",
        "summary": "한의원 기본 정보 조회",
        "description": "진료 시간, 위치, 연락처, 취급 진료 분야 등 한의원 기본 정보를 반환합니다.",
        "responses": {
          "200": {
            "description": "한의원 정보",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicInfo"
                }
              }
            }
          }
        }
      }
    },
    "/api/treatments": {
      "get": {
        "operationId": "getTreatments",
        "summary": "진료 분야 목록 또는 단일 진료 분야 조회",
        "description": "category 파라미터 없이 호출하면 전체 목록을, 파라미터와 함께 호출하면 해당 분야 정보를 반환합니다.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "조회할 진료 분야 ID",
            "schema": {
              "type": "string",
              "enum": ["pain", "digestive", "autonomic", "growth"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "진료 분야 정보",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Treatment" }
                    },
                    { "$ref": "#/components/schemas/Treatment" }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "잘못된 category 값",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "operationId": "submitContact",
        "summary": "온라인 문의 접수",
        "description": "환자의 이름, 연락처, 진료 분야, 문의 내용을 접수합니다.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "문의 접수 완료",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ContactResponse" }
              }
            }
          },
          "400": {
            "description": "잘못된 요청 형식",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "422": {
            "description": "필수 항목 누락",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ClinicInfo": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "example": "튼튼우리한의원" },
          "url": { "type": "string", "example": "https://tntnwoori.com" },
          "telephone": { "type": "string", "example": "02-362-3618" },
          "address": {
            "type": "object",
            "properties": {
              "streetAddress": { "type": "string" },
              "addressLocality": { "type": "string" },
              "addressRegion": { "type": "string" },
              "postalCode": { "type": "string" },
              "addressCountry": { "type": "string" }
            }
          },
          "geo": {
            "type": "object",
            "properties": {
              "latitude": { "type": "number" },
              "longitude": { "type": "number" }
            }
          },
          "openingHours": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "days": { "type": "array", "items": { "type": "string" } },
                "opens": { "type": "string" },
                "closes": { "type": "string" },
                "note": { "type": "string" }
              }
            }
          },
          "treatments": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "Treatment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": ["pain", "digestive", "autonomic", "growth"]
          },
          "name": { "type": "string", "example": "만성통증" },
          "description": { "type": "string" },
          "url": { "type": "string" },
          "symptoms": {
            "type": "array",
            "items": { "type": "string" }
          },
          "therapies": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "ContactRequest": {
        "type": "object",
        "required": ["name", "phone"],
        "properties": {
          "name": { "type": "string", "description": "환자 이름", "example": "홍길동" },
          "phone": { "type": "string", "description": "연락처", "example": "010-1234-5678" },
          "treatment": {
            "type": "string",
            "description": "진료 분야",
            "enum": ["pain", "digestive", "autonomic", "growth"],
            "nullable": true
          },
          "message": { "type": "string", "description": "문의 내용", "nullable": true }
        }
      },
      "ContactResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean", "example": true },
          "message": { "type": "string", "example": "문의가 접수되었습니다." }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": { "type": "string" }
        }
      }
    }
  }
}
