{
  "openapi": "3.1.0",
  "info": {
    "title": "ПК «Лимит» — API",
    "description": "Серверная часть (К4) программного комплекса «Лимит». REST/HTTPS, JSON, OpenAPI 3.1 (ТЗ 4.1.5, Приложение Б). WebSocket-доставка: /v1/ws/agent, /v1/ws/parent.",
    "version": "0.1.0"
  },
  "paths": {
    "/v1/auth/register": {
      "post": {
        "tags": [
          "Аутентификация родителя"
        ],
        "summary": "Регистрация родителя по телефону или e-mail (ТЗ 4.1.2.1)",
        "operationId": "register_v1_auth_register_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Register V1 Auth Register Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/verify": {
      "post": {
        "tags": [
          "Аутентификация родителя"
        ],
        "summary": "Подтверждение регистрации кодом",
        "operationId": "verify_v1_auth_verify_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Verify V1 Auth Verify Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/login": {
      "post": {
        "tags": [
          "Аутентификация родителя"
        ],
        "summary": "Вход родителя",
        "operationId": "login_v1_auth_login_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPair"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/refresh": {
      "post": {
        "tags": [
          "Аутентификация родителя"
        ],
        "summary": "Обновление пары токенов (ротация refresh)",
        "operationId": "refresh_v1_auth_refresh_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPair"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/children": {
      "get": {
        "tags": [
          "Профили детей"
        ],
        "summary": "Список профилей семьи",
        "operationId": "list_children_v1_children_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ChildOut"
                  },
                  "type": "array",
                  "title": "Response List Children V1 Children Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Профили детей"
        ],
        "summary": "Создание профиля ребёнка (ТЗ 4.1.2.2)",
        "operationId": "create_child_v1_children_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChildIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChildOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/children/{child_id}": {
      "get": {
        "tags": [
          "Профили детей"
        ],
        "summary": "Профиль ребёнка",
        "operationId": "get_child_v1_children__child_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Child Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChildOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Профили детей"
        ],
        "summary": "Изменение профиля / режима лимита",
        "operationId": "update_child_v1_children__child_id__patch",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Child Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChildIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChildOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Профили детей"
        ],
        "summary": "Удаление профиля (только владелец, ТЗ 4.1.8)",
        "operationId": "delete_child_v1_children__child_id__delete",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Child Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Delete Child V1 Children  Child Id  Delete"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/pair": {
      "post": {
        "tags": [
          "Устройства"
        ],
        "summary": "Код привязки: 6 цифр, TTL 15 мин (ТЗ 4.1.2.2)",
        "operationId": "create_pairing_v1_devices_pair_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PairIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PairOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/devices/enroll": {
      "post": {
        "tags": [
          "Устройства"
        ],
        "summary": "Регистрация агента по коду привязки",
        "operationId": "enroll_v1_devices_enroll_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrollIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrollOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices": {
      "get": {
        "tags": [
          "Устройства"
        ],
        "summary": "Список устройств (профиля или семьи)",
        "operationId": "list_devices_v1_devices_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Child Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DeviceOut"
                  },
                  "title": "Response List Devices V1 Devices Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}": {
      "get": {
        "tags": [
          "Устройства"
        ],
        "summary": "Карточка устройства",
        "operationId": "get_device_v1_devices__device_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Устройства"
        ],
        "summary": "Отвязка устройства (агент снимает все ограничения)",
        "operationId": "unbind_device_v1_devices__device_id__delete",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Unbind Device V1 Devices  Device Id  Delete"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/token/rotate": {
      "post": {
        "tags": [
          "Устройства"
        ],
        "summary": "Ротация токена устройства (ТЗ 4.1.5)",
        "operationId": "rotate_token_v1_devices__device_id__token_rotate_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrollOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/children/{child_id}/policy": {
      "get": {
        "tags": [
          "Политики (П1–П11)"
        ],
        "summary": "Текущая политика профиля",
        "operationId": "get_policy_v1_children__child_id__policy_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Child Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Политики (П1–П11)"
        ],
        "summary": "Изменение политики родителем (доставка на онлайн-устройство ≤ 10 с, ТЗ 4.1.2.3)",
        "operationId": "update_policy_v1_children__child_id__policy_put",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Child Id"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Ожидаемая версия политики для оптимистической блокировки (ТЗ этап B5)",
              "title": "If-Match"
            },
            "description": "Ожидаемая версия политики для оптимистической блокировки (ТЗ этап B5)"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyData"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/policy": {
      "get": {
        "tags": [
          "Политики (П1–П11)"
        ],
        "summary": "Получение текущей политики агентом (ТЗ Приложение Б)",
        "operationId": "get_policy_for_agent_v1_devices__device_id__policy_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyForAgentOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/usage": {
      "post": {
        "tags": [
          "Статистика использования"
        ],
        "summary": "Пакетная отправка статистики (идемпотентно, ТЗ 4.1.5)",
        "operationId": "ingest_usage_v1_devices__device_id__usage_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UsageBatchIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageBatchOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/commands": {
      "post": {
        "tags": [
          "Команды"
        ],
        "summary": "Постановка команды в очередь: lock / unlock / bonus / policy_refresh / unbind (ТЗ П8, П9)",
        "operationId": "enqueue_command_v1_devices__device_id__commands_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommandIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Команды"
        ],
        "summary": "Получение очереди команд агентом",
        "operationId": "pull_commands_v1_devices__device_id__commands_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CommandOut"
                  },
                  "title": "Response Pull Commands V1 Devices  Device Id  Commands Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/commands/ack": {
      "post": {
        "tags": [
          "Команды"
        ],
        "summary": "Подтверждение выполнения команд агентом",
        "operationId": "ack_commands_v1_devices__device_id__commands_ack_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommandAckIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Ack Commands V1 Devices  Device Id  Commands Ack Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/state": {
      "get": {
        "tags": [
          "Команды"
        ],
        "summary": "Расчётное состояние устройства по политике (движок п. A15 плана)",
        "operationId": "device_state_parent_v1_devices__device_id__state_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceStateOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/offline-unlock": {
      "post": {
        "tags": [
          "Аварийная офлайн-разблокировка (ТЗ 4.2, И9)"
        ],
        "summary": "Выдать одноразовый код разблокировки, действующий без сети",
        "operationId": "issue_offline_unlock_v1_devices__device_id__offline_unlock_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfflineUnlockOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/devices/{device_id}/offline-unlock/report-used": {
      "post": {
        "tags": [
          "Аварийная офлайн-разблокировка (ТЗ 4.2, И9)"
        ],
        "summary": "Агент сообщает об использовании офлайн-кода (для журнала, ТЗ И9)",
        "operationId": "report_offline_unlock_used_v1_devices__device_id__offline_unlock_report_used_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Device Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OfflineUnlockReportIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Report Offline Unlock Used V1 Devices  Device Id  Offline Unlock Report Used Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/requests": {
      "post": {
        "tags": [
          "Запросы на продление (ТЗ 4.1.2.4)"
        ],
        "summary": "Запрос ребёнка на продление времени (5/15/30 мин)",
        "operationId": "create_request_v1_requests_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Запросы на продление (ТЗ 4.1.2.4)"
        ],
        "summary": "Список запросов семьи",
        "operationId": "list_requests_v1_requests_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/RequestStatus"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RequestOut"
                  },
                  "title": "Response List Requests V1 Requests Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/requests/{request_id}/approve": {
      "post": {
        "tags": [
          "Запросы на продление (ТЗ 4.1.2.4)"
        ],
        "summary": "Подтвердить продление",
        "operationId": "approve_request_v1_requests__request_id__approve_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Request Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/requests/{request_id}/reject": {
      "post": {
        "tags": [
          "Запросы на продление (ТЗ 4.1.2.4)"
        ],
        "summary": "Отклонить продление",
        "operationId": "reject_request_v1_requests__request_id__reject_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Request Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "post": {
        "tags": [
          "События безопасности"
        ],
        "summary": "Регистрация события безопасности агентом",
        "operationId": "report_event_v1_events_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "События безопасности"
        ],
        "summary": "Журнал событий безопасности семьи",
        "operationId": "list_events_v1_events_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Child Id"
            }
          },
          {
            "name": "device_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Device Id"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EventOut"
                  },
                  "title": "Response List Events V1 Events Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/{child_id}": {
      "get": {
        "tags": [
          "Отчётность (ТЗ 4.1.2.5)"
        ],
        "summary": "Отчёт за период: today | 7d | 30d",
        "operationId": "report_v1_reports__child_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "child_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Child Id"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "7d",
              "title": "Period"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/push/tokens": {
      "get": {
        "tags": [
          "Push-токены и уведомления"
        ],
        "summary": "Свои токены доставки",
        "operationId": "list_push_tokens_v1_push_tokens_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/PushTokenOut"
                  },
                  "type": "array",
                  "title": "Response List Push Tokens V1 Push Tokens Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Push-токены и уведомления"
        ],
        "summary": "Регистрация токена доставки push",
        "operationId": "register_push_token_v1_push_tokens_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushTokenIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushTokenOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/push/tokens/{token_id}": {
      "delete": {
        "tags": [
          "Push-токены и уведомления"
        ],
        "summary": "Удалить токен доставки",
        "operationId": "delete_push_token_v1_push_tokens__token_id__delete",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "token_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notifications": {
      "get": {
        "tags": [
          "Push-токены и уведомления"
        ],
        "summary": "Уведомления семьи (ТЗ 4.1.2.5)",
        "operationId": "list_notifications_v1_notifications_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "unread_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Unread Only"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NotificationOut"
                  },
                  "title": "Response List Notifications V1 Notifications Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notifications/{note_id}/read": {
      "post": {
        "tags": [
          "Push-токены и уведомления"
        ],
        "summary": "Отметить уведомление прочитанным",
        "operationId": "mark_read_v1_notifications__note_id__read_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "note_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Note Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Mark Read V1 Notifications  Note Id  Read Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notifications/read-all": {
      "post": {
        "tags": [
          "Push-токены и уведомления"
        ],
        "summary": "Отметить все уведомления прочитанными",
        "operationId": "mark_all_read_v1_notifications_read_all_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Mark All Read V1 Notifications Read All Post"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/audit": {
      "get": {
        "tags": [
          "Аудит (ТЗ этап B6)"
        ],
        "summary": "Журнал действий семьи (только владелец)",
        "operationId": "list_audit_v1_audit_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "default": 200,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AuditLogOut"
                  },
                  "title": "Response List Audit V1 Audit Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/export": {
      "get": {
        "tags": [
          "Управление аккаунтом (ТЗ 4.8.1)"
        ],
        "summary": "Выгрузка всех данных семьи (право на переносимость, ТЗ 4.8.1)",
        "operationId": "export_account_v1_account_export_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Export Account V1 Account Export Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/account": {
      "delete": {
        "tags": [
          "Управление аккаунтом (ТЗ 4.8.1)"
        ],
        "summary": "Удаление аккаунта со всеми данными (необратимо, только владелец)",
        "operationId": "delete_account_v1_account_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDeleteIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Delete Account V1 Account Delete"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/legal": {
      "get": {
        "tags": [
          "Юридические документы и согласие (ТЗ 4.8.1)"
        ],
        "summary": "Список юридических документов",
        "operationId": "legal_index_v1_legal_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Legal Index V1 Legal Get"
                }
              }
            }
          }
        }
      }
    },
    "/v1/legal/{slug}": {
      "get": {
        "tags": [
          "Юридические документы и согласие (ТЗ 4.8.1)"
        ],
        "summary": "Текст документа (публично)",
        "operationId": "legal_doc_v1_legal__slug__get",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Slug"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegalDocOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consent": {
      "get": {
        "tags": [
          "Юридические документы и согласие (ТЗ 4.8.1)"
        ],
        "summary": "Согласия текущего родителя",
        "operationId": "my_consents_v1_consent_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ConsentOut"
                  },
                  "type": "array",
                  "title": "Response My Consents V1 Consent Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Юридические документы и согласие (ТЗ 4.8.1)"
        ],
        "summary": "Дать или отозвать согласие",
        "operationId": "set_consent_v1_consent_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsentIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentOut"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/healthz": {
      "get": {
        "tags": [
          "Служебное"
        ],
        "summary": "Проба готовности",
        "operationId": "healthz_healthz_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Healthz Healthz Get"
                }
              }
            }
          }
        }
      }
    },
    "/metrics": {
      "get": {
        "tags": [
          "Служебное"
        ],
        "summary": "Метрики Prometheus",
        "operationId": "prometheus_metrics_metrics_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccessWindow": {
        "properties": {
          "days": {
            "items": {
              "type": "string",
              "enum": [
                "mon",
                "tue",
                "wed",
                "thu",
                "fri",
                "sat",
                "sun"
              ]
            },
            "type": "array",
            "minItems": 1,
            "title": "Days"
          },
          "start": {
            "type": "string",
            "title": "Start",
            "examples": [
              "07:00"
            ]
          },
          "end": {
            "type": "string",
            "title": "End",
            "examples": [
              "21:00"
            ]
          }
        },
        "type": "object",
        "required": [
          "days",
          "start",
          "end"
        ],
        "title": "AccessWindow"
      },
      "AccountDeleteIn": {
        "properties": {
          "password": {
            "type": "string",
            "title": "Password"
          },
          "confirm": {
            "type": "string",
            "enum": [
              "УДАЛИТЬ",
              "DELETE"
            ],
            "title": "Confirm"
          }
        },
        "type": "object",
        "required": [
          "password",
          "confirm"
        ],
        "title": "AccountDeleteIn"
      },
      "AppRule": {
        "properties": {
          "match": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "minProperties": 1,
            "title": "Match"
          },
          "type": {
            "type": "string",
            "enum": [
              "limit",
              "block",
              "exception",
              "whitelist",
              "whitelist_limited"
            ],
            "title": "Type"
          },
          "limit_minutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Minutes"
          }
        },
        "type": "object",
        "required": [
          "match",
          "type"
        ],
        "title": "AppRule"
      },
      "AuditLogOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "actor_type": {
            "type": "string",
            "title": "Actor Type"
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor Id"
          },
          "action": {
            "type": "string",
            "title": "Action"
          },
          "target": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target"
          },
          "ip": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip"
          },
          "data": {
            "type": "object",
            "title": "Data"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "actor_type",
          "actor_id",
          "action",
          "target",
          "ip",
          "data",
          "created_at"
        ],
        "title": "AuditLogOut"
      },
      "ChildIn": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "minLength": 1,
            "title": "Name"
          },
          "age": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 17.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Age"
          },
          "avatar": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar"
          },
          "limit_mode": {
            "$ref": "#/components/schemas/LimitMode",
            "default": "profile"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "ChildIn"
      },
      "ChildOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "age": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Age"
          },
          "avatar": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar"
          },
          "limit_mode": {
            "$ref": "#/components/schemas/LimitMode"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "age",
          "avatar",
          "limit_mode",
          "created_at"
        ],
        "title": "ChildOut"
      },
      "CommandAckIn": {
        "properties": {
          "command_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Command Ids"
          }
        },
        "type": "object",
        "required": [
          "command_ids"
        ],
        "title": "CommandAckIn"
      },
      "CommandIn": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/CommandType"
          },
          "payload": {
            "type": "object",
            "title": "Payload"
          },
          "idempotency_key": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80,
                "minLength": 8
              },
              {
                "type": "null"
              }
            ],
            "title": "Idempotency Key"
          }
        },
        "type": "object",
        "required": [
          "type"
        ],
        "title": "CommandIn"
      },
      "CommandOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "type": {
            "$ref": "#/components/schemas/CommandType"
          },
          "payload": {
            "type": "object",
            "title": "Payload"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "type",
          "payload",
          "status",
          "created_at",
          "expires_at"
        ],
        "title": "CommandOut"
      },
      "CommandType": {
        "type": "string",
        "enum": [
          "lock",
          "unlock",
          "bonus",
          "policy_refresh",
          "unbind"
        ],
        "title": "CommandType"
      },
      "ConsentIn": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "pdn",
              "terms"
            ],
            "title": "Kind",
            "default": "pdn"
          },
          "granted": {
            "type": "boolean",
            "title": "Granted",
            "default": true
          }
        },
        "type": "object",
        "title": "ConsentIn"
      },
      "ConsentOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "kind": {
            "type": "string",
            "title": "Kind"
          },
          "document_version": {
            "type": "string",
            "title": "Document Version"
          },
          "granted": {
            "type": "boolean",
            "title": "Granted"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "kind",
          "document_version",
          "granted",
          "revoked_at",
          "created_at"
        ],
        "title": "ConsentOut"
      },
      "DeviceKind": {
        "type": "string",
        "enum": [
          "android",
          "windows"
        ],
        "title": "DeviceKind"
      },
      "DeviceOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "kind": {
            "$ref": "#/components/schemas/DeviceKind"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model"
          },
          "os_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Os Version"
          },
          "agent_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Version"
          },
          "last_sync_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Sync At"
          },
          "battery_level": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Battery Level"
          },
          "protection_status": {
            "type": "string",
            "title": "Protection Status"
          },
          "online": {
            "type": "boolean",
            "title": "Online"
          },
          "unbound": {
            "type": "boolean",
            "title": "Unbound"
          }
        },
        "type": "object",
        "required": [
          "id",
          "child_id",
          "kind",
          "name",
          "model",
          "os_version",
          "agent_version",
          "last_sync_at",
          "battery_level",
          "protection_status",
          "online",
          "unbound"
        ],
        "title": "DeviceOut"
      },
      "DeviceStateOut": {
        "properties": {
          "device_id": {
            "type": "string",
            "title": "Device Id"
          },
          "state": {
            "type": "string",
            "enum": [
              "full_access",
              "restricted",
              "full_lock"
            ],
            "title": "State"
          },
          "reason": {
            "type": "string",
            "title": "Reason"
          },
          "remaining_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remaining Minutes"
          },
          "next_unlock_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Unlock At"
          },
          "server_time": {
            "type": "string",
            "format": "date-time",
            "title": "Server Time"
          }
        },
        "type": "object",
        "required": [
          "device_id",
          "state",
          "reason",
          "remaining_minutes",
          "next_unlock_at",
          "server_time"
        ],
        "title": "DeviceStateOut"
      },
      "EnrollIn": {
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 6,
            "minLength": 6,
            "title": "Code"
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model"
          },
          "os_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Os Version"
          },
          "agent_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Version"
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "EnrollIn"
      },
      "EnrollOut": {
        "properties": {
          "device_id": {
            "type": "string",
            "title": "Device Id"
          },
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "device_token": {
            "type": "string",
            "title": "Device Token"
          },
          "offline_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Offline Secret"
          },
          "offline_unlock_digits": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Offline Unlock Digits"
          },
          "server_time": {
            "type": "string",
            "format": "date-time",
            "title": "Server Time"
          }
        },
        "type": "object",
        "required": [
          "device_id",
          "child_id",
          "device_token",
          "server_time"
        ],
        "title": "EnrollOut"
      },
      "EventIn": {
        "properties": {
          "type": {
            "type": "string",
            "maxLength": 60,
            "title": "Type"
          },
          "severity": {
            "type": "string",
            "enum": [
              "info",
              "warning",
              "critical"
            ],
            "title": "Severity",
            "default": "warning"
          },
          "details": {
            "type": "object",
            "title": "Details"
          },
          "occurred_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Occurred At"
          }
        },
        "type": "object",
        "required": [
          "type"
        ],
        "title": "EventIn"
      },
      "EventOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "device_id": {
            "type": "string",
            "title": "Device Id"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "severity": {
            "type": "string",
            "title": "Severity"
          },
          "details": {
            "type": "object",
            "title": "Details"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "title": "Occurred At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "device_id",
          "type",
          "severity",
          "details",
          "occurred_at"
        ],
        "title": "EventOut"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "LegalDocOut": {
        "properties": {
          "slug": {
            "type": "string",
            "title": "Slug"
          },
          "version": {
            "type": "string",
            "title": "Version"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "content": {
            "type": "string",
            "title": "Content"
          }
        },
        "type": "object",
        "required": [
          "slug",
          "version",
          "title",
          "content"
        ],
        "title": "LegalDocOut"
      },
      "LimitMode": {
        "type": "string",
        "enum": [
          "profile",
          "per_device"
        ],
        "title": "LimitMode"
      },
      "LimitReachedAction": {
        "properties": {
          "daily_limit": {
            "type": "string",
            "enum": [
              "restricted",
              "full_lock",
              "warn_only"
            ],
            "title": "Daily Limit",
            "default": "restricted"
          },
          "night_mode": {
            "type": "string",
            "enum": [
              "restricted",
              "full_lock",
              "warn_only"
            ],
            "title": "Night Mode",
            "default": "full_lock"
          },
          "access_window": {
            "type": "string",
            "enum": [
              "restricted",
              "full_lock",
              "warn_only"
            ],
            "title": "Access Window",
            "default": "full_lock"
          }
        },
        "type": "object",
        "title": "LimitReachedAction"
      },
      "LoginIn": {
        "properties": {
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "password": {
            "type": "string",
            "title": "Password"
          }
        },
        "type": "object",
        "required": [
          "password"
        ],
        "title": "LoginIn"
      },
      "NotificationOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "severity": {
            "type": "string",
            "title": "Severity"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "body": {
            "type": "string",
            "title": "Body"
          },
          "data": {
            "type": "object",
            "title": "Data"
          },
          "child_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Child Id"
          },
          "device_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Device Id"
          },
          "read": {
            "type": "boolean",
            "title": "Read"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "type",
          "severity",
          "title",
          "body",
          "data",
          "child_id",
          "device_id",
          "read",
          "created_at"
        ],
        "title": "NotificationOut"
      },
      "OfflineUnlockOut": {
        "properties": {
          "device_id": {
            "type": "string",
            "title": "Device Id"
          },
          "code": {
            "type": "string",
            "title": "Code"
          },
          "counter": {
            "type": "integer",
            "title": "Counter"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At"
          },
          "note": {
            "type": "string",
            "title": "Note",
            "default": "Код вводится на устройстве ребёнка при полностью отсутствующей сети; агент проверяет его по секрету, полученному при установке."
          }
        },
        "type": "object",
        "required": [
          "device_id",
          "code",
          "counter",
          "expires_at"
        ],
        "title": "OfflineUnlockOut"
      },
      "OfflineUnlockReportIn": {
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 10,
            "minLength": 6,
            "title": "Code"
          },
          "used_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Used At"
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "OfflineUnlockReportIn"
      },
      "PairIn": {
        "properties": {
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "kind": {
            "$ref": "#/components/schemas/DeviceKind"
          },
          "device_name": {
            "type": "string",
            "title": "Device Name",
            "default": "Устройство"
          }
        },
        "type": "object",
        "required": [
          "child_id",
          "kind"
        ],
        "title": "PairIn"
      },
      "PairOut": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "qr_payload": {
            "type": "string",
            "title": "Qr Payload"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "code",
          "qr_payload",
          "expires_at"
        ],
        "title": "PairOut"
      },
      "PolicyData": {
        "properties": {
          "daily_limit_minutes": {
            "type": "integer",
            "multipleOf": 15.0,
            "minimum": 0.0,
            "title": "Daily Limit Minutes",
            "default": 120
          },
          "per_weekday_minutes": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Per Weekday Minutes"
          },
          "access_windows": {
            "items": {
              "$ref": "#/components/schemas/AccessWindow"
            },
            "type": "array",
            "title": "Access Windows"
          },
          "night_mode": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Night Mode"
          },
          "app_rules": {
            "items": {
              "$ref": "#/components/schemas/AppRule"
            },
            "type": "array",
            "title": "App Rules"
          },
          "limit_reached_action": {
            "$ref": "#/components/schemas/LimitReachedAction"
          },
          "restricted_mode": {
            "type": "object",
            "title": "Restricted Mode"
          },
          "extension_requests": {
            "type": "object",
            "title": "Extension Requests"
          }
        },
        "type": "object",
        "title": "PolicyData"
      },
      "PolicyForAgentOut": {
        "properties": {
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "version": {
            "type": "integer",
            "title": "Version"
          },
          "data": {
            "$ref": "#/components/schemas/PolicyData"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          },
          "server_time": {
            "type": "string",
            "format": "date-time",
            "title": "Server Time"
          }
        },
        "type": "object",
        "required": [
          "child_id",
          "version",
          "data",
          "updated_at",
          "server_time"
        ],
        "title": "PolicyForAgentOut"
      },
      "PolicyOut": {
        "properties": {
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "version": {
            "type": "integer",
            "title": "Version"
          },
          "data": {
            "$ref": "#/components/schemas/PolicyData"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "child_id",
          "version",
          "data",
          "updated_at"
        ],
        "title": "PolicyOut"
      },
      "PushTokenIn": {
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "rustore",
              "fcm",
              "hms",
              "websocket"
            ],
            "title": "Platform"
          },
          "token": {
            "type": "string",
            "maxLength": 512,
            "minLength": 1,
            "title": "Token"
          }
        },
        "type": "object",
        "required": [
          "platform",
          "token"
        ],
        "title": "PushTokenIn"
      },
      "PushTokenOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "platform": {
            "type": "string",
            "title": "Platform"
          },
          "disabled": {
            "type": "boolean",
            "title": "Disabled"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "platform",
          "disabled",
          "created_at"
        ],
        "title": "PushTokenOut"
      },
      "RefreshIn": {
        "properties": {
          "refresh_token": {
            "type": "string",
            "title": "Refresh Token"
          }
        },
        "type": "object",
        "required": [
          "refresh_token"
        ],
        "title": "RefreshIn"
      },
      "RegisterIn": {
        "properties": {
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone",
            "examples": [
              "+79990001122"
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email",
            "examples": [
              "parent@example.com"
            ]
          },
          "password": {
            "type": "string",
            "maxLength": 128,
            "minLength": 8,
            "title": "Password"
          },
          "display_name": {
            "type": "string",
            "title": "Display Name",
            "default": "Родитель"
          },
          "family_name": {
            "type": "string",
            "title": "Family Name",
            "default": "Моя семья"
          },
          "consent_accepted": {
            "type": "boolean",
            "title": "Consent Accepted",
            "description": "Согласие с политикой конфиденциальности и обработкой ПДн"
          }
        },
        "type": "object",
        "required": [
          "password",
          "consent_accepted"
        ],
        "title": "RegisterIn"
      },
      "ReportOut": {
        "properties": {
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "period": {
            "type": "string",
            "title": "Period"
          },
          "date_from": {
            "type": "string",
            "format": "date",
            "title": "Date From"
          },
          "date_to": {
            "type": "string",
            "format": "date",
            "title": "Date To"
          },
          "total_seconds": {
            "type": "integer",
            "title": "Total Seconds"
          },
          "restricted_seconds": {
            "type": "integer",
            "title": "Restricted Seconds"
          },
          "avg_seconds_per_day": {
            "type": "integer",
            "title": "Avg Seconds Per Day"
          },
          "by_day": {
            "items": {
              "type": "object"
            },
            "type": "array",
            "title": "By Day"
          },
          "by_app": {
            "items": {
              "type": "object"
            },
            "type": "array",
            "title": "By App"
          },
          "top5": {
            "items": {
              "type": "object"
            },
            "type": "array",
            "title": "Top5"
          },
          "exceed_count": {
            "type": "integer",
            "title": "Exceed Count"
          },
          "extensions_count": {
            "type": "integer",
            "title": "Extensions Count"
          },
          "extensions_minutes": {
            "type": "integer",
            "title": "Extensions Minutes"
          }
        },
        "type": "object",
        "required": [
          "child_id",
          "period",
          "date_from",
          "date_to",
          "total_seconds",
          "restricted_seconds",
          "avg_seconds_per_day",
          "by_day",
          "by_app",
          "top5",
          "exceed_count",
          "extensions_count",
          "extensions_minutes"
        ],
        "title": "ReportOut"
      },
      "RequestIn": {
        "properties": {
          "duration_min": {
            "type": "integer",
            "enum": [
              5,
              15,
              30
            ],
            "title": "Duration Min"
          },
          "comment": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "title": "Comment"
          }
        },
        "type": "object",
        "required": [
          "duration_min"
        ],
        "title": "RequestIn"
      },
      "RequestOut": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "device_id": {
            "type": "string",
            "title": "Device Id"
          },
          "child_id": {
            "type": "string",
            "title": "Child Id"
          },
          "duration_min": {
            "type": "integer",
            "title": "Duration Min"
          },
          "comment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Comment"
          },
          "status": {
            "$ref": "#/components/schemas/RequestStatus"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "device_id",
          "child_id",
          "duration_min",
          "comment",
          "status",
          "created_at"
        ],
        "title": "RequestOut"
      },
      "RequestStatus": {
        "type": "string",
        "enum": [
          "pending",
          "approved",
          "rejected"
        ],
        "title": "RequestStatus"
      },
      "TokenPair": {
        "properties": {
          "access_token": {
            "type": "string",
            "title": "Access Token"
          },
          "refresh_token": {
            "type": "string",
            "title": "Refresh Token"
          },
          "token_type": {
            "type": "string",
            "title": "Token Type",
            "default": "bearer"
          },
          "expires_in": {
            "type": "integer",
            "title": "Expires In"
          }
        },
        "type": "object",
        "required": [
          "access_token",
          "refresh_token",
          "expires_in"
        ],
        "title": "TokenPair"
      },
      "UsageBatchIn": {
        "properties": {
          "idempotency_key": {
            "type": "string",
            "maxLength": 80,
            "minLength": 8,
            "title": "Idempotency Key"
          },
          "battery_level": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 100.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Battery Level"
          },
          "agent_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Version"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/UsageItem"
            },
            "type": "array",
            "title": "Items"
          }
        },
        "type": "object",
        "required": [
          "idempotency_key",
          "items"
        ],
        "title": "UsageBatchIn"
      },
      "UsageBatchOut": {
        "properties": {
          "accepted": {
            "type": "boolean",
            "title": "Accepted"
          },
          "duplicate": {
            "type": "boolean",
            "title": "Duplicate"
          },
          "items_stored": {
            "type": "integer",
            "title": "Items Stored"
          }
        },
        "type": "object",
        "required": [
          "accepted",
          "duplicate",
          "items_stored"
        ],
        "title": "UsageBatchOut"
      },
      "UsageItem": {
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "title": "Date"
          },
          "app_id": {
            "type": "string",
            "title": "App Id",
            "default": ""
          },
          "app_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "App Name"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "seconds": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Seconds"
          },
          "restricted_seconds": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Restricted Seconds",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "date",
          "seconds"
        ],
        "title": "UsageItem"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VerifyIn": {
        "properties": {
          "parent_id": {
            "type": "string",
            "title": "Parent Id"
          },
          "code": {
            "type": "string",
            "title": "Code"
          }
        },
        "type": "object",
        "required": [
          "parent_id",
          "code"
        ],
        "title": "VerifyIn"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}