# Models

## ActiveProxyItem

```json
{
  "type": "object",
  "properties": {
    "ip": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "password": {
      "type": "string"
    },
    "http_port": {
      "type": "integer"
    },
    "socks_port": {
      "type": "integer"
    },
    "until": {
      "type": "string",
      "description": "Строка даты ISO 8601"
    },
    "status": {
      "type": "string"
    },
    "signature": {
      "type": "string",
      "nullable": true,
      "description": "подпись p0f, назначенная IP-адресу, ноль, если не установлена"
    }
  },
  "required": [
    "ip",
    "username",
    "password",
    "http_port",
    "socks_port",
    "until",
    "status"
  ]
}
```

## ApiError

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "success",
    "message"
  ]
}
```

## AddonLine

```json
{
  "type": "object",
  "description": "Одна строка дополнения, сохраненная в заказе",
  "properties": {
    "addon_key": {
      "type": "string"
    },
    "catalog_id": {
      "type": "integer"
    },
    "qty": {
      "type": "integer",
      "description": "Активные единицы за текущий период"
    },
    "price_per_unit": {
      "type": "integer",
      "description": "Цена за единицу в центах на момент покупки"
    },
    "pending": {
      "description": "Изменение запланировано на следующее продление или `null`",
      "nullable": true,
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "cancel",
            "downgrade"
          ]
        },
        "next_qty": {
          "type": "integer",
          "description": "Целевое количество после понижения"
        }
      }
    }
  }
}
```

## PurchaseRequestDcIsp

```json
{
  "type": "object",
  "description": "Покупка для Datacenter/ISP; поле location обязательно.",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Datacenter Proxy",
        "ISP Proxy"
      ]
    },
    "location": {
      "type": "string"
    },
    "cycle": {
      "type": "string"
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "auto_renewal": {
      "type": "boolean",
      "default": false
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Дополнения, прикрепляемые во время покупки, например `p0f_slots` для DC или ISP.",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product",
    "location",
    "cycle"
  ]
}
```

## PurchaseRequestResidentialStandard

```json
{
  "type": "object",
  "description": "Покупка для Standart Residential Proxy; location не требуется; цикл фиксирован (lifetime).",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Standart Residential Proxy"
      ]
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Дополнения, прикрепляемые во время покупки, например `p0f_slots` для DC или ISP.",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product"
  ]
}
```

## PurchaseRequestResidentialPremium

```json
{
  "type": "object",
  "description": "Покупка для Premium Residential Proxy; location не требуется; цикл фиксирован (lifetime).",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Premium Residential Proxy"
      ]
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Дополнения, прикрепляемые во время покупки, например `p0f_slots` для DC или ISP.",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product"
  ]
}
```

## PurchaseRequestResidentialUnmetered

```json
{
  "type": "object",
  "description": "Покупка для Unmetered Residential proxy; поддерживает авто-продление.",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Unmetered Residential proxy"
      ]
    },
    "cycle": {
      "type": "string"
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "auto_renewal": {
      "type": "boolean",
      "default": false
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Дополнения, прикрепляемые во время покупки, например `p0f_slots` для DC или ISP.",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product",
    "cycle"
  ]
}
```

## PurchaseRequest

```json
{
  "type": "object",
  "properties": {
    "product": {
      "type": "string"
    },
    "location": {
      "type": "string",
      "nullable": true
    },
    "cycle": {
      "type": "string"
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "auto_renewal": {
      "type": "boolean",
      "default": false
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Дополнения, прикрепляемые во время покупки, например `p0f_slots` для DC или ISP.",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product",
    "cycle"
  ]
}
```

## PurchaseResponse

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "message": {
      "type": "string"
    },
    "order_id": {
      "type": "integer"
    }
  },
  "required": [
    "success",
    "message",
    "order_id"
  ]
}
```

## ProductWithCycles

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string",
      "nullable": true
    },
    "location": {
      "type": "string",
      "nullable": true
    },
    "cycles": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "name",
    "cycles"
  ]
}
```

## AvailableCountResponse

```json
{
  "type": "object",
  "properties": {
    "country": {
      "type": "string"
    },
    "product": {
      "type": "string"
    },
    "amount": {
      "type": "integer"
    }
  },
  "required": [
    "country",
    "product",
    "amount"
  ]
}
```

## ApiMeResponse

```json
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "active_orders": {
      "type": "integer"
    },
    "wallet_balance": {
      "type": "integer",
      "description": "в центах"
    }
  },
  "required": [
    "email",
    "active_orders",
    "wallet_balance"
  ]
}
```

## ApiSuccess

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  },
  "required": [
    "success"
  ]
}
```

## AvailableCountRequest

```json
{
  "type": "object",
  "properties": {
    "country": {
      "type": "string"
    },
    "product": {
      "type": "string"
    }
  },
  "required": [
    "country",
    "product"
  ]
}
```

## AddBandwidthRequest

```json
{
  "type": "object",
  "properties": {
    "amount": {
      "type": "integer",
      "description": "Объём в ГБ"
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    }
  },
  "required": [
    "amount"
  ]
}
```

## GetSubUsersRequest

```json
{
  "type": "object",
  "properties": {
    "offset": {
      "type": "integer",
      "description": "Смещение (по умолчанию 0)"
    },
    "limit": {
      "type": "integer",
      "description": "Размер страницы (по умолчанию 20)"
    }
  }
}
```

## EditSubUserPayload

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ]
}
```

## CreateSubUserPayload

```json
{
  "type": "object",
  "properties": {
    "proxy_type": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "data": {
      "type": "integer",
      "description": "Объём в ГБ"
    }
  },
  "required": [
    "proxy_type",
    "name",
    "data"
  ]
}
```

## ChangeSubUserPasswordPayload

```json
{
  "type": "object",
  "properties": {
    "proxy_type": {
      "type": "string"
    }
  },
  "required": [
    "proxy_type"
  ]
}
```

## ModifyTrafficPayload

```json
{
  "type": "object",
  "properties": {
    "proxy_type": {
      "type": "string"
    },
    "data": {
      "type": "integer",
      "description": "Объём в ГБ"
    }
  },
  "required": [
    "proxy_type",
    "data"
  ]
}
```

## Country

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "maxLength": 10,
      "description": "Код страны ISO"
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Название страны"
    }
  },
  "required": [
    "code",
    "name"
  ]
}
```

## Region

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "maxLength": 10,
      "description": "Код региона или штата"
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Название региона или штата"
    },
    "country": {
      "$ref": "#/components/schemas/Country"
    }
  },
  "required": [
    "code",
    "name",
    "country"
  ]
}
```

## City

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "maxLength": 50,
      "description": "Код города, обычно в формате slug"
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Название города"
    },
    "country": {
      "$ref": "#/components/schemas/Country"
    },
    "region": {
      "type": "object",
      "nullable": true,
      "properties": {
        "code": {
          "type": "string",
          "maxLength": 10,
          "description": "Код региона"
        },
        "name": {
          "type": "string",
          "maxLength": 255,
          "description": "Название региона"
        }
      },
      "required": [
        "code",
        "name"
      ]
    }
  },
  "required": [
    "code",
    "name",
    "country"
  ]
}
```

## PagedCountriesResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Country"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## PagedRegionsResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Region"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## PagedCitiesResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/City"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## Isp

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Код интернет-провайдера, обычно в формате slug"
    },
    "name": {
      "type": "string",
      "description": "Имя интернет-провайдера"
    },
    "country": {
      "$ref": "#/components/schemas/Country"
    },
    "region": {
      "type": "object",
      "nullable": true,
      "properties": {
        "code": {
          "type": "string",
          "description": "Код региона"
        },
        "name": {
          "type": "string",
          "description": "Название региона"
        }
      },
      "required": [
        "code",
        "name"
      ]
    }
  },
  "required": [
    "code",
    "name",
    "country"
  ]
}
```

## PagedIspsResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Isp"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## CreateOrderAddonRequest

```json
{
  "type": "object",
  "properties": {
    "addon_key": {
      "type": "string",
      "example": "p0f_slots"
    },
    "qty": {
      "type": "integer",
      "minimum": 1
    }
  },
  "required": [
    "addon_key",
    "qty"
  ]
}
```
