{
  "openapi": "3.0.3",
  "info": {
    "title": "주문 API 실습용 명세",
    "version": "1.0.0",
    "description": "스펙브릿지 가져오기 실습을 위해 직접 만든 가상 명세입니다. 실제 고객 정보와 토큰은 포함하지 않습니다. example.invalid는 호출 가능한 API 서버가 아닙니다."
  },
  "servers": [{ "url": "https://example.invalid/api", "description": "호출하지 않는 문서용 주소" }],
  "tags": [{ "name": "주문 API", "description": "조회와 생성 실습" }],
  "security": [{ "bearerAuth": [] }],
  "paths": {
    "/orders/{orderId}": {
      "get": {
        "tags": ["주문 API"],
        "operationId": "getOrder",
        "summary": "주문 상세 조회",
        "description": "주문 번호로 가상 주문을 조회하는 명세 예제입니다.",
        "parameters": [
          { "name": "orderId", "in": "path", "required": true, "description": "주문 식별자", "schema": { "type": "string" }, "example": "ORDER-DEMO-001" }
        ],
        "responses": {
          "200": {
            "description": "조회 성공",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" }, "example": { "orderId": "ORDER-DEMO-001", "status": "CREATED", "customerId": "CUSTOMER-DEMO-001", "items": [{ "sku": "SKU-DEMO-001", "quantity": 2 }] } } }
          },
          "401": { "description": "인증 실패", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": { "code": "UNAUTHORIZED", "message": "인증이 필요합니다." } } } },
          "404": { "description": "주문 없음", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": { "code": "ORDER_NOT_FOUND", "message": "주문을 찾을 수 없습니다." } } } }
        }
      }
    },
    "/orders": {
      "post": {
        "tags": ["주문 API"],
        "operationId": "createOrder",
        "summary": "주문 생성",
        "description": "고객 식별자와 상품 목록으로 가상 주문을 생성하는 명세 예제입니다.",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateOrder" }, "example": { "customerId": "CUSTOMER-DEMO-001", "items": [{ "sku": "SKU-DEMO-001", "quantity": 2 }] } } }
        },
        "responses": {
          "201": {
            "description": "생성 성공",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" }, "example": { "orderId": "ORDER-DEMO-001", "status": "CREATED", "customerId": "CUSTOMER-DEMO-001", "items": [{ "sku": "SKU-DEMO-001", "quantity": 2 }] } } }
          },
          "400": { "description": "요청 검증 실패", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": { "code": "INVALID_REQUEST", "message": "고객 식별자와 상품 목록을 확인하세요." } } } },
          "401": { "description": "인증 실패", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": { "code": "UNAUTHORIZED", "message": "인증이 필요합니다." } } } }
        }
      }
    }
  },
  "components": {
    "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "description": "실제 인증 토큰은 샘플에 포함하지 않습니다." } },
    "schemas": {
      "OrderItem": {
        "type": "object",
        "required": ["sku", "quantity"],
        "properties": {
          "sku": { "type": "string", "description": "상품 식별자", "example": "SKU-DEMO-001" },
          "quantity": { "type": "integer", "minimum": 1, "description": "주문 수량", "example": 2 }
        }
      },
      "CreateOrder": {
        "type": "object",
        "required": ["customerId", "items"],
        "properties": {
          "customerId": { "type": "string", "description": "고객 식별자", "example": "CUSTOMER-DEMO-001" },
          "items": { "type": "array", "minItems": 1, "description": "주문 상품 목록", "items": { "$ref": "#/components/schemas/OrderItem" } }
        }
      },
      "Order": {
        "type": "object",
        "required": ["orderId", "status", "customerId", "items"],
        "properties": {
          "orderId": { "type": "string", "description": "주문 식별자", "example": "ORDER-DEMO-001" },
          "status": { "type": "string", "description": "주문 상태", "enum": ["CREATED", "SHIPPED", "CANCELLED"], "example": "CREATED" },
          "customerId": { "type": "string", "description": "고객 식별자", "example": "CUSTOMER-DEMO-001" },
          "items": { "type": "array", "description": "주문 상품 목록", "items": { "$ref": "#/components/schemas/OrderItem" } }
        }
      },
      "Error": {
        "type": "object",
        "required": ["code", "message"],
        "properties": {
          "code": { "type": "string", "description": "오류 코드", "example": "INVALID_REQUEST" },
          "message": { "type": "string", "description": "오류 설명", "example": "요청을 확인하세요." }
        }
      }
    }
  }
}
