{
    "openapi": "3.0.0",
    "info": {
        "title": "Est5",
        "description": "Est5 Mobile App API",
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "1.0.0"
    },
    "paths": {
        "/api/v1/records/future": {
            "get": {
                "tags": [
                    "Records"
                ],
                "description": "List of future records",
                "operationId": "e64e4a0d3b971d516977e47ef2204d6a",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "number of requested page",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "number records on page, if not presented default 10",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of future records retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/records/history": {
            "get": {
                "tags": [
                    "Records"
                ],
                "description": "List of history records",
                "operationId": "c58f2b0be9c2a85895b76cb12f1a4211",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "number of requested page",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "number records on page, if not presented default 10",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of history records retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/orders/{orderId}/calculate": {
            "post": {
                "tags": [
                    "Order Calculation"
                ],
                "description": "Рассчитать сумму к оплате с учётом бонусов и депозитов",
                "operationId": "2bcaa6182c18e686dba0e15ff1577690",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "cashback_percent": {
                                        "description": "0, 50 или 100",
                                        "type": "integer"
                                    },
                                    "deposit_upr_amount": {
                                        "description": "Сумма депозита (упр.) в копейках",
                                        "type": "integer"
                                    },
                                    "deposit_regl_amount": {
                                        "description": "Сумма депозита (регл.) в копейках",
                                        "type": "integer"
                                    },
                                    "marketing_selections": {
                                        "description": "Выбор маркетинговых бонусов: {typeid: amount_kopecks}",
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Результат расчёта"
                    }
                }
            }
        },
        "/api/v1/orders/{orderId}/bonuses": {
            "get": {
                "tags": [
                    "Order Calculation"
                ],
                "description": "Получить доступные бонусы и депозиты для заказа",
                "operationId": "4a932766d0703888d7b825080f25f03c",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Доступные бонусы и депозиты"
                    }
                }
            }
        },
        "/api/v1/orders": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "description": "List of orders",
                "operationId": "00d3856d2d3d93124e0cc021d0cb5b79",
                "responses": {
                    "200": {
                        "description": "List of orders retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Order"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/orders/new/count": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "description": "Count of new orders",
                "operationId": "9123704605f1f8779c2b863c123c6281",
                "responses": {
                    "200": {
                        "description": "Count of new orders successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "count": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/orders/{orderId}/payments": {
            "post": {
                "tags": [
                    "Orders"
                ],
                "description": "Create order payment",
                "operationId": "86cf172bf869519514414800afbcbd1a",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "description": "Order ID to create payment",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "payment_type": {
                                        "description": "payment type, availabme values are 'sberbank_qr' or 'sberbank_card'",
                                        "required": [
                                            "true"
                                        ],
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Order payment already created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "payment_url": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "Order payment created successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "payment_url": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CommonError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/price-list/categories": {
            "get": {
                "tags": [
                    "MobilePriceList"
                ],
                "description": "Price list categories",
                "operationId": "a5767cb6f3cb1f6c1efc31666b60352c",
                "responses": {
                    "200": {
                        "description": "Price list categories retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PriceListCategory"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/price-list/categories/{categoryId}/prices": {
            "get": {
                "tags": [
                    "MobilePriceList"
                ],
                "description": "Price list category prices",
                "operationId": "efda75be1bba9e222ea2d338c82da68e",
                "parameters": [
                    {
                        "name": "categoryId",
                        "in": "path",
                        "description": "ID of price list category",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Price list category prices retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PriceListItem"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/pushes": {
            "get": {
                "tags": [
                    "Pushes"
                ],
                "description": "List of unread pushes",
                "operationId": "bd0a558386f4eaa64a5dd0b59abc5ccc",
                "responses": {
                    "200": {
                        "description": "List of unread pushes retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Push"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/pushes/read": {
            "put": {
                "tags": [
                    "Pushes"
                ],
                "description": "Mark pushes as read",
                "operationId": "006fbcb1ef1becae8951b402524fcbbc",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "ids": {
                                        "description": "Array of notification IDs",
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Message successfully marked as read"
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/pushes/unread/count": {
            "get": {
                "tags": [
                    "Pushes"
                ],
                "description": "Count of unread pushes",
                "operationId": "eac24d45eb3cc801c5d78c4d2dd0c8a4",
                "responses": {
                    "200": {
                        "description": "Count of unread pushed retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "count": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/records/{id}": {
            "delete": {
                "tags": [
                    "Records"
                ],
                "description": "Cancel record",
                "operationId": "9e69da71781750fdda9350bdf04f4d9f",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Record ID to cancel",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Record canceled successfully",
                        "content": {
                            "application/json": {}
                        }
                    },
                    "400": {
                        "description": "Record cancel error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/records/reviews": {
            "post": {
                "tags": [
                    "Records"
                ],
                "description": "Create review for record",
                "operationId": "c7c537d3fbad9b149b49018f8fd34130",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "record_id": {
                                        "required": [
                                            "true"
                                        ],
                                        "type": "integer"
                                    },
                                    "rating": {
                                        "required": [
                                            "true"
                                        ],
                                        "type": "integer"
                                    },
                                    "text": {
                                        "required": [
                                            "true"
                                        ],
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Record review created successfully"
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CommonError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/records/{recordId}/confirm-visit": {
            "post": {
                "tags": [
                    "Records"
                ],
                "description": "Confirm coming",
                "operationId": "0d9be22ab5875304d9bc95c3e0011e23",
                "parameters": [
                    {
                        "name": "recordId",
                        "in": "path",
                        "description": "Record ID to confirm",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Record canceled successfully",
                        "content": {
                            "application/json": {}
                        }
                    },
                    "400": {
                        "description": "Record cancel error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/records/{recordId}/decline-visit": {
            "delete": {
                "tags": [
                    "Records"
                ],
                "description": "Cancel coming",
                "operationId": "294a5d4e0b46e832968a4c32002cca7e",
                "parameters": [
                    {
                        "name": "recordId",
                        "in": "path",
                        "description": "Record ID to cancel",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Record canceled successfully",
                        "content": {
                            "application/json": {}
                        }
                    },
                    "400": {
                        "description": "Record cancel error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        },
        "/api/v1/settings/record_disabled": {
            "get": {
                "tags": [
                    "Common"
                ],
                "description": "Check if record is disabled",
                "operationId": "cf4504c2698c1a0c30fddd1c6dba8eb8",
                "responses": {
                    "200": {
                        "description": "Record state retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "disabled": {
                                            "type": "boolean"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "token": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "OrderProduct": {
                "properties": {
                    "order_id": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "title": {
                        "type": "string"
                    },
                    "price": {
                        "type": "integer",
                        "format": "int32"
                    }
                },
                "type": "object"
            },
            "Order": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "order_id": {
                        "type": "string"
                    },
                    "status": {
                        "description": "Available statuses are: 'created', 'proceed', 'success', 'fail', 'unpaid",
                        "type": "string"
                    },
                    "status_text": {
                        "description": "Human readable text of status",
                        "type": "string"
                    },
                    "total_sum": {
                        "description": "Order sum to pay",
                        "type": "integer",
                        "format": "int32"
                    },
                    "payment_amount": {
                        "description": "Order sum without debited bonuses",
                        "type": "integer",
                        "format": "int32"
                    },
                    "bonus_amount": {
                        "description": "Bonuses debited",
                        "type": "integer",
                        "format": "int32"
                    },
                    "created_at": {
                        "description": "Date time in format Y-m-d H:i:s",
                        "type": "string"
                    },
                    "services": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/OrderProduct"
                        }
                    }
                },
                "type": "object"
            },
            "PriceListCategory": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "title": {
                        "type": "string"
                    },
                    "sub_title": {
                        "type": "string"
                    },
                    "image": {
                        "nullable": true,
                        "description": "Image absolute path",
                        "type": "string"
                    },
                    "parent_id": {
                        "nullable": true,
                        "type": "integer",
                        "format": "int32"
                    },
                    "children": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PriceListSubCategory"
                        }
                    }
                },
                "type": "object"
            },
            "PriceListSubCategory": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "title": {
                        "type": "string"
                    },
                    "image": {
                        "nullable": true,
                        "description": "Image absolute path",
                        "type": "string"
                    },
                    "parent_id": {
                        "nullable": true,
                        "type": "integer",
                        "format": "int32"
                    }
                },
                "type": "object"
            },
            "PriceListItem": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "Push": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "client_id": {
                        "type": "string"
                    },
                    "type": {
                        "description": "Available types are: 'reminder', 'birthday', 'subscription', 'debt', 'manual",
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "expire_at": {
                        "description": "Date time in format Y-m-d H:i:s",
                        "type": "string"
                    },
                    "unread": {
                        "type": "boolean"
                    },
                    "created_at": {
                        "description": "Date time in format Y-m-d H:i:s",
                        "type": "string"
                    },
                    "data": {
                        "description": "Extra data for push notification",
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "Token": {
                "properties": {
                    "token": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "Unauthorized": {
                "properties": {
                    "error": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "CommonError": {
                "properties": {
                    "error": {
                        "type": "string"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "JWT": {
                "type": "http",
                "description": "JWT token",
                "name": "JWT",
                "in": "header",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            },
            "token": {
                "type": "apiKey",
                "name": "client_id",
                "in": "query"
            }
        }
    },
    "tags": [
        {
            "name": "Order Calculation",
            "description": "API для расчёта суммы к оплате с учётом бонусов и депозитов"
        },
        {
            "name": "MobilePriceList",
            "description": "MobilePriceList API endpoints"
        },
        {
            "name": "Orders",
            "description": "Orders API endpoints"
        }
    ]
}