{
  "openapi": "3.0.3",
  "info": {
    "title": "ESE Store API",
    "version": "2.0",
    "description": "\nStars, Premium, Gift, Game Zone va NFT ijara (**Rent**) sotish uchun REST API. Buyurtmalar bot balansingizdan yechiladi.\n\n**Kalit olish:** `@EseStoreBot` → *🔑 API bo'limi* → *Kalit olish*. Kalitni **Authorize** tugmasi orqali kiriting, keyin har bir endpointni *Try it out* bilan sinab ko'rishingiz mumkin.\n"
  },
  "servers": [
    {
      "url": "https://ese.roxiy.uz/api",
      "description": "Asosiy"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Ma'lumot",
      "description": "Narx, balans, foydalanuvchini tekshirish, buyurtma holati"
    },
    {
      "name": "Stars",
      "description": "Telegram Stars (50 – 1 000 000)"
    },
    {
      "name": "Premium",
      "description": "Telegram Premium (3, 6, 12 oy)"
    },
    {
      "name": "Gift",
      "description": "Katalogdagi giftlarni yuborish"
    },
    {
      "name": "Rent",
      "description": "NFT ijara (asinxron: to'lov avtomatik yuboriladi, odatda 10–30 soniyada `active` bo'ladi)"
    },
    {
      "name": "SMM",
      "description": "Telegram, Instagram, TikTok va YouTube SMM xizmatlari (obunachi, layk, ko'rish); xizmatdagi `platform`: telegram | instagram | tiktok | youtube"
    }
  ],
  "paths": {
    "/pricing": {
      "get": {
        "tags": [
          "Ma'lumot"
        ],
        "summary": "Narxlar",
        "description": "Ochiq endpoint (kalit shart emas). Stars narxi, Premium narxlari, Gift/Rent ustamalari.",
        "responses": {
          "200": {
            "description": "Narxlar, **so'mda (UZS)**: `stars.price_per_star`, `premium` (oy → narx), Gift/Rent ustamalari (%).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "currency": "UZS",
                    "stars": {
                      "price_per_star": 200,
                      "min": 50,
                      "max": 1000000
                    },
                    "premium": {
                      "3": 155000,
                      "6": 208000,
                      "12": 380000
                    }
                  }
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/balance": {
      "get": {
        "tags": [
          "Ma'lumot"
        ],
        "summary": "Balans",
        "description": "Joriy balans.",
        "responses": {
          "200": {
            "description": "Joriy balans, **so'mda (UZS)**.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "balance": 5273,
                    "currency": "UZS"
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/stars/value": {
      "get": {
        "tags": [
          "Ma'lumot"
        ],
        "summary": "1 star narxi",
        "description": "`amount` berilsa, umumiy narx ham qaytadi.",
        "responses": {
          "200": {
            "description": "1 star narxi, **so'mda**. `amount` berilgan bo'lsa, umumiy narx `price_som` ham qaytadi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "price_per_star": 200,
                    "min": 50,
                    "max": 1000000,
                    "currency": "UZS",
                    "amount": 100,
                    "price_som": 20000
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "- `VALIDATION_ERROR` — amount 50–1000000 orasida bo'lishi kerak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "amount 50–1000000 orasida bo'lishi kerak"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 50,
              "maximum": 1000000
            },
            "example": 100
          }
        ]
      }
    },
    "/searchUser": {
      "get": {
        "tags": [
          "Ma'lumot"
        ],
        "summary": "Foydalanuvchini tekshirish",
        "description": "Telegram foydalanuvchisi mavjudligini tekshiradi. Kanal va bot username'lari topilmaydi (`USER_NOT_FOUND`).",
        "responses": {
          "200": {
            "description": "Foydalanuvchi topildi: `username`, `name` (anonim foydalanuvchida `null`), `is_premium`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "username": "samarcoder",
                    "name": "Samariddin",
                    "is_premium": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "- `MISSING_USERNAME` — username bo'sh\n- `INVALID_USERNAME` — Format xato — 4-32 harf/raqam/_\n- `USER_NOT_FOUND` — Username topilmadi (kanal/bot username yoki mavjud emas)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_USERNAME": {
                    "summary": "MISSING_USERNAME",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_USERNAME",
                      "message": "username bo'sh"
                    }
                  },
                  "INVALID_USERNAME": {
                    "summary": "INVALID_USERNAME",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_USERNAME",
                      "message": "Format xato — 4-32 harf/raqam/_"
                    }
                  },
                  "USER_NOT_FOUND": {
                    "summary": "USER_NOT_FOUND",
                    "value": {
                      "ok": false,
                      "error_code": "USER_NOT_FOUND",
                      "message": "Username topilmadi (kanal/bot username yoki mavjud emas)"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "- `FRAGMENT_TIMEOUT` — Fragment/TON tarmog'i javob bermadi — qayta urining (pul qaytariladi)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "FRAGMENT_TIMEOUT": {
                    "summary": "FRAGMENT_TIMEOUT",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_TIMEOUT",
                      "message": "Fragment/TON tarmog'i javob bermadi — qayta urining (pul qaytariladi)"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "username",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_]{4,32}$",
              "example": "samarcoder",
              "description": "Telegram username (4–32 belgi). `@` bo'lsa ham bo'ladi."
            }
          }
        ]
      }
    },
    "/orders/{id}": {
      "get": {
        "tags": [
          "Ma'lumot"
        ],
        "summary": "Buyurtma holati",
        "description": "`id` sifatida javobdagi `result.id` yoki o'zingizning `order_id`ingizni bering (Stars, Premium, Gift).",
        "responses": {
          "200": {
            "description": "Buyurtma. `status`: `processing` (bajarilmoqda) | `completed` (yakunlandi) | `failed` (xato). Muvaffaqiyatsiz bo'lsa, mablag' balansga avtomatik qaytariladi. `transaction_id` faqat yakunlanganda, `error_message` faqat xatoda to'ladi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": "abcdwxyz",
                    "order_id": "my-123",
                    "type": "stars",
                    "target_username": "samarcoder",
                    "gift_id": null,
                    "amount": 50,
                    "months": null,
                    "price_som": 10000,
                    "status": "completed",
                    "transaction_id": "...",
                    "error_message": null,
                    "created_at": "2026-10-01 12:00:00"
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "- `ORDER_NOT_FOUND` — Bunday buyurtma topilmadi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ORDER_NOT_FOUND": {
                    "summary": "ORDER_NOT_FOUND",
                    "value": {
                      "ok": false,
                      "error_code": "ORDER_NOT_FOUND",
                      "message": "Bunday buyurtma topilmadi"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "abcdwxyz"
          }
        ]
      }
    },
    "/stars/buy": {
      "post": {
        "tags": [
          "Stars"
        ],
        "summary": "Stars sotib olish",
        "description": "⚠️ **Try it out haqiqiy so'rov yuboradi:** balansdan pul yechiladi va haqiqiy mahsulot yuboriladi.\n\nStars yuboradi. So'rov yetkazilguncha ochiq turadi (odatda bir necha soniya), **vaqt chegarasini 120 soniya** qo'ying.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "username",
                  "amount"
                ],
                "properties": {
                  "username": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_]{4,32}$",
                    "example": "samarcoder",
                    "description": "Telegram username (4–32 belgi). `@` bo'lsa ham bo'ladi."
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 50,
                    "maximum": 1000000,
                    "example": 50
                  },
                  "order_id": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "O'zingizning noyob buyurtma ID'ingiz (1–64 belgi: harf, raqam, `. _ : -`). Takroriy yuborishdan himoya qiladi. **Tavsiya etiladi.**",
                    "example": "my-123"
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Ixtiyoriy: shu buyurtma natijasi uchun webhook manzili (https)"
                  }
                }
              },
              "example": {
                "username": "samarcoder",
                "amount": 50,
                "order_id": "my-123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Buyurtma (`type: stars`). `amount` — yuborilgan Stars soni, `price_som` — yechilgan summa (so'mda). `status`: `processing` (bajarilmoqda) | `completed` (yakunlandi) | `failed` (xato). Muvaffaqiyatsiz bo'lsa, mablag' balansga avtomatik qaytariladi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": "abcdwxyz",
                    "order_id": "my-123",
                    "type": "stars",
                    "target_username": "samarcoder",
                    "gift_id": null,
                    "amount": 50,
                    "months": null,
                    "price_som": 10000,
                    "status": "completed",
                    "transaction_id": "...",
                    "error_message": null,
                    "created_at": "2026-10-01 12:00:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "- `INSUFFICIENT_BALANCE` — Balansingiz yetarli emas\n- `FRAGMENT_ERROR` — Fragment'dan kutilmagan xato (pul qaytariladi)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "INSUFFICIENT_BALANCE": {
                    "summary": "INSUFFICIENT_BALANCE",
                    "value": {
                      "ok": false,
                      "error_code": "INSUFFICIENT_BALANCE",
                      "message": "Balansingiz yetarli emas"
                    }
                  },
                  "FRAGMENT_ERROR": {
                    "summary": "FRAGMENT_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_ERROR",
                      "message": "Fragment'dan kutilmagan xato (pul qaytariladi)"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "- `IN_PROGRESS` — Shu buyurtma hozir bajarilmoqda\n- `DUPLICATE_FAILED` — Bu buyurtma avval muvaffaqiyatsiz tugagan (yangi order_id bilan yuboring)\n- `RECENT_ATTEMPT_PENDING` — Xuddi shu qabul qiluvchi+miqdor uchun yaqinda urinish bo'lgan — ~90s kuting (yoki noyob order_id yuboring)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "IN_PROGRESS": {
                    "summary": "IN_PROGRESS",
                    "value": {
                      "ok": false,
                      "error_code": "IN_PROGRESS",
                      "message": "Shu buyurtma hozir bajarilmoqda"
                    }
                  },
                  "DUPLICATE_FAILED": {
                    "summary": "DUPLICATE_FAILED",
                    "value": {
                      "ok": false,
                      "error_code": "DUPLICATE_FAILED",
                      "message": "Bu buyurtma avval muvaffaqiyatsiz tugagan (yangi order_id bilan yuboring)"
                    }
                  },
                  "RECENT_ATTEMPT_PENDING": {
                    "summary": "RECENT_ATTEMPT_PENDING",
                    "value": {
                      "ok": false,
                      "error_code": "RECENT_ATTEMPT_PENDING",
                      "message": "Xuddi shu qabul qiluvchi+miqdor uchun yaqinda urinish bo'lgan — ~90s kuting (yoki noyob order_id yuboring)"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "- `VALIDATION_ERROR` — amount 50–1000000 butun son bo'lishi kerak (yoki username/order_id noto'g'ri)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "amount 50–1000000 butun son bo'lishi kerak (yoki username/order_id noto'g'ri)"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "- `CRITICAL_SERVER_ERROR` — Kutilmagan server xatosi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "CRITICAL_SERVER_ERROR": {
                    "summary": "CRITICAL_SERVER_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "CRITICAL_SERVER_ERROR",
                      "message": "Kutilmagan server xatosi"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "- `QUEUE_FULL` — Server navbati to'lgan — biroz kutib qayta urining\n- `FRAGMENT_TIMEOUT` — Fragment/TON tarmog'i javob bermadi — qayta urining (pul qaytariladi)\n- `FRAGMENT_RATELIMIT` — Vaqtincha cheklangan — biroz kutib qayta urining (pul qaytariladi)\n- `FRAGMENT_AUTH_ERROR` — Platforma sessiyasida vaqtinchalik xato — qayta urining (pul qaytariladi)\n- `OWNER_WALLET_INSUFFICIENT_FUNDS` — Platforma hisobida vaqtincha mablag' yetarli emas (pul qaytariladi)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "QUEUE_FULL": {
                    "summary": "QUEUE_FULL",
                    "value": {
                      "ok": false,
                      "error_code": "QUEUE_FULL",
                      "message": "Server navbati to'lgan — biroz kutib qayta urining"
                    }
                  },
                  "FRAGMENT_TIMEOUT": {
                    "summary": "FRAGMENT_TIMEOUT",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_TIMEOUT",
                      "message": "Fragment/TON tarmog'i javob bermadi — qayta urining (pul qaytariladi)"
                    }
                  },
                  "FRAGMENT_RATELIMIT": {
                    "summary": "FRAGMENT_RATELIMIT",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_RATELIMIT",
                      "message": "Vaqtincha cheklangan — biroz kutib qayta urining (pul qaytariladi)"
                    }
                  },
                  "FRAGMENT_AUTH_ERROR": {
                    "summary": "FRAGMENT_AUTH_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_AUTH_ERROR",
                      "message": "Platforma sessiyasida vaqtinchalik xato — qayta urining (pul qaytariladi)"
                    }
                  },
                  "OWNER_WALLET_INSUFFICIENT_FUNDS": {
                    "summary": "OWNER_WALLET_INSUFFICIENT_FUNDS",
                    "value": {
                      "ok": false,
                      "error_code": "OWNER_WALLET_INSUFFICIENT_FUNDS",
                      "message": "Platforma hisobida vaqtincha mablag' yetarli emas (pul qaytariladi)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/premium/buy": {
      "post": {
        "tags": [
          "Premium"
        ],
        "summary": "Premium sotib olish",
        "description": "⚠️ **Try it out haqiqiy so'rov yuboradi:** balansdan pul yechiladi va haqiqiy mahsulot yuboriladi.\n\nTelegram Premium yuboradi. `duration` — 3, 6 yoki 12 (oy).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "username",
                  "duration"
                ],
                "properties": {
                  "username": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_]{4,32}$",
                    "example": "samarcoder",
                    "description": "Telegram username (4–32 belgi). `@` bo'lsa ham bo'ladi."
                  },
                  "duration": {
                    "type": "integer",
                    "enum": [
                      3,
                      6,
                      12
                    ],
                    "example": 3
                  },
                  "order_id": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "O'zingizning noyob buyurtma ID'ingiz (1–64 belgi: harf, raqam, `. _ : -`). Takroriy yuborishdan himoya qiladi. **Tavsiya etiladi.**",
                    "example": "my-123"
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Ixtiyoriy: shu buyurtma natijasi uchun webhook manzili (https)"
                  }
                }
              },
              "example": {
                "username": "samarcoder",
                "duration": 3,
                "order_id": "my-124"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Buyurtma (`type: premium`). `months` — oylar soni, `price_som` — yechilgan summa (so'mda). `status`: `processing` (bajarilmoqda) | `completed` (yakunlandi) | `failed` (xato). Muvaffaqiyatsiz bo'lsa, mablag' balansga avtomatik qaytariladi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": "abcdwxyz",
                    "order_id": "my-123",
                    "type": "premium",
                    "target_username": "samarcoder",
                    "gift_id": null,
                    "amount": null,
                    "months": 3,
                    "price_som": 155000,
                    "status": "completed",
                    "transaction_id": "...",
                    "error_message": null,
                    "created_at": "2026-10-01 12:00:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "- `INSUFFICIENT_BALANCE` — Balansingiz yetarli emas\n- `FRAGMENT_ERROR` — Fragment'dan kutilmagan xato (pul qaytariladi)\n- `VALIDATION_ERROR` — duration 3, 6 yoki 12 bo'lishi kerak (HTTP 400)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "INSUFFICIENT_BALANCE": {
                    "summary": "INSUFFICIENT_BALANCE",
                    "value": {
                      "ok": false,
                      "error_code": "INSUFFICIENT_BALANCE",
                      "message": "Balansingiz yetarli emas"
                    }
                  },
                  "FRAGMENT_ERROR": {
                    "summary": "FRAGMENT_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_ERROR",
                      "message": "Fragment'dan kutilmagan xato (pul qaytariladi)"
                    }
                  },
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR (duration)",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "duration 3, 6 yoki 12 bo'lishi kerak"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "- `IN_PROGRESS` — Shu buyurtma hozir bajarilmoqda\n- `DUPLICATE_FAILED` — Bu buyurtma avval muvaffaqiyatsiz tugagan (yangi order_id bilan yuboring)\n- `RECENT_ATTEMPT_PENDING` — Xuddi shu qabul qiluvchi+miqdor uchun yaqinda urinish bo'lgan — ~90s kuting (yoki noyob order_id yuboring)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "IN_PROGRESS": {
                    "summary": "IN_PROGRESS",
                    "value": {
                      "ok": false,
                      "error_code": "IN_PROGRESS",
                      "message": "Shu buyurtma hozir bajarilmoqda"
                    }
                  },
                  "DUPLICATE_FAILED": {
                    "summary": "DUPLICATE_FAILED",
                    "value": {
                      "ok": false,
                      "error_code": "DUPLICATE_FAILED",
                      "message": "Bu buyurtma avval muvaffaqiyatsiz tugagan (yangi order_id bilan yuboring)"
                    }
                  },
                  "RECENT_ATTEMPT_PENDING": {
                    "summary": "RECENT_ATTEMPT_PENDING",
                    "value": {
                      "ok": false,
                      "error_code": "RECENT_ATTEMPT_PENDING",
                      "message": "Xuddi shu qabul qiluvchi+miqdor uchun yaqinda urinish bo'lgan — ~90s kuting (yoki noyob order_id yuboring)"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "- `VALIDATION_ERROR` — duration 3, 6 yoki 12 bo'lishi kerak (yoki username/order_id noto'g'ri)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "duration 3, 6 yoki 12 bo'lishi kerak (yoki username/order_id noto'g'ri)"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "- `CRITICAL_SERVER_ERROR` — Kutilmagan server xatosi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "CRITICAL_SERVER_ERROR": {
                    "summary": "CRITICAL_SERVER_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "CRITICAL_SERVER_ERROR",
                      "message": "Kutilmagan server xatosi"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "- `QUEUE_FULL` — Server navbati to'lgan — biroz kutib qayta urining\n- `FRAGMENT_TIMEOUT` — Fragment/TON tarmog'i javob bermadi — qayta urining (pul qaytariladi)\n- `FRAGMENT_RATELIMIT` — Vaqtincha cheklangan — biroz kutib qayta urining (pul qaytariladi)\n- `FRAGMENT_AUTH_ERROR` — Platforma sessiyasida vaqtinchalik xato — qayta urining (pul qaytariladi)\n- `OWNER_WALLET_INSUFFICIENT_FUNDS` — Platforma hisobida vaqtincha mablag' yetarli emas (pul qaytariladi)\n- `PRICING_NOT_CONFIGURED` — Bu muddat/davlat uchun narx sozlanmagan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "QUEUE_FULL": {
                    "summary": "QUEUE_FULL",
                    "value": {
                      "ok": false,
                      "error_code": "QUEUE_FULL",
                      "message": "Server navbati to'lgan — biroz kutib qayta urining"
                    }
                  },
                  "FRAGMENT_TIMEOUT": {
                    "summary": "FRAGMENT_TIMEOUT",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_TIMEOUT",
                      "message": "Fragment/TON tarmog'i javob bermadi — qayta urining (pul qaytariladi)"
                    }
                  },
                  "FRAGMENT_RATELIMIT": {
                    "summary": "FRAGMENT_RATELIMIT",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_RATELIMIT",
                      "message": "Vaqtincha cheklangan — biroz kutib qayta urining (pul qaytariladi)"
                    }
                  },
                  "FRAGMENT_AUTH_ERROR": {
                    "summary": "FRAGMENT_AUTH_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "FRAGMENT_AUTH_ERROR",
                      "message": "Platforma sessiyasida vaqtinchalik xato — qayta urining (pul qaytariladi)"
                    }
                  },
                  "OWNER_WALLET_INSUFFICIENT_FUNDS": {
                    "summary": "OWNER_WALLET_INSUFFICIENT_FUNDS",
                    "value": {
                      "ok": false,
                      "error_code": "OWNER_WALLET_INSUFFICIENT_FUNDS",
                      "message": "Platforma hisobida vaqtincha mablag' yetarli emas (pul qaytariladi)"
                    }
                  },
                  "PRICING_NOT_CONFIGURED": {
                    "summary": "PRICING_NOT_CONFIGURED",
                    "value": {
                      "ok": false,
                      "error_code": "PRICING_NOT_CONFIGURED",
                      "message": "Bu muddat/davlat uchun narx sozlanmagan"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/gifts": {
      "get": {
        "tags": [
          "Gift"
        ],
        "summary": "Gift katalogi",
        "description": "Bizning gift katalogimiz: qisqa `id` (1, 2, 3 ...), narx, rasm va animatsiya havolalari, mavjudlik.",
        "responses": {
          "200": {
            "description": "Gift katalogi. `price_som` — **so'mda**; `available: false` bo'lsa, gift hozir sotib olinmaydi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string"
                        },
                        "gifts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Gift"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "currency": "UZS",
                    "gifts": [
                      {
                        "id": "1",
                        "name": "Yurak",
                        "emoji": "💝",
                        "star_count": 15,
                        "price_som": 3000,
                        "thumb_url": "https://ese.roxiy.uz/web/assets/gifts/5170145012310081615.webp",
                        "animation_url": "https://ese.roxiy.uz/web/assets/gifts/5170145012310081615.json",
                        "is_limited": false,
                        "remaining_count": null,
                        "available": true
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/gift/buy": {
      "post": {
        "tags": [
          "Gift"
        ],
        "summary": "Gift yuborish",
        "description": "⚠️ **Try it out haqiqiy so'rov yuboradi:** balansdan pul yechiladi va haqiqiy mahsulot yuboriladi.\n\nNatijada `type: \"gift\"` va `gift_id` qaytadi. Bajarilmasa, pul qaytariladi.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "username",
                  "gift_id"
                ],
                "properties": {
                  "username": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_]{4,32}$",
                    "example": "samarcoder",
                    "description": "Telegram username (4–32 belgi). `@` bo'lsa ham bo'ladi."
                  },
                  "gift_id": {
                    "type": "string",
                    "description": "`GET /gifts` dagi qisqa `id`",
                    "example": "1"
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 30,
                    "description": "Gift bilan xabar"
                  },
                  "anonim": {
                    "type": "boolean",
                    "description": "true bo'lsa, yuboruvchi ko'rsatilmaydi"
                  },
                  "order_id": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "O'zingizning noyob buyurtma ID'ingiz (1–64 belgi: harf, raqam, `. _ : -`). Takroriy yuborishdan himoya qiladi. **Tavsiya etiladi.**",
                    "example": "my-123"
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Ixtiyoriy: shu buyurtma natijasi uchun webhook manzili (https)"
                  }
                }
              },
              "example": {
                "username": "samarcoder",
                "gift_id": "1",
                "text": "Tabriklayman!",
                "order_id": "my-125"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Buyurtma (`type: gift`). `gift_id` — katalogdagi qisqa id, `amount` — gift'ning Stars qiymati. `status`: `processing` (bajarilmoqda) | `completed` (yakunlandi) | `failed` (xato). Muvaffaqiyatsiz bo'lsa, mablag' balansga avtomatik qaytariladi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": "abcdwxyz",
                    "order_id": "my-123",
                    "type": "gift",
                    "target_username": "samarcoder",
                    "gift_id": "1",
                    "amount": 15,
                    "months": null,
                    "price_som": 3000,
                    "status": "completed",
                    "transaction_id": "...",
                    "error_message": null,
                    "created_at": "2026-10-01 12:00:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "- `INSUFFICIENT_BALANCE` — Balansingiz yetarli emas\n- `USER_NOT_FOUND` — Username topilmadi (kanal/bot username yoki mavjud emas)\n- `GIFT_FAILED` — Gift yuborilmadi (pul qaytariladi)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "INSUFFICIENT_BALANCE": {
                    "summary": "INSUFFICIENT_BALANCE",
                    "value": {
                      "ok": false,
                      "error_code": "INSUFFICIENT_BALANCE",
                      "message": "Balansingiz yetarli emas"
                    }
                  },
                  "USER_NOT_FOUND": {
                    "summary": "USER_NOT_FOUND",
                    "value": {
                      "ok": false,
                      "error_code": "USER_NOT_FOUND",
                      "message": "Username topilmadi (kanal/bot username yoki mavjud emas)"
                    }
                  },
                  "GIFT_FAILED": {
                    "summary": "GIFT_FAILED",
                    "value": {
                      "ok": false,
                      "error_code": "GIFT_FAILED",
                      "message": "Gift yuborilmadi (pul qaytariladi)"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "- `IN_PROGRESS` — Shu buyurtma hozir bajarilmoqda\n- `DUPLICATE_FAILED` — Bu buyurtma avval muvaffaqiyatsiz tugagan (yangi order_id bilan yuboring)\n- `RECENT_ATTEMPT_PENDING` — Xuddi shu qabul qiluvchi+miqdor uchun yaqinda urinish bo'lgan — ~90s kuting (yoki noyob order_id yuboring)\n- `GIFT_UNAVAILABLE` — Bu gift hozir mavjud emas",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "IN_PROGRESS": {
                    "summary": "IN_PROGRESS",
                    "value": {
                      "ok": false,
                      "error_code": "IN_PROGRESS",
                      "message": "Shu buyurtma hozir bajarilmoqda"
                    }
                  },
                  "DUPLICATE_FAILED": {
                    "summary": "DUPLICATE_FAILED",
                    "value": {
                      "ok": false,
                      "error_code": "DUPLICATE_FAILED",
                      "message": "Bu buyurtma avval muvaffaqiyatsiz tugagan (yangi order_id bilan yuboring)"
                    }
                  },
                  "RECENT_ATTEMPT_PENDING": {
                    "summary": "RECENT_ATTEMPT_PENDING",
                    "value": {
                      "ok": false,
                      "error_code": "RECENT_ATTEMPT_PENDING",
                      "message": "Xuddi shu qabul qiluvchi+miqdor uchun yaqinda urinish bo'lgan — ~90s kuting (yoki noyob order_id yuboring)"
                    }
                  },
                  "GIFT_UNAVAILABLE": {
                    "summary": "GIFT_UNAVAILABLE",
                    "value": {
                      "ok": false,
                      "error_code": "GIFT_UNAVAILABLE",
                      "message": "Bu gift hozir mavjud emas"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "- `VALIDATION_ERROR` — username/gift_id/text/order_id noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "username/gift_id/text/order_id noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "- `CRITICAL_SERVER_ERROR` — Kutilmagan server xatosi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "CRITICAL_SERVER_ERROR": {
                    "summary": "CRITICAL_SERVER_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "CRITICAL_SERVER_ERROR",
                      "message": "Kutilmagan server xatosi"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "- `QUEUE_FULL` — Server navbati to'lgan — biroz kutib qayta urining\n- `GIFT_TIMEOUT` — Telegram javob bermadi — qayta urining (pul qaytariladi)\n- `OWNER_WALLET_INSUFFICIENT_FUNDS` — Platforma hisobida vaqtincha mablag' yetarli emas (pul qaytariladi)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "QUEUE_FULL": {
                    "summary": "QUEUE_FULL",
                    "value": {
                      "ok": false,
                      "error_code": "QUEUE_FULL",
                      "message": "Server navbati to'lgan — biroz kutib qayta urining"
                    }
                  },
                  "GIFT_TIMEOUT": {
                    "summary": "GIFT_TIMEOUT",
                    "value": {
                      "ok": false,
                      "error_code": "GIFT_TIMEOUT",
                      "message": "Telegram javob bermadi — qayta urining (pul qaytariladi)"
                    }
                  },
                  "OWNER_WALLET_INSUFFICIENT_FUNDS": {
                    "summary": "OWNER_WALLET_INSUFFICIENT_FUNDS",
                    "value": {
                      "ok": false,
                      "error_code": "OWNER_WALLET_INSUFFICIENT_FUNDS",
                      "message": "Platforma hisobida vaqtincha mablag' yetarli emas (pul qaytariladi)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/rent/{category}": {
      "get": {
        "tags": [
          "Rent"
        ],
        "summary": "Ijaraga mavjud NFT'lar",
        "description": "Sahifalash: javobdagi `cursor` ni keyingi so'rovda yuboring. Narx `price_som_day` — bir kun uchun; qo'shimcha `network_fee_som` har ijaraga bir martalik olinadi.",
        "responses": {
          "200": {
            "description": "Ijaraga mavjud NFT'lar. `price_som_day` — **bir kun** uchun, so'mda; `network_fee_som` har ijaraga bir martalik qo'shiladi. Keyingi sahifa uchun `cursor` ni yuboring.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "category": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/RentItem"
                          }
                        },
                        "cursor": {
                          "type": "string",
                          "nullable": true
                        },
                        "network_fee_som": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "category": "gifts",
                    "items": [
                      {
                        "nft_address": "EQAAiJ8Z...",
                        "nft_name": "Signet Ring #5228",
                        "thumb_url": "https://nft.fragment.com/gift/signetring-5228.medium.jpg",
                        "min_days": 1,
                        "max_days": 3,
                        "price_ton_day": 0.05,
                        "price_som_day": 1100
                      }
                    ],
                    "cursor": "abc",
                    "network_fee_som": 2000
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "- `RENT_UNAVAILABLE` — Ijara xizmati vaqtincha ishlamayapti — keyinroq urining",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RENT_UNAVAILABLE": {
                    "summary": "RENT_UNAVAILABLE",
                    "value": {
                      "ok": false,
                      "error_code": "RENT_UNAVAILABLE",
                      "message": "Ijara xizmati vaqtincha ishlamayapti — keyinroq urining"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "category",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "gifts",
                "usernames",
                "numbers"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/rent/buy": {
      "post": {
        "tags": [
          "Rent"
        ],
        "summary": "NFT ijaraga olish",
        "description": "⚠️ **Try it out haqiqiy so'rov yuboradi:** balansdan pul yechiladi va haqiqiy mahsulot yuboriladi.\n\n**Asinxron:** javob **202**, `status: \"processing\"`. To'lov avtomatik yuboriladi va odatda 10–30 soniyada `active` bo'ladi. Natijani `GET /rent/{id}` orqali tekshirib turing. Bajarilmasa, mablag' qaytariladi.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "nft_address",
                  "days"
                ],
                "properties": {
                  "category": {
                    "type": "string",
                    "enum": [
                      "gifts",
                      "usernames",
                      "numbers"
                    ],
                    "default": "gifts"
                  },
                  "nft_address": {
                    "type": "string",
                    "description": "`GET /rent/{category}` dagi manzil"
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "`min_days` – `max_days` oralig'ida"
                  },
                  "order_id": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "O'zingizning noyob buyurtma ID'ingiz (1–64 belgi: harf, raqam, `. _ : -`). Takroriy yuborishdan himoya qiladi. **Tavsiya etiladi.**",
                    "example": "my-123"
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Ixtiyoriy: shu buyurtma natijasi uchun webhook manzili (https)"
                  }
                }
              },
              "example": {
                "category": "gifts",
                "nft_address": "EQAAiJ8Z...",
                "days": 2,
                "order_id": "my-rent-1"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Ijara qabul qilindi: `status: processing`. Faollashishini `GET /rent/{id}` bilan tekshirib turing. `price_som` balansdan yechildi.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "$ref": "#/components/schemas/Rental"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": 12,
                    "order_id": "my-rent-1",
                    "nft_address": "EQAAiJ8Z...",
                    "nft_name": "Signet Ring #5228",
                    "days": 2,
                    "price_som": 4200,
                    "status": "processing",
                    "end_time": null,
                    "link_saved": false,
                    "created_at": "2026-10-01 12:00:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "- `INSUFFICIENT_BALANCE` — Balansingiz yetarli emas",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "INSUFFICIENT_BALANCE": {
                    "summary": "INSUFFICIENT_BALANCE",
                    "value": {
                      "ok": false,
                      "error_code": "INSUFFICIENT_BALANCE",
                      "message": "Balansingiz yetarli emas"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "- `NFT_UNAVAILABLE` — Bu NFT endi mavjud emas (band qilingan yoki ro'yxatdan olingan)\n- `IN_PROGRESS` — Shu buyurtma hozir bajarilmoqda",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NFT_UNAVAILABLE": {
                    "summary": "NFT_UNAVAILABLE",
                    "value": {
                      "ok": false,
                      "error_code": "NFT_UNAVAILABLE",
                      "message": "Bu NFT endi mavjud emas (band qilingan yoki ro'yxatdan olingan)"
                    }
                  },
                  "IN_PROGRESS": {
                    "summary": "IN_PROGRESS",
                    "value": {
                      "ok": false,
                      "error_code": "IN_PROGRESS",
                      "message": "Shu buyurtma hozir bajarilmoqda"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "- `VALIDATION_ERROR` — category/nft_address/days noto'g'ri (days min_days–max_days oralig'ida bo'lishi shart)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "category/nft_address/days noto'g'ri (days min_days–max_days oralig'ida bo'lishi shart)"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "- `RENT_UNAVAILABLE` — Ijara xizmati vaqtincha ishlamayapti — keyinroq urining\n- `RENT_FAILED` — Ijara so'rovi bajarilmadi (pul qaytarildi)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RENT_UNAVAILABLE": {
                    "summary": "RENT_UNAVAILABLE",
                    "value": {
                      "ok": false,
                      "error_code": "RENT_UNAVAILABLE",
                      "message": "Ijara xizmati vaqtincha ishlamayapti — keyinroq urining"
                    }
                  },
                  "RENT_FAILED": {
                    "summary": "RENT_FAILED",
                    "value": {
                      "ok": false,
                      "error_code": "RENT_FAILED",
                      "message": "Ijara so'rovi bajarilmadi (pul qaytarildi)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/rent/{id}": {
      "get": {
        "tags": [
          "Rent"
        ],
        "summary": "Ijara holati",
        "description": "`processing` | `active` | `failed`. `end_time` — Unix vaqti.",
        "responses": {
          "200": {
            "description": "Ijara holati: `processing` (to'lov/faollashtirish kutilmoqda) | `active` (`end_time` — tugash vaqti, Unix) | `failed` (mablag' qaytarilgan).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "$ref": "#/components/schemas/Rental"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": 12,
                    "order_id": "my-rent-1",
                    "nft_address": "EQAAiJ8Z...",
                    "nft_name": "Signet Ring #5228",
                    "days": 2,
                    "price_som": 4200,
                    "status": "active",
                    "end_time": 1790964754,
                    "link_saved": true,
                    "created_at": "2026-10-01 12:00:00"
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "- `ORDER_NOT_FOUND` — Ijara topilmadi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ORDER_NOT_FOUND": {
                    "summary": "ORDER_NOT_FOUND",
                    "value": {
                      "ok": false,
                      "error_code": "ORDER_NOT_FOUND",
                      "message": "Ijara topilmadi"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Ijara `id` yoki o'zingizning `order_id`ingiz",
            "example": "12"
          }
        ]
      }
    },
    "/rent/{id}/link": {
      "post": {
        "tags": [
          "Rent"
        ],
        "summary": "Akkauntga ulash",
        "description": "Ijarani Fragment akkauntiga ulaydi (Telegram'da ko'rsatish uchun). Ijara `processing` bo'lganda ham yuborsangiz bo'ladi: havola saqlanadi va ijara faollashgach avtomatik ulanadi.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Ijara `id` yoki o'zingizning `order_id`ingiz",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tonconnect_url"
                ],
                "properties": {
                  "tonconnect_url": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "tonconnect_url": "tc://..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`link_status`: `linked` (ulandi) | `queued` (havola saqlandi, ijara faollashgach ulanadi) | `pending_admin` (qo'lda tasdiqlash kutilmoqda).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "link_status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "linked",
                            "pending_admin"
                          ]
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "id": 12,
                    "link_status": "linked"
                  }
                }
              }
            }
          },
          "400": {
            "description": "- `LINK_FAILED` — Akkauntga ulanmadi: <sabab>",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "LINK_FAILED": {
                    "summary": "LINK_FAILED",
                    "value": {
                      "ok": false,
                      "error_code": "LINK_FAILED",
                      "message": "Akkauntga ulanmadi: <sabab>"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "- `ORDER_NOT_FOUND` — Ijara topilmadi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ORDER_NOT_FOUND": {
                    "summary": "ORDER_NOT_FOUND",
                    "value": {
                      "ok": false,
                      "error_code": "ORDER_NOT_FOUND",
                      "message": "Ijara topilmadi"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "- `RENT_NOT_ACTIVE` — Ijara faol emas",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RENT_NOT_ACTIVE": {
                    "summary": "RENT_NOT_ACTIVE",
                    "value": {
                      "ok": false,
                      "error_code": "RENT_NOT_ACTIVE",
                      "message": "Ijara faol emas"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "- `VALIDATION_ERROR` — tonconnect_url kerak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "VALIDATION_ERROR": {
                    "summary": "VALIDATION_ERROR",
                    "value": {
                      "ok": false,
                      "error_code": "VALIDATION_ERROR",
                      "message": "tonconnect_url kerak"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/rent": {
      "get": {
        "tags": [
          "Rent"
        ],
        "summary": "Ijaralarim",
        "description": "Oxirgi 50 ta API ijara.",
        "responses": {
          "200": {
            "description": "Oxirgi 50 ta API ijara (yangisi birinchi).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "rentals": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Rental"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "result": {
                    "rentals": []
                  }
                }
              }
            }
          },
          "401": {
            "description": "- `MISSING_API_KEY` — X-API-Key header yuborilmagan\n- `INVALID_API_KEY` — X-API-Key noto'g'ri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "MISSING_API_KEY": {
                    "summary": "MISSING_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "MISSING_API_KEY",
                      "message": "X-API-Key header yuborilmagan"
                    }
                  },
                  "INVALID_API_KEY": {
                    "summary": "INVALID_API_KEY",
                    "value": {
                      "ok": false,
                      "error_code": "INVALID_API_KEY",
                      "message": "X-API-Key noto'g'ri"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "- `BANNED` — Hisob bloklangan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BANNED": {
                    "summary": "BANNED",
                    "value": {
                      "ok": false,
                      "error_code": "BANNED",
                      "message": "Hisob bloklangan"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "- `RATE_LIMITED` — So'rovlar limiti oshdi (60/daqiqa)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RATE_LIMITED": {
                    "summary": "RATE_LIMITED",
                    "value": {
                      "ok": false,
                      "error_code": "RATE_LIMITED",
                      "message": "So'rovlar limiti oshdi (60/daqiqa)"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/gamezone/games": {
      "get": {
        "tags": [
          "Game Zone"
        ],
        "summary": "O'yinlar ro'yxati",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "description": "O'yinlar ro'yxati: asosiy o'yinlar (pubg, mlbb, freefire, codm, roblox, steam) va katalog o'yinlari (catalog: true; 280+ ta, masalan valorant_th, honor_of_kings, genshin_impact) hamda gift kartalar (type: code, slug gc_*: gc_psn, gc_xbox, gc_gplay, gc_appstore, gc_netflix, gc_razer, gc_nintendo, gc_fortnite, gc_valorant, gc_lol, gc_discord, gc_battlenet, gc_xbox_gp, gc_twitch, gc_meta, gc_steam, gc_amazon, gc_minecraft, gc_ea, gc_airbnb — faqat package_id kerak, player_id emas). display.id_label / display.id_pattern — player_id formati."
      }
    },
    "/gamezone/games/{slug}": {
      "get": {
        "tags": [
          "Game Zone"
        ],
        "summary": "O'yin paketlari va narxlari",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/gamezone/check": {
      "post": {
        "tags": [
          "Game Zone"
        ],
        "summary": "Player ID tekshiruvi",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "game": {
                    "type": "string"
                  },
                  "player_id": {
                    "type": "string"
                  },
                  "server_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/gamezone/buy": {
      "post": {
        "tags": [
          "Game Zone"
        ],
        "summary": "O'yinni to'ldirish (balansdan yechiladi)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "game": {
                    "type": "string"
                  },
                  "package_id": {
                    "type": "integer"
                  },
                  "player_id": {
                    "type": "string"
                  },
                  "server_id": {
                    "type": "string"
                  },
                  "region": {
                    "type": "string"
                  },
                  "usd": {
                    "type": "number"
                  },
                  "order_id": {
                    "type": "string"
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Ixtiyoriy: shu buyurtma natijasi uchun webhook manzili (https)"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/gamezone/orders": {
      "get": {
        "tags": [
          "Game Zone"
        ],
        "summary": "Oxirgi Game Zone buyurtmalari",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/gamezone/orders/{id}": {
      "get": {
        "tags": [
          "Game Zone"
        ],
        "summary": "Game Zone buyurtma holati",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/webhook": {
      "get": {
        "tags": [
          "Webhook"
        ],
        "summary": "Webhook manzili va statistikasi",
        "responses": {
          "200": {
            "description": "OK"
          },
          "422": {
            "description": "VALIDATION_ERROR"
          }
        }
      },
      "post": {
        "tags": [
          "Webhook"
        ],
        "summary": "Webhook manzilini o'rnatish",
        "responses": {
          "200": {
            "description": "OK"
          },
          "422": {
            "description": "VALIDATION_ERROR"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "example": "https://sizning-sayt.uz/hook"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhook"
        ],
        "summary": "Webhook manzilini o'chirish",
        "responses": {
          "200": {
            "description": "OK"
          },
          "422": {
            "description": "VALIDATION_ERROR"
          }
        }
      }
    },
    "/webhook/test": {
      "post": {
        "tags": [
          "Webhook"
        ],
        "summary": "Sinov xabarini (ping) yuborish",
        "responses": {
          "200": {
            "description": "OK"
          },
          "422": {
            "description": "VALIDATION_ERROR"
          }
        }
      }
    },
    "/webhook/deliveries": {
      "get": {
        "tags": [
          "Webhook"
        ],
        "summary": "Oxirgi webhook yetkazishlari",
        "responses": {
          "200": {
            "description": "OK"
          },
          "422": {
            "description": "VALIDATION_ERROR"
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/smm/catalog": {
      "get": {
        "tags": [
          "SMM"
        ],
        "summary": "SMM katalogi (sizning API narxingiz)",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "uz",
                "ru",
                "en"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/smm/quote": {
      "post": {
        "tags": [
          "SMM"
        ],
        "summary": "Narx va chegaralar",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "service",
                  "quantity"
                ],
                "properties": {
                  "service": {
                    "type": "integer"
                  },
                  "quantity": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/smm/check": {
      "post": {
        "tags": [
          "SMM"
        ],
        "summary": "Havolani tekshirish",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "service",
                  "link"
                ],
                "properties": {
                  "service": {
                    "type": "integer"
                  },
                  "link": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/smm/order": {
      "post": {
        "tags": [
          "SMM"
        ],
        "summary": "SMM buyurtma (balansdan yechiladi)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "service",
                  "link",
                  "quantity"
                ],
                "properties": {
                  "service": {
                    "type": "integer"
                  },
                  "link": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer"
                  },
                  "order_id": {
                    "type": "string",
                    "description": "Ixtiyoriy: noyob ID (idempotentlik)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Yaratildi"
          }
        }
      }
    },
    "/smm/orders": {
      "get": {
        "tags": [
          "SMM"
        ],
        "summary": "Oxirgi 30 ta SMM buyurtma",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/smm/orders/{id}": {
      "get": {
        "tags": [
          "SMM"
        ],
        "summary": "SMM buyurtma holati",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Botdan olingan API kalit (32 belgi). Faqat `X-API-Key` headerida yuboring, URL'ga qo'ymang. Limit: 60 so'rov/daqiqa (kalit bo'yicha)."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "example": false
          },
          "error_code": {
            "type": "string",
            "example": "INSUFFICIENT_BALANCE"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Buyurtma ID (GET /orders/{id} uchun)",
            "example": "abcdwxyz"
          },
          "order_id": {
            "type": "string",
            "nullable": true,
            "description": "Sizning order_id'ingiz"
          },
          "type": {
            "type": "string",
            "enum": [
              "stars",
              "premium",
              "gift"
            ]
          },
          "target_username": {
            "type": "string"
          },
          "gift_id": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "nullable": true,
            "description": "Stars soni yoki gift uchun star_count"
          },
          "months": {
            "type": "integer",
            "nullable": true
          },
          "price_som": {
            "type": "number",
            "description": "Yechilgan summa, so'mda (UZS)"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "completed",
              "failed"
            ],
            "description": "processing — bajarilmoqda; completed — yakunlandi; failed — xato (pul qaytarilgan)"
          },
          "transaction_id": {
            "type": "string",
            "nullable": true
          },
          "error_message": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string"
          }
        }
      },
      "Gift": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "1"
          },
          "name": {
            "type": "string",
            "example": "Yurak"
          },
          "emoji": {
            "type": "string",
            "example": "💝"
          },
          "star_count": {
            "type": "integer",
            "example": 15
          },
          "price_som": {
            "type": "number",
            "example": 3000,
            "description": "Narx, so'mda (UZS)"
          },
          "thumb_url": {
            "type": "string"
          },
          "animation_url": {
            "type": "string"
          },
          "is_limited": {
            "type": "boolean"
          },
          "remaining_count": {
            "type": "integer",
            "nullable": true
          },
          "available": {
            "type": "boolean"
          }
        }
      },
      "Country": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "example": "BD"
          },
          "name": {
            "type": "string",
            "example": "Bangladesh 🇧🇩"
          },
          "qty": {
            "type": "integer"
          },
          "price_som": {
            "type": "number",
            "example": 4648,
            "description": "Narx, so'mda (UZS)"
          }
        }
      },
      "Number": {
        "type": "object",
        "properties": {
          "order_id": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "example": "8801234567890"
          },
          "country": {
            "type": "string"
          },
          "country_code": {
            "type": "string",
            "example": "BD"
          },
          "price_som": {
            "type": "number",
            "description": "Yechilgan summa, so'mda (UZS)"
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "completed"
            ],
            "description": "waiting — SMS kutilmoqda; completed — kod keldi"
          },
          "sms_code": {
            "type": "string",
            "nullable": true
          },
          "password": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string"
          }
        }
      },
      "RentItem": {
        "type": "object",
        "properties": {
          "nft_address": {
            "type": "string"
          },
          "nft_name": {
            "type": "string",
            "example": "Signet Ring #5228"
          },
          "thumb_url": {
            "type": "string",
            "nullable": true
          },
          "min_days": {
            "type": "number"
          },
          "max_days": {
            "type": "number"
          },
          "price_ton_day": {
            "type": "number"
          },
          "price_som_day": {
            "type": "integer",
            "nullable": true,
            "description": "Bir kun uchun narx, so'mda (UZS)"
          }
        }
      },
      "Rental": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 12
          },
          "order_id": {
            "type": "string",
            "nullable": true
          },
          "nft_address": {
            "type": "string"
          },
          "nft_name": {
            "type": "string"
          },
          "days": {
            "type": "integer"
          },
          "price_som": {
            "type": "number",
            "description": "Yechilgan summa, so'mda (UZS)"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "active",
              "failed"
            ],
            "description": "processing — kutilmoqda; active — faol; failed — xato (pul qaytarilgan)"
          },
          "end_time": {
            "type": "integer",
            "nullable": true,
            "description": "Unix vaqti"
          },
          "link_saved": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          }
        }
      }
    }
  }
}