{
  "openapi": "3.0.3",
  "info": {
    "title": "Checkout API",
    "version": "1.0.0"
  },
  "paths": {
    "/api/v1/orders/checkout": {
      "post": {
        "summary": "Создает заказ из содержимого корзины.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cartId": {
                    "type": "string",
                    "example": "cart-1001"
                  },
                  "customerId": {
                    "type": "string",
                    "example": "customer-1001"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Заказ создан",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string",
                      "example": "order-1001"
                    },
                    "status": {
                      "type": "string",
                      "example": "CREATED"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{orderId}": {
      "get": {
        "summary": "Возвращает текущее состояние заказа.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "description": "Идентификатор заказа",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Состояние заказа",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string",
                      "example": "order-1001"
                    },
                    "status": {
                      "type": "string",
                      "example": "PROCESSING"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{orderId}/cancel": {
      "post": {
        "summary": "Отменяет заказ до передачи в доставку.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "description": "Идентификатор заказа",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "example": "CUSTOMER_REQUEST"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Заказ отменен",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string",
                      "example": "order-1001"
                    },
                    "status": {
                      "type": "string",
                      "example": "CANCELLED"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
