{
  "openapi": "3.1.0",
  "info": {
    "title": "Kosmodrom Backend API",
    "version": "1.2.1571",
    "description": "### Kosmodrom Backend API\n\nАвтогенерация из **runtime** `endpoint` + `Valid` + `Entity.schema`.\nEnums и поля **не пишутся вручную**.\n\n#### Быстрые ссылки\n\n| Ресурс | URL |\n|--------|-----|\n| **Scalar UI** | `/docs` |\n| **Копировать TypeScript типы** | [`/docs/types`](/docs/types) |\n| **Auth playground** (подпись sig) | [`/docs/auth`](/docs/auth) |\n| **Raw api-types.ts** | [`/docs/api-types.ts`](/docs/api-types.ts) |\n| **OpenAPI JSON** | [`/docs/json`](/docs/json) |\n| **Client SDK** | `_dist/client/kosmodrom-client.ts` + `api.generated.ts` |\n| **Postman** | `_dist/postman/kosmodrom-api.postman_collection.json` |\n| **Bruno** | `_dist/bruno/` |\n\nУ каждой операции ниже — блок **TypeScript (copy-paste)** с Params / Body / Response.\n\nКлиент: `createKosmodromClient` сам выставляет headers и `sig`.\n\n### HTTP method\n\nЕсли у endpoint **не задан** `method`, runtime **не проверяет** HTTP-метод (принимает любой).\nВ этой спеке для удобства: **есть body → POST**, иначе **GET**. Для Try it это ориентир, не жёсткий контракт.\n\n---\n\n### Формирование запросов\n\nОбязательные headers (все команды):\n\n| Header | Тип | Описание |\n|--------|-----|----------|\n| `devID` | uuid | ID устройства (генерируется один раз) |\n| `tz` | string | Таймзона клиента |\n| `app` | string | Имя клиентского приложения |\n| `appVer` | string | Версия клиента |\n| `rKey` | string | (опц.) ключ запроса: `Date.now() + '-' + uuid()` |\n\nПараметры endpoint могут передаваться **query** и/или **headers** (сервер мержит оба источника).\n\n### Ответ (всегда обёртка)\n\n```ts\ninterface IServerResponse<T> {\n  code: number      // = HTTP status\n  data: T           // payload или ошибка\n  srvTS: number     // server time ms\n  rkey: string      // request key\n}\n```\n\nВ Scalar смотрите **Responses → 200 → Example** и schema `data`.\n\n### Аутентификация (Session Signature)\n\nДля `authorized` / `administrator` заполните в Scalar: **sid**, **rts**, **sig**.\n\n| Header | Описание |\n|--------|----------|\n| `sid` | ID сессии (из signin/auth) |\n| `rts` | серверное время по мнению клиента (ms) |\n| `sig` | подпись запроса |\n\nСхема подписи — `hmac-sha256-v2`: `secretToken` является КЛЮЧОМ HMAC и на провод не уходит.\nТест-векторы: `protocol/vectors/signature.json`.\n\n```ts\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n  // location — нормализованный путь без ведущего /, напр. projects/task/create\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}\n```\n\n### AccessType\n\n| Значение | Смысл |\n|----------|--------|\n| 0 unauthorized | без сессии |\n| 10 authorized | любой пользователь сессии |\n| 100 administrator | админ компании |\n\n### Типичные HTTP-коды\n\n| Code | Смысл |\n|------|--------|\n| 400 | BadRequest / Validation |\n| 401 | Authorize — сессия истекла |\n| 403 | AccessNotAllowed |\n| 404 | NotFound |\n| 406 | TimeResync — скорректировать delta времени |\n| 422 | UnprocessableContent |\n| 500 | ServerError |\n"
  },
  "servers": [
    {
      "url": "http://localhost",
      "description": "Local / default (path = endpoint location)"
    }
  ],
  "tags": [
    {
      "name": "AgentMemory"
    },
    {
      "name": "Auth"
    },
    {
      "name": "CI/CD Utilities"
    },
    {
      "name": "Chat"
    },
    {
      "name": "Chat: Messages"
    },
    {
      "name": "Company"
    },
    {
      "name": "Company: Access"
    },
    {
      "name": "Company: Team"
    },
    {
      "name": "Costs"
    },
    {
      "name": "Currency"
    },
    {
      "name": "Design"
    },
    {
      "name": "Features"
    },
    {
      "name": "Files"
    },
    {
      "name": "Integrations: Figma"
    },
    {
      "name": "Integrations: Git"
    },
    {
      "name": "Integrations: Meetings"
    },
    {
      "name": "Iterations"
    },
    {
      "name": "LLM Functions"
    },
    {
      "name": "Meetings"
    },
    {
      "name": "Notifications"
    },
    {
      "name": "Projects"
    },
    {
      "name": "Projects: Components"
    },
    {
      "name": "Projects: Features"
    },
    {
      "name": "Projects: Modules"
    },
    {
      "name": "Projects: Products"
    },
    {
      "name": "Projects: Tasks"
    },
    {
      "name": "Projects: Versions"
    },
    {
      "name": "Relations"
    },
    {
      "name": "SSE"
    },
    {
      "name": "States"
    },
    {
      "name": "States: Editor"
    },
    {
      "name": "System"
    },
    {
      "name": "Team: Payments"
    },
    {
      "name": "Team: Roles"
    },
    {
      "name": "Team: Timeoff"
    },
    {
      "name": "Testkit"
    },
    {
      "name": "Users"
    },
    {
      "name": "Users: API Tokens"
    },
    {
      "name": "Worklogs"
    }
  ],
  "paths": {
    "/worklogs/delete": {
      "get": {
        "operationId": "worklogs_delete",
        "summary": "🔒 Удаление записи ворклога.",
        "description": "Удаление записи ворклога.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `worklog:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /worklogs/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface WorklogsDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type WorklogsDeleteResponse = IServerResponse<WorkLog>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Worklogs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<WorkLog>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/WorkLog"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "taskID": "00000000-0000-4000-8000-000000000001",
                    "meetingID": "00000000-0000-4000-8000-000000000001",
                    "category": 1,
                    "status": 0,
                    "sessID": "00000000-0000-4000-8000-000000000001",
                    "userID": "00000000-0000-4000-8000-000000000001",
                    "roleID": "00000000-0000-4000-8000-000000000001",
                    "roleType": 10,
                    "iterationKey": 0,
                    "isActive": false,
                    "daykey": 0,
                    "startDt": "2026-01-15T12:00:00.000Z",
                    "endDt": "2026-01-15T12:00:00.000Z",
                    "time": 0,
                    "money": 0,
                    "moneySalary": 0,
                    "moneyAward": 0,
                    "note": {},
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege worklog:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege worklog:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Worklog with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Worklog with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: WorklogsDeleteResponse = IServerResponse<WorkLog>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/worklogs/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'worklogs/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<WorkLog>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/worklogs/roles": {
      "get": {
        "operationId": "worklogs_roles",
        "summary": "🔒 Получение статистики и ворклогов по ролям для указанной сущности.",
        "description": "Получение статистики и ворклогов по ролям для указанной сущности.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `product:read`, `version:read`, `feature:read`, `meeting:read`, `task:costs`, `feature:costs`, `version:costs`, `product:costs`, `meeting:costs`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /worklogs/roles`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface WorklogsRolesParams {\n  ID: string\n  type: SystemEntityType\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type WorklogsRolesResponse = IServerResponse<Resp_worklogs_roles>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Worklogs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/SystemEntityType"
            },
            "example": "project"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_worklogs_roles>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_worklogs_roles"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "groups": [
                      null
                    ],
                    "timeSpent": 0,
                    "moneySpent": 0,
                    "lastDt": "2026-01-15T12:00:00.000Z"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: WorklogsRolesResponse = IServerResponse<Resp_worklogs_roles>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/worklogs/roles?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'worklogs/roles', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_worklogs_roles>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/worklogs/status": {
      "get": {
        "operationId": "worklogs_status",
        "summary": "🔒 Получение статистики и ворклогов по статусам для указанной сущности.",
        "description": "Получение статистики и ворклогов по статусам для указанной сущности.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `task:read`, `product:read`, `version:read`, `feature:read`, `meeting:read`, `task:costs`, `feature:costs`, `version:costs`, `product:costs`, `meeting:costs`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /worklogs/status`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface WorklogsStatusParams {\n  ID: string\n  type: SystemEntityType\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type WorklogsStatusResponse = IServerResponse<Resp_worklogs_status>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Worklogs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/SystemEntityType"
            },
            "example": "project"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_worklogs_status>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_worklogs_status"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "groups": [
                      null
                    ],
                    "timeSpent": 0,
                    "moneySpent": 0,
                    "lastDt": "2026-01-15T12:00:00.000Z"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Company context required for non-meeting entities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Company context required for non-meeting entities",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: WorklogsStatusResponse = IServerResponse<Resp_worklogs_status>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/worklogs/status?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'worklogs/status', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_worklogs_status>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/worklogs/update": {
      "post": {
        "operationId": "worklogs_update",
        "summary": "🔒 Обновление записей ворклогов (времени и заметок) пользователя.",
        "description": "Обновление записей ворклогов (времени и заметок) пользователя.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `worklog:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /worklogs/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface WorklogsUpdateParams {\n  userID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type WorklogsUpdateBody = Partial<Resp_worklogs_update>\n\nexport interface WorklogsUpdateBodyFields {\n  select?: {\n  entityID?: string | null\n  entityType?: SystemEntityType | null\n  worklogID?: string | null\n  startDk?: number | null\n  endDk?: number | null\n  roleType?: UserRole_Type | null\n}\n  update?: {\n  time?: number | null\n  note?: string | null\n}\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type WorklogsUpdateResponse = IServerResponse<Resp_worklogs_update>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Worklogs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_worklogs_update>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_worklogs_update"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: No update data provided, invalid time value, or missing worklogID for time update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: No update data provided, invalid time value, or missing worklogID for time update",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege worklog:update required (own worklogs - common)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege worklog:update required (own worklogs - common)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user or worklogs matching selection criteria not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user or worklogs matching selection criteria not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: WorklogsUpdateResponse = IServerResponse<Resp_worklogs_update>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/worklogs/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'worklogs/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_worklogs_update>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorklogsUpdateBody"
              },
              "example": {
                "select": {
                  "entityID": "00000000-0000-4000-8000-000000000001",
                  "entityType": "project",
                  "worklogID": "00000000-0000-4000-8000-000000000001",
                  "startDk": 0,
                  "endDk": 0,
                  "roleType": 10
                },
                "update": {
                  "time": 0,
                  "note": "string"
                }
              }
            }
          }
        }
      }
    },
    "/user/token/create": {
      "post": {
        "operationId": "user_token_create",
        "summary": "🔒 Выдача персонального API-токена (PAT) для доступа агентов/интеграций от имени пользователя. Сырой токен возвращается только один раз.",
        "description": "Выдача персонального API-токена (PAT) для доступа агентов/интеграций от имени пользователя. Сырой токен возвращается только один раз.\n\n**Access:** `authorized` (10 ) · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `user:ai-tokens` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /user/token/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface UserTokenCreateBody {\n  title: string\n  /** Day key (YYYYMMDD or internal day index) */\n  expDayKey?: number | null\n  scopes?: Array<any> | null\n  cID?: string | null\n  type?: ApiToken_type | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserTokenCreateResponse = IServerResponse<Resp_user_token_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users: API Tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_token_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_token_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "token": "string",
                    "item": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserTokenCreateResponse = IServerResponse<Resp_user_token_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/token/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/token/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_token_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserTokenCreateBody"
              },
              "example": {
                "title": "string",
                "expDayKey": 0,
                "scopes": [
                  {}
                ],
                "cID": "00000000-0000-4000-8000-000000000001",
                "type": "agent"
              }
            }
          }
        }
      }
    },
    "/user/token/list": {
      "get": {
        "operationId": "user_token_list",
        "summary": "🔒 Действующие доступы пользователя - персональные токены (PAT) и подключения ИИ-приложений: свои или другого сотрудника компании по user:ai-tokens к нему. Отозванные токены и подключения с истёкшим refresh-токеном не возвращаются; хэшей в ответе нет - сырой токен восстановить нельзя.",
        "description": "Действующие доступы пользователя - персональные токены (PAT) и подключения ИИ-приложений: свои или другого сотрудника компании по user:ai-tokens к нему. Отозванные токены и подключения с истёкшим refresh-токеном не возвращаются; хэшей в ответе нет - сырой токен восстановить нельзя.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:ai-tokens` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /user/token/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserTokenListParams {\n  userID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserTokenListResponse = IServerResponse<Resp_user_token_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users: API Tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_token_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_token_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      null
                    ],
                    "companies": [
                      {
                        "ID": null,
                        "title": null,
                        "logoFID": null,
                        "phone": null,
                        "email": null,
                        "url": null,
                        "description": null,
                        "address": null,
                        "foundationDT": null,
                        "country": null,
                        "defaultMarginPercent": null,
                        "demoSet": null,
                        "testSlot": null,
                        "agentPrices": null,
                        "docs": null,
                        "timeZone": null,
                        "language": null,
                        "activityType": null,
                        "activityDescription": null,
                        "titleHash": null,
                        "updTS": null,
                        "updUID": null,
                        "createDT": null,
                        "createUID": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:ai-tokens required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:ai-tokens required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserTokenListResponse = IServerResponse<Resp_user_token_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/token/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/token/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_token_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/token/revoke": {
      "get": {
        "operationId": "user_token_revoke",
        "summary": "🔒 Отзыв API-токена: своего или другого сотрудника компании по user:ai-tokens к нему. Отозванный токен перестает приниматься немедленно.",
        "description": "Отзыв API-токена: своего или другого сотрудника компании по user:ai-tokens к нему. Отозванный токен перестает приниматься немедленно.\n\n**Access:** `authorized` (10 ) · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `user:ai-tokens` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /user/token/revoke`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserTokenRevokeParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserTokenRevokeResponse = IServerResponse<Resp_user_token_revoke>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users: API Tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_token_revoke>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_token_revoke"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "item": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:ai-tokens required (token of another user)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:ai-tokens required (token of another user)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Token with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Token with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserTokenRevokeResponse = IServerResponse<Resp_user_token_revoke>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/token/revoke?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/token/revoke', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_token_revoke>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/provider/complete": {
      "post": {
        "operationId": "user_provider_complete",
        "summary": "🔒 #26810 Привязка VK ID или Яндекс ID к своей учётной записи по одноразовому билету адреса возврата. Аккаунт провайдера, привязанный к другой записи, не привязывается.",
        "description": "#26810 Привязка VK ID или Яндекс ID к своей учётной записи по одноразовому билету адреса возврата. Аккаунт провайдера, привязанный к другой записи, не привязывается.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own sign-in methods\n\n### TypeScript (copy-paste)\n\n**`POST /user/provider/complete`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface UserProviderCompleteBody {\n  ticket: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserProviderCompleteResponse = IServerResponse<Resp_user_provider_complete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_provider_complete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_provider_complete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "currentUser": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - provider_ticket (ticket unknown, expired, used, issued for another device or user)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - provider_ticket (ticket unknown, expired, used, issued for another device or user)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - provider_taken, demo_contact_locked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - provider_taken, demo_contact_locked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserProviderCompleteResponse = IServerResponse<Resp_user_provider_complete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/provider/complete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/provider/complete', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_provider_complete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserProviderCompleteBody"
              },
              "example": {
                "ticket": "string"
              }
            }
          }
        }
      }
    },
    "/user/provider/link": {
      "post": {
        "operationId": "user_provider_link",
        "summary": "🔒 #26810 Начало привязки VK ID или Яндекс ID к своей учётной записи: адрес провайдера. Завершение - этой же учётной записью на устройстве, начавшем привязку (`user/provider/complete`).",
        "description": "#26810 Начало привязки VK ID или Яндекс ID к своей учётной записи: адрес провайдера. Завершение - этой же учётной записью на устройстве, начавшем привязку (`user/provider/complete`).\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own sign-in methods\n\n### TypeScript (copy-paste)\n\n**`POST /user/provider/link`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface UserProviderLinkBody {\n  provider: User_Provider\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserProviderLinkResponse = IServerResponse<Resp_user_provider_link>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_provider_link>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_provider_link"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "url": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - provider_disabled, demo_contact_locked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - provider_disabled, demo_contact_locked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserProviderLinkResponse = IServerResponse<Resp_user_provider_link>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/provider/link?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/provider/link', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_provider_link>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserProviderLinkBody"
              },
              "example": {
                "provider": "vkid"
              }
            }
          }
        }
      }
    },
    "/user/provider/unlink": {
      "get": {
        "operationId": "user_provider_unlink",
        "summary": "🔒 #26810 Отвязка VK ID или Яндекс ID от своей учётной записи. Последний способ входа отвязать нельзя.",
        "description": "#26810 Отвязка VK ID или Яндекс ID от своей учётной записи. Последний способ входа отвязать нельзя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own sign-in methods\n\n### TypeScript (copy-paste)\n\n**`GET /user/provider/unlink`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserProviderUnlinkParams {\n  provider: User_Provider\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserProviderUnlinkResponse = IServerResponse<Resp_user_provider_unlink>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "description": "Можно передать header `provider` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/User_Provider"
            },
            "example": "vkid"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_provider_unlink>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_provider_unlink"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "currentUser": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - last_sign_in_method, demo_contact_locked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - last_sign_in_method, demo_contact_locked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserProviderUnlinkResponse = IServerResponse<Resp_user_provider_unlink>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/provider/unlink?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/provider/unlink', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_provider_unlink>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/contact/code": {
      "get": {
        "operationId": "user_contact_code",
        "summary": "🔒 #26729 Код подтверждения телефона или email своей учётной записи: привязка, смена, второй контакт при регистрации. Контакт другой записи отклоняется до отправки кода. Код действует 5 минут; прежний контакт действует до подтверждения нового.",
        "description": "#26729 Код подтверждения телефона или email своей учётной записи: привязка, смена, второй контакт при регистрации. Контакт другой записи отклоняется до отправки кода. Код действует 5 минут; прежний контакт действует до подтверждения нового.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own sign-in contacts, confirmed by a code sent to the contact itself\n\n### TypeScript (copy-paste)\n\n**`GET /user/contact/code`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserContactCodeParams {\n  kind: user_contact_code_kind\n  value: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserContactCodeResponse = IServerResponse<Resp_user_contact_code>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "description": "Можно передать header `kind` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/user_contact_code_kind"
            },
            "example": "phone"
          },
          {
            "name": "value",
            "in": "query",
            "required": true,
            "description": "Можно передать header `value` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_contact_code>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_contact_code"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "codeStatus": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: invalid phone or email",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: invalid phone or email",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Request limit exceeded (100 requests per day); params.code - contact_taken, contact_confirmed (already confirmed), code_already_sent, code_requests_exceeded, code_send_failed, email_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Request limit exceeded (100 requests per day); params.code - contact_taken, contact_confirmed (already confirmed), code_already_sent, code_requests_exceeded, code_send_failed, email_unavailable",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserContactCodeResponse = IServerResponse<Resp_user_contact_code>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/contact/code?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/contact/code', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_contact_code>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/contact/confirm": {
      "get": {
        "operationId": "user_contact_confirm",
        "summary": "🔒 #26729 Подтверждение телефона или email своей учётной записи кодом: контакт записывается и отмечается подтверждённым (прежнее значение заменяется). Код принимается только от того, кто его запросил.",
        "description": "#26729 Подтверждение телефона или email своей учётной записи кодом: контакт записывается и отмечается подтверждённым (прежнее значение заменяется). Код принимается только от того, кто его запросил.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own sign-in contacts, confirmed by a code sent to the contact itself\n\n### TypeScript (copy-paste)\n\n**`GET /user/contact/confirm`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserContactConfirmParams {\n  kind: user_contact_code_kind\n  value: string\n  code: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserContactConfirmResponse = IServerResponse<Resp_user_contact_confirm>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "description": "Можно передать header `kind` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/user_contact_code_kind"
            },
            "example": "phone"
          },
          {
            "name": "value",
            "in": "query",
            "required": true,
            "description": "Можно передать header `value` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "Можно передать header `code` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_contact_confirm>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_contact_confirm"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "currentUser": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: params.code - code_wrong",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: params.code - code_wrong",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - code_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - code_not_found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - contact_taken, code_attempts_exceeded, code_daily_exceeded, code_ip_blocked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - contact_taken, code_attempts_exceeded, code_daily_exceeded, code_ip_blocked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserContactConfirmResponse = IServerResponse<Resp_user_contact_confirm>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/contact/confirm?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/contact/confirm', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_contact_confirm>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/contact/unlink": {
      "get": {
        "operationId": "user_contact_unlink",
        "summary": "🔒 #26729 Отвязка телефона или email своей учётной записи. Последний способ входа (#26810 - вместе с VK ID и Яндекс ID) отвязать нельзя.",
        "description": "#26729 Отвязка телефона или email своей учётной записи. Последний способ входа (#26810 - вместе с VK ID и Яндекс ID) отвязать нельзя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own sign-in contacts\n\n### TypeScript (copy-paste)\n\n**`GET /user/contact/unlink`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserContactUnlinkParams {\n  kind: user_contact_code_kind\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserContactUnlinkResponse = IServerResponse<Resp_user_contact_unlink>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "description": "Можно передать header `kind` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/user_contact_code_kind"
            },
            "example": "phone"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_contact_unlink>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_contact_unlink"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "currentUser": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - last_sign_in_method",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - last_sign_in_method",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserContactUnlinkResponse = IServerResponse<Resp_user_contact_unlink>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/contact/unlink?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/contact/unlink', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_contact_unlink>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/archive-file": {
      "get": {
        "operationId": "user_archive-file",
        "summary": "🔒 Скачивание ZIP-архива с документами пользователя (паспорт, удостоверение, военный билет и т.д.).",
        "description": "Скачивание ZIP-архива с документами пользователя (паспорт, удостоверение, военный билет и т.д.).\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `user:documents` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /user/archive-file`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserArchiveFileParams {\n  userID: string\n  docsEmployment?: user_archive_file_docsEmployment | null\n  docsLibrary?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserArchiveFileResponse = IServerResponse<Resp_user_archive-file>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "docsEmployment",
            "in": "query",
            "required": false,
            "description": "Можно передать header `docsEmployment` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/user_archive_file_docsEmployment"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "passportRf"
          },
          {
            "name": "docsLibrary",
            "in": "query",
            "required": false,
            "description": "Можно передать header `docsLibrary` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_archive-file>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_archive-file"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required parameters missing (docsEmployment or docsLibrary), or no files attached to specified document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required parameters missing (docsEmployment or docsLibrary), or no files attached to specified document",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:documents required; documents of a user without active access to the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:documents required; documents of a user without active access to the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified user profile does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified user profile does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserArchiveFileResponse = IServerResponse<Resp_user_archive-file>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/archive-file?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/archive-file', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_archive-file>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/check": {
      "get": {
        "operationId": "user_check",
        "summary": "🔒 Проверка доступности телефона или email для нового пользователя.",
        "description": "Проверка доступности телефона или email для нового пользователя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** не требуются — phone and email availability check during sign-up and profile editing, rate-limited\n\n### TypeScript (copy-paste)\n\n**`GET /user/check`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserCheckParams {\n  /** Phone number */\n  phone?: string | null\n  email?: string | null\n  zoomEmail?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserCheckResponse = IServerResponse<Resp_user_check>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "Можно передать header `phone` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "description": "Phone number"
            },
            "example": "string"
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Можно передать header `email` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "email"
            },
            "example": "user@example.com"
          },
          {
            "name": "zoomEmail",
            "in": "query",
            "required": false,
            "description": "Можно передать header `zoomEmail` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "email"
            },
            "example": "user@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_check>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_check"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ok": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: At least one of phone or email query parameters must be provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: At least one of phone or email query parameters must be provided",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "429": {
            "description": "TooManyRequests: Rate limit exceeded for check availability requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 429,
                  "data": {
                    "err": "TooManyRequests: Rate limit exceeded for check availability requests",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserCheckResponse = IServerResponse<Resp_user_check>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/check?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/check', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_check>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/create": {
      "post": {
        "operationId": "user_create",
        "summary": "🔒 Создание нового пользователя (черновика).",
        "description": "Создание нового пользователя (черновика).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /user/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type UserCreateBody = Partial<Resp_user_create>\n\nexport interface UserCreateBodyFields {\n  ID?: string\n  /** Phone number */\n  phone?: string | null\n  email?: string | null\n  auth?: Record<string, any> | null\n  avatarFID?: string\n  firstName?: string\n  lastName?: string\n  patronymic?: string | null\n  gender?: User_gender | null\n  contactInfo?: string | null\n  dateOfBirth?: string | null\n  address?: {\n  country?: string | null\n  city?: string | null\n  streetAddress?: string | null\n} | null\n  timeZone?: string | null\n  meetingInfo?: {\n  zoomEmail?: string | null\n} | null\n  position?: string | null\n  hourCost?: number\n  docsEmployment?: Record<string, any> | null\n  docsLibrary?: Record<string, any> | null\n  isDraft?: boolean\n  createDT?: string\n  createdUID?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserCreateResponse = IServerResponse<Resp_user_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "user": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "phone": "string",
                      "email": "string",
                      "auth": {},
                      "avatarFID": "00000000-0000-4000-8000-000000000001",
                      "firstName": "string",
                      "lastName": "string",
                      "patronymic": "string",
                      "gender": null,
                      "contactInfo": "string",
                      "dateOfBirth": "2026-01-15T12:00:00.000Z",
                      "address": {
                        "country": null,
                        "city": null,
                        "streetAddress": null
                      },
                      "timeZone": "string",
                      "meetingInfo": {
                        "zoomEmail": null
                      },
                      "position": "string",
                      "hourCost": 0,
                      "docsEmployment": {},
                      "docsLibrary": {},
                      "isDraft": false,
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "createdUID": "string",
                      "updTS": 0,
                      "updUID": "string"
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required fields (phone or email) are missing in request body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required fields (phone or email) are missing in request body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: User with provided ID, phone number or email already exists in system",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: User with provided ID, phone number or email already exists in system",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserCreateResponse = IServerResponse<Resp_user_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "phone": "string",
                "email": "string",
                "auth": {},
                "avatarFID": "00000000-0000-4000-8000-000000000001",
                "firstName": "string",
                "lastName": "string",
                "patronymic": "string",
                "gender": "male",
                "contactInfo": "string",
                "dateOfBirth": "2026-01-15T12:00:00.000Z",
                "address": {
                  "country": "string",
                  "city": "string",
                  "streetAddress": "string"
                },
                "timeZone": "string",
                "meetingInfo": {
                  "zoomEmail": "string"
                },
                "position": "string",
                "hourCost": 0,
                "docsEmployment": {},
                "docsLibrary": {},
                "isDraft": false,
                "createDT": "2026-01-15T12:00:00.000Z",
                "createdUID": "string",
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/user/info": {
      "get": {
        "operationId": "user_info",
        "summary": "🔒 Получение подробного профиля (DTO) пользователя по его ID.",
        "description": "Получение подробного профиля (DTO) пользователя по его ID.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `user:read`, `user:personal` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /user/info`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserInfoParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserInfoResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User profile with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User profile with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserInfoResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/info?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/info', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/passport-scan": {
      "get": {
        "operationId": "user_passport-scan",
        "summary": "🔒 Распознавание сканов паспорта (главная страница и прописка) с помощью AI.",
        "description": "Распознавание сканов паспорта (главная страница и прописка) с помощью AI.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `user:documents` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /user/passport-scan`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserPassportScanParams {\n  firstPageFID: string\n  secondPageFID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserPassportScanResponse = IServerResponse<Resp_user_passport-scan>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "firstPageFID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `firstPageFID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "secondPageFID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `secondPageFID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_passport-scan>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_passport-scan"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "passport": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: File not found, file size exceeds 10MB limit, or unsupported image extension (allowed: png, jpg, jpeg, heic, heif)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: File not found, file size exceeds 10MB limit, or unsupported image extension (allowed: png, jpg, jpeg, heic, heif)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserPassportScanResponse = IServerResponse<Resp_user_passport-scan>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/passport-scan?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/passport-scan', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_passport-scan>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/search": {
      "get": {
        "operationId": "user_search",
        "summary": "🔒 Поиск пользователя по номеру телефона.",
        "description": "Поиск пользователя по номеру телефона.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `meeting:invite`, `user:invite` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /user/search`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserSearchParams {\n  /** Phone number */\n  phone: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserSearchResponse = IServerResponse<Resp_user_search>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "phone",
            "in": "query",
            "required": true,
            "description": "Можно передать header `phone` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "description": "Phone number"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_user_search>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_user_search"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "user": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "429": {
            "description": "TooManyRequests: Rate limit exceeded for user search queries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 429,
                  "data": {
                    "err": "TooManyRequests: Rate limit exceeded for user search queries",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserSearchResponse = IServerResponse<Resp_user_search>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/search?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/search', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_user_search>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/user/update": {
      "post": {
        "operationId": "user_update",
        "summary": "🔒 Создание или обновление профиля пользователя.",
        "description": "Создание или обновление профиля пользователя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `user:update`, `user:personal`, `user:documents`, `user:employment` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /user/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface UserUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type UserUpdateBody = Partial<UserDto>\n\nexport interface UserUpdateBodyFields {\n  ID?: string\n  /** Phone number */\n  phone?: string | null\n  email?: string | null\n  auth?: Record<string, any> | null\n  avatarFID?: string\n  firstName?: string\n  lastName?: string\n  patronymic?: string | null\n  gender?: User_gender | null\n  contactInfo?: string | null\n  dateOfBirth?: string | null\n  address?: {\n  country?: string | null\n  city?: string | null\n  streetAddress?: string | null\n} | null\n  timeZone?: string | null\n  meetingInfo?: {\n  zoomEmail?: string | null\n} | null\n  position?: string | null\n  hourCost?: number\n  docsEmployment?: Record<string, any> | null\n  docsLibrary?: Record<string, any> | null\n  isDraft?: boolean\n  createDT?: string\n  createdUID?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type UserUpdateResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege required by changed fields (user:update, user:personal, user:documents - documents only of own profile, relation own; hourCost and position of another user - user:employment common); another user - only in the company of the session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege required by changed fields (user:update, user:personal, user:documents - documents only of own profile, relation own; hourCost and position of another user - user:employment common); another user - only in the company of the session",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: User with provided email address already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: User with provided email address already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: UserUpdateResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/user/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'user/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "phone": "string",
                "email": "string",
                "auth": {},
                "avatarFID": "00000000-0000-4000-8000-000000000001",
                "firstName": "string",
                "lastName": "string",
                "patronymic": "string",
                "gender": "male",
                "contactInfo": "string",
                "dateOfBirth": "2026-01-15T12:00:00.000Z",
                "address": {
                  "country": "string",
                  "city": "string",
                  "streetAddress": "string"
                },
                "timeZone": "string",
                "meetingInfo": {
                  "zoomEmail": "string"
                },
                "position": "string",
                "hourCost": 0,
                "docsEmployment": {},
                "docsLibrary": {},
                "isDraft": false,
                "createDT": "2026-01-15T12:00:00.000Z",
                "createdUID": "string",
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/test/fixture": {
      "get": {
        "operationId": "test_fixture",
        "summary": "🔓 #27008 Данные фикстуры тестовой компании пула: ID компании, сотрудники с телефонами, признаком администратора и должностями. #27156 У сотрудника - email и номер в фикстуре (index), у фикстуры - номера для пользователей, которых заводит тест (newPhones). Только с токеном стенда в заголовке X-Test-Token; без токена в конфигурации стенда - 404",
        "description": "#27008 Данные фикстуры тестовой компании пула: ID компании, сотрудники с телефонами, признаком администратора и должностями. #27156 У сотрудника - email и номер в фикстуре (index), у фикстуры - номера для пользователей, которых заводит тест (newPhones). Только с токеном стенда в заголовке X-Test-Token; без токена в конфигурации стенда - 404\n\n**Access:** `unauthorized` (0 ) · **Scope:** `read`\n\n### TypeScript (copy-paste)\n\n**`GET /test/fixture`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TestFixtureParams {\n  slot: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TestFixtureResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Testkit"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "slot",
            "in": "query",
            "required": true,
            "description": "Можно передать header `slot` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Invalid test API token; the company is not a test company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Invalid test API token; the company is not a test company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Test API is disabled on this stand; test company with this slot is not created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Test API is disabled on this stand; test company with this slot is not created",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - test_rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - test_rate_limited",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TestFixtureResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/test/fixture?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/test/reset": {
      "post": {
        "operationId": "test_reset",
        "summary": "🔓 #27008 Сброс тестовой компании пула к фикстуре перед автотестом: сессии компании завершаются, данные - из снимка. Только с токеном стенда в заголовке X-Test-Token; без токена в конфигурации стенда - 404",
        "description": "#27008 Сброс тестовой компании пула к фикстуре перед автотестом: сессии компании завершаются, данные - из снимка. Только с токеном стенда в заголовке X-Test-Token; без токена в конфигурации стенда - 404\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write`\n\n### TypeScript (copy-paste)\n\n**`POST /test/reset`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TestResetParams {\n  slot: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TestResetResponse = IServerResponse<Resp_test_reset>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Testkit"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "slot",
            "in": "query",
            "required": true,
            "description": "Можно передать header `slot` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_test_reset>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_test_reset"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "string",
                    "ms": 0,
                    "rows": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Invalid test API token; the company is not a test company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Invalid test API token; the company is not a test company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Test API is disabled on this stand; test company with this slot is not created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Test API is disabled on this stand; test company with this slot is not created",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: test company has no snapshot; params.code - test_rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: test company has no snapshot; params.code - test_rate_limited",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TestResetResponse = IServerResponse<Resp_test_reset>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/test/reset?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_test_reset>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/test/session": {
      "post": {
        "operationId": "test_session",
        "summary": "🔓 #27008 Сессия сотрудника фикстуры тестовой компании пула без SMS и кода входа - ответ как у signin/auth. #27156 Сотрудник - по одному из полей phone, userID, email. Только сотрудникам, которые состоят лишь в этой тестовой компании; сессия живёт 12 ч. Только с токеном стенда в заголовке X-Test-Token; без токена в конфигурации стенда - 404",
        "description": "#27008 Сессия сотрудника фикстуры тестовой компании пула без SMS и кода входа - ответ как у signin/auth. #27156 Сотрудник - по одному из полей phone, userID, email. Только сотрудникам, которые состоят лишь в этой тестовой компании; сессия живёт 12 ч. Только с токеном стенда в заголовке X-Test-Token; без токена в конфигурации стенда - 404\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`POST /test/session`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TestSessionParams {\n  slot: number\n  phone?: string | null\n  userID?: string | null\n  email?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TestSessionResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Testkit"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "slot",
            "in": "query",
            "required": true,
            "description": "Можно передать header `slot` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "Можно передать header `phone` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Можно передать header `email` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Exactly one of phone, userID, email is required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Exactly one of phone, userID, email is required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Invalid test API token; the user is not an employee of only this test company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Invalid test API token; the user is not an employee of only this test company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Test API is disabled on this stand; test company with this slot is not created; no such user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Test API is disabled on this stand; test company with this slot is not created; no such user",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - test_rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - test_rate_limited",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TestSessionResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/test/session?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/team/timeoff/create": {
      "post": {
        "operationId": "team_timeoff_create",
        "summary": "🔒 Создание заявки на отпуск или больничный для сотрудника.",
        "description": "Создание заявки на отпуск или больничный для сотрудника.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:timeoff` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/timeoff/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type TeamTimeoffCreateBody = Partial<UserTimeOff>\n\nexport interface TeamTimeoffCreateBodyFields {\n  ID?: string\n  cID?: string\n  userID?: string\n  roleID?: string\n  type?: string\n  paid?: boolean | null\n  sickLeaveID?: string | null\n  statementFID?: string | null\n  statementOrgID?: string | null\n  /** Unix timestamp in milliseconds */\n  statementSentTS?: number | null\n  year?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  startDayKey?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  endDayKey?: number | null\n  daysCount?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  startWorkDayKey?: number | null\n  userNote?: string | null\n  userAvailable?: boolean | null\n  status?: string\n  adminNote?: string | null\n  adminUID?: string | null\n  payment?: UserTimeOff_payment | null\n  statement?: Record<string, any> | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffCreateResponse = IServerResponse<UserTimeOff>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserTimeOff>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserTimeOff"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "userID": "00000000-0000-4000-8000-000000000001",
                    "roleID": "00000000-0000-4000-8000-000000000001",
                    "type": "string",
                    "paid": false,
                    "sickLeaveID": "string",
                    "statementFID": "00000000-0000-4000-8000-000000000001",
                    "statementOrgID": "00000000-0000-4000-8000-000000000001",
                    "statementSentTS": 0,
                    "year": 0,
                    "startDayKey": 0,
                    "endDayKey": 0,
                    "daysCount": 0,
                    "startWorkDayKey": 0,
                    "userNote": "string",
                    "userAvailable": false,
                    "status": "string",
                    "adminNote": "string",
                    "adminUID": "00000000-0000-4000-8000-000000000001",
                    "payment": "created",
                    "statement": {},
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Vacation planning unavailable (employment under 2 months), or requested days exceed available allowance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Vacation planning unavailable (employment under 2 months), or requested days exceed available allowance",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required; user is blocked or does not have an active role in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required; user is blocked or does not have an active role in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user does not have company access record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user does not have company access record",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid payload",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffCreateResponse = IServerResponse<UserTimeOff>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserTimeOff>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamTimeoffCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "userID": "00000000-0000-4000-8000-000000000001",
                "roleID": "00000000-0000-4000-8000-000000000001",
                "type": "string",
                "paid": false,
                "sickLeaveID": "string",
                "statementFID": "00000000-0000-4000-8000-000000000001",
                "statementOrgID": "00000000-0000-4000-8000-000000000001",
                "statementSentTS": 0,
                "year": 0,
                "startDayKey": 0,
                "endDayKey": 0,
                "daysCount": 0,
                "startWorkDayKey": 0,
                "userNote": "string",
                "userAvailable": false,
                "status": "string",
                "adminNote": "string",
                "adminUID": "00000000-0000-4000-8000-000000000001",
                "payment": "created",
                "statement": {},
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/team/timeoff/delete": {
      "get": {
        "operationId": "team_timeoff_delete",
        "summary": "🔒 Удаление записи отпуска или больничного.",
        "description": "Удаление записи отпуска или больничного.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:timeoff` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/timeoff/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffDeleteResponse = IServerResponse<Resp_team_timeoff_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_timeoff_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_timeoff_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Timeoff record with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Timeoff record with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffDeleteResponse = IServerResponse<Resp_team_timeoff_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_timeoff_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/timeoff/list": {
      "get": {
        "operationId": "team_timeoff_list",
        "summary": "🔒 Получение списка отпусков/больничных и остатка оплачиваемых дней отпуска.",
        "description": "Получение списка отпусков/больничных и остатка оплачиваемых дней отпуска.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:timeoff` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/timeoff/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffListParams {\n  userID?: string | null\n  /** Day key (YYYYMMDD or internal day index) */\n  daykey?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffListResponse = IServerResponse<Resp_team_timeoff_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "daykey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `daykey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_timeoff_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_timeoff_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {
                        "ID": null,
                        "cID": null,
                        "userID": null,
                        "roleID": null,
                        "type": null,
                        "paid": null,
                        "sickLeaveID": null,
                        "statementFID": null,
                        "statementOrgID": null,
                        "statementSentTS": null,
                        "year": null,
                        "startDayKey": null,
                        "endDayKey": null,
                        "daysCount": null,
                        "startWorkDayKey": null,
                        "userNote": null,
                        "userAvailable": null,
                        "status": null,
                        "adminNote": null,
                        "adminUID": null,
                        "payment": null,
                        "statement": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "paidDaysLeft": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffListResponse = IServerResponse<Resp_team_timeoff_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_timeoff_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/timeoff/paid-days-left": {
      "get": {
        "operationId": "team_timeoff_paid-days-left",
        "summary": "🔒 Получение количества доступных (остаточных) дней оплачиваемого отпуска.",
        "description": "Получение количества доступных (остаточных) дней оплачиваемого отпуска.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:timeoff` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /team/timeoff/paid-days-left`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffPaidDaysLeftParams {\n  userID: string\n  /** Day key (YYYYMMDD or internal day index) */\n  daykey: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffPaidDaysLeftResponse = IServerResponse<Resp_team_timeoff_paid-days-left>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "daykey",
            "in": "query",
            "required": true,
            "description": "Можно передать header `daykey` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_timeoff_paid-days-left>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_timeoff_paid-days-left"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": 0,
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffPaidDaysLeftResponse = IServerResponse<Resp_team_timeoff_paid-days-left>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/paid-days-left?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/paid-days-left', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_timeoff_paid-days-left>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/timeoff/start-work-day": {
      "get": {
        "operationId": "team_timeoff_start-work-day",
        "summary": "🔒 Расчёт первого рабочего дня сотрудника после завершения отпуска/больничного.",
        "description": "Расчёт первого рабочего дня сотрудника после завершения отпуска/больничного.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:timeoff` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /team/timeoff/start-work-day`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffStartWorkDayParams {\n  userID: string\n  /** Day key (YYYYMMDD or internal day index) */\n  startDayKey: number\n  daysCount: number\n  type?: team_timeoff_start_work_day_type | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffStartWorkDayResponse = IServerResponse<Resp_team_timeoff_start-work-day>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "startDayKey",
            "in": "query",
            "required": true,
            "description": "Можно передать header `startDayKey` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          },
          {
            "name": "daysCount",
            "in": "query",
            "required": true,
            "description": "Можно передать header `daysCount` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/team_timeoff_start_work_day_type"
                },
                {
                  "type": "null"
                }
              ],
              "default": "vacation"
            },
            "example": "vacation"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_timeoff_start-work-day>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_timeoff_start-work-day"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "startWorkDayKey": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffStartWorkDayResponse = IServerResponse<Resp_team_timeoff_start-work-day>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/start-work-day?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/start-work-day', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_timeoff_start-work-day>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/timeoff/statement-meta": {
      "get": {
        "operationId": "team_timeoff_statement-meta",
        "summary": "🔒 Получение мета-информации для подсказки заявления на отпуск (needStatement, plannedSendDate).",
        "description": "Получение мета-информации для подсказки заявления на отпуск (needStatement, plannedSendDate).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:timeoff` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/timeoff/statement-meta`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffStatementMetaParams {\n  userID: string\n  type: team_timeoff_start_work_day_type\n  paid: boolean\n  /** Day key (YYYYMMDD or internal day index) */\n  startDayKey: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffStatementMetaResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/team_timeoff_start_work_day_type"
            },
            "example": "vacation"
          },
          {
            "name": "paid",
            "in": "query",
            "required": true,
            "description": "Можно передать header `paid` (сервер мержит headers+query)",
            "schema": {
              "type": "boolean"
            },
            "example": false
          },
          {
            "name": "startDayKey",
            "in": "query",
            "required": true,
            "description": "Можно передать header `startDayKey` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffStatementMetaResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/statement-meta?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/statement-meta', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/timeoff/statement-pdf": {
      "get": {
        "operationId": "team_timeoff_statement-pdf",
        "summary": "🔒 Формирование PDF заявления на отпуск сотрудника без сохранения файла в хранилище.",
        "description": "Формирование PDF заявления на отпуск сотрудника без сохранения файла в хранилище.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:timeoff` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/timeoff/statement-pdf`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffStatementPdfParams {\n  userID: string\n  type: team_timeoff_statement_pdf_type\n  paid: boolean\n  /** Day key (YYYYMMDD or internal day index) */\n  startDayKey: number\n  daysCount: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffStatementPdfResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/team_timeoff_statement_pdf_type"
            },
            "example": "vacation"
          },
          {
            "name": "paid",
            "in": "query",
            "required": true,
            "description": "Можно передать header `paid` (сервер мержит headers+query)",
            "schema": {
              "type": "boolean"
            },
            "example": false
          },
          {
            "name": "startDayKey",
            "in": "query",
            "required": true,
            "description": "Можно передать header `startDayKey` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          },
          {
            "name": "daysCount",
            "in": "query",
            "required": true,
            "description": "Можно передать header `daysCount` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Days count must be at least 1 or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Days count must be at least 1 or invalid parameters",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User or organization not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User or organization not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffStatementPdfResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/statement-pdf?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/statement-pdf', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/timeoff/update": {
      "post": {
        "operationId": "team_timeoff_update",
        "summary": "🔒 Обновление параметров или статуса отпуска / больничного.",
        "description": "Обновление параметров или статуса отпуска / больничного.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:timeoff` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/timeoff/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamTimeoffUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type TeamTimeoffUpdateBody = Partial<UserTimeOff>\n\nexport interface TeamTimeoffUpdateBodyFields {\n  ID?: string\n  cID?: string\n  userID?: string\n  roleID?: string\n  type?: string\n  paid?: boolean | null\n  sickLeaveID?: string | null\n  statementFID?: string | null\n  statementOrgID?: string | null\n  /** Unix timestamp in milliseconds */\n  statementSentTS?: number | null\n  year?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  startDayKey?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  endDayKey?: number | null\n  daysCount?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  startWorkDayKey?: number | null\n  userNote?: string | null\n  userAvailable?: boolean | null\n  status?: string\n  adminNote?: string | null\n  adminUID?: string | null\n  payment?: UserTimeOff_payment | null\n  statement?: Record<string, any> | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamTimeoffUpdateResponse = IServerResponse<UserTimeOff>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Timeoff"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserTimeOff>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserTimeOff"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "userID": "00000000-0000-4000-8000-000000000001",
                    "roleID": "00000000-0000-4000-8000-000000000001",
                    "type": "string",
                    "paid": false,
                    "sickLeaveID": "string",
                    "statementFID": "00000000-0000-4000-8000-000000000001",
                    "statementOrgID": "00000000-0000-4000-8000-000000000001",
                    "statementSentTS": 0,
                    "year": 0,
                    "startDayKey": 0,
                    "endDayKey": 0,
                    "daysCount": 0,
                    "startWorkDayKey": 0,
                    "userNote": "string",
                    "userAvailable": false,
                    "status": "string",
                    "adminNote": "string",
                    "adminUID": "00000000-0000-4000-8000-000000000001",
                    "payment": "created",
                    "statement": {},
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:timeoff required; own timeoff is approved or made paid only with user:timeoff wider than own",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:timeoff required; own timeoff is approved or made paid only with user:timeoff wider than own",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Timeoff record with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Timeoff record with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamTimeoffUpdateResponse = IServerResponse<UserTimeOff>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/timeoff/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/timeoff/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserTimeOff>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamTimeoffUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "userID": "00000000-0000-4000-8000-000000000001",
                "roleID": "00000000-0000-4000-8000-000000000001",
                "type": "string",
                "paid": false,
                "sickLeaveID": "string",
                "statementFID": "00000000-0000-4000-8000-000000000001",
                "statementOrgID": "00000000-0000-4000-8000-000000000001",
                "statementSentTS": 0,
                "year": 0,
                "startDayKey": 0,
                "endDayKey": 0,
                "daysCount": 0,
                "startWorkDayKey": 0,
                "userNote": "string",
                "userAvailable": false,
                "status": "string",
                "adminNote": "string",
                "adminUID": "00000000-0000-4000-8000-000000000001",
                "payment": "created",
                "statement": {},
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/team/role/create": {
      "post": {
        "operationId": "team_role_create",
        "summary": "🔒 Назначение новой должности/роли сотруднику в компании.",
        "description": "Назначение новой должности/роли сотруднику в компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:employment` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/role/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamRoleCreateParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type TeamRoleCreateBody = Partial<UserDto>\n\nexport interface TeamRoleCreateBodyFields {\n  ID?: string\n  userID?: string\n  cID?: string\n  type?: UserRole_Type\n  level?: UserRole_Level\n  title?: string | null\n  award?: number\n  salary?: number\n  total?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  startDK?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  trialEndDK?: number | null\n  /** Day key (YYYYMMDD or internal day index) */\n  endDK?: number | null\n  note?: Record<string, any> | null\n  isDeleted?: boolean\n  isMain?: boolean | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamRoleCreateResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:employment (common) required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:employment (common) required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user or user company access record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user or user company access record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Role with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Role with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamRoleCreateResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/role/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/role/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamRoleCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "userID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "type": 10,
                "level": -1,
                "title": "string",
                "award": 0,
                "salary": 0,
                "total": 0,
                "startDK": 0,
                "trialEndDK": 0,
                "endDK": 0,
                "note": {},
                "isDeleted": false,
                "isMain": false,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/team/role/delete": {
      "get": {
        "operationId": "team_role_delete",
        "summary": "🔒 Удаление или архивация роли пользователя в компании",
        "description": "Удаление или архивация роли пользователя в компании\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:employment` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/role/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamRoleDeleteParams {\n  roleID: string\n  endD?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamRoleDeleteResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "roleID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `roleID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "endD",
            "in": "query",
            "required": false,
            "description": "Можно передать header `endD` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "example": "2026-01-15T12:00:00.000Z"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:employment (common) required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:employment (common) required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user role not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user role not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamRoleDeleteResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/role/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/role/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/role/update": {
      "post": {
        "operationId": "team_role_update",
        "summary": "🔒 Обновление параметров существующей роли/должности сотрудника.",
        "description": "Обновление параметров существующей роли/должности сотрудника.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:employment` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/role/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamRoleUpdateParams {\n  roleID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type TeamRoleUpdateBody = Partial<UserDto>\n\nexport interface TeamRoleUpdateBodyFields {\n  ID?: string\n  userID?: string\n  cID?: string\n  type?: UserRole_Type\n  level?: UserRole_Level\n  title?: string | null\n  award?: number\n  salary?: number\n  total?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  startDK?: number\n  /** Day key (YYYYMMDD or internal day index) */\n  trialEndDK?: number | null\n  /** Day key (YYYYMMDD or internal day index) */\n  endDK?: number | null\n  note?: Record<string, any> | null\n  isDeleted?: boolean\n  isMain?: boolean | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamRoleUpdateResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Roles"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "roleID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `roleID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:employment (common) required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:employment (common) required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target role or user access record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target role or user access record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamRoleUpdateResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/role/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/role/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamRoleUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "userID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "type": 10,
                "level": -1,
                "title": "string",
                "award": 0,
                "salary": 0,
                "total": 0,
                "startDK": 0,
                "trialEndDK": 0,
                "endDK": 0,
                "note": {},
                "isDeleted": false,
                "isMain": false,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/team/payment/docs/download": {
      "get": {
        "operationId": "team_payment_docs_download",
        "summary": "🔒 Скачивание табеля, приказа (XLSX, PDF), отдельного заявления на отпуск либо ZIP всех документов месяца по юр. лицу или по всем. Файл - в потоке ответа.",
        "description": "Скачивание табеля, приказа (XLSX, PDF), отдельного заявления на отпуск либо ZIP всех документов месяца по юр. лицу или по всем. Файл - в потоке ответа.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/payment/docs/download`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentDocsDownloadParams {\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK?: number | null\n  orgID?: string | null\n  kind?: team_payment_docs_download_kind | null\n  statementTimeOffID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentDocsDownloadResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "monthDK",
            "in": "query",
            "required": false,
            "description": "Можно передать header `monthDK` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          },
          {
            "name": "orgID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `orgID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Можно передать header `kind` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/team_payment_docs_download_kind"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "advance"
          },
          {
            "name": "statementTimeOffID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `statementTimeOffID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: orgID is required for a single document or missing parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: orgID is required for a single document or missing parameters",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Organization, document, or statement not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Organization, document, or statement not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Document is not formed yet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Document is not formed yet",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentDocsDownloadResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/docs/download?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/docs/download', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/docs/list": {
      "get": {
        "operationId": "team_payment_docs_list",
        "summary": "🔒 Табели, приказы и заявления на отпуск месяца по юр. лицам: доступные документы и статус отправки бухгалтеру.",
        "description": "Табели, приказы и заявления на отпуск месяца по юр. лицам: доступные документы и статус отправки бухгалтеру.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/payment/docs/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentDocsListParams {\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentDocsListResponse = IServerResponse<Resp_team_payment_docs_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "monthDK",
            "in": "query",
            "required": true,
            "description": "Можно передать header `monthDK` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_payment_docs_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_payment_docs_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "orgs": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentDocsListResponse = IServerResponse<Resp_team_payment_docs_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/docs/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/docs/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_payment_docs_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/docs/send": {
      "post": {
        "operationId": "team_payment_docs_send",
        "summary": "🔒 Повторная отправка документов месяца и заявлений на отпуск юр. лица бухгалтеру: одно письмо со всеми доступными документами, одним документом `kind` (#26932) или одним заявлением `statementTimeOffID`.",
        "description": "Повторная отправка документов месяца и заявлений на отпуск юр. лица бухгалтеру: одно письмо со всеми доступными документами, одним документом `kind` (#26932) или одним заявлением `statementTimeOffID`.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/docs/send`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface TeamPaymentDocsSendBody {\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK?: number | null\n  orgID?: string | null\n  statementTimeOffID?: string | null\n  kind?: team_payment_docs_download_kind | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentDocsSendResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Parameters missing or vacation has no statement",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Parameters missing or vacation has no statement",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Organization or timeOff not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Organization or timeOff not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Document is not available for the month yet; document of the organization is empty",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Document is not available for the month yet; document of the organization is empty",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentDocsSendResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/docs/send?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/docs/send', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentDocsSendBody"
              },
              "example": {
                "monthDK": 0,
                "orgID": "00000000-0000-4000-8000-000000000001",
                "statementTimeOffID": "00000000-0000-4000-8000-000000000001",
                "kind": "advance"
              }
            }
          }
        }
      }
    },
    "/team/payment/award-part/create": {
      "post": {
        "operationId": "team_payment_award-part_create",
        "summary": "🔒 #26532 Штраф или бонус - часть премии месяца (#26797 переданного, иначе текущего). #26564 Коррекция - процент от премии по выработке за ресурс.",
        "description": "#26532 Штраф или бонус - часть премии месяца (#26797 переданного, иначе текущего). #26564 Коррекция - процент от премии по выработке за ресурс.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:bonus`, `company:payments` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/award-part/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface TeamPaymentAwardPartCreateBody {\n  userID: string\n  type: PaymentAwardPart_MANUAL_TYPES\n  amount?: number | null\n  title?: string | null\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK?: number | null\n  resource?: {\n  worklogID?: string | null\n  entityID?: string | null\n  entityType?: SystemEntityType | null\n  startDk?: number | null\n  endDk?: number | null\n  roleType?: UserRole_Type | null\n} | null\n  percent?: number | null\n  note?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentAwardPartCreateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Missing amount and title for fine/bonus or resource and percent for correction; monthDK is not the first day of a month",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Missing amount and title for fine/bonus or resource and percent for correction; monthDK is not the first day of a month",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:bonus (correction) or company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:bonus (correction) or company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User not found in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User not found in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: No worklogs for correction resource; month of fine/bonus is in the future or its award is formed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: No worklogs for correction resource; month of fine/bonus is in the future or its award is formed",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentAwardPartCreateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/award-part/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/award-part/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentAwardPartCreateBody"
              },
              "example": {
                "userID": "00000000-0000-4000-8000-000000000001",
                "type": 20,
                "amount": 0,
                "title": "string",
                "monthDK": 0,
                "resource": {
                  "worklogID": "00000000-0000-4000-8000-000000000001",
                  "entityID": "00000000-0000-4000-8000-000000000001",
                  "entityType": "project",
                  "startDk": 0,
                  "endDk": 0,
                  "roleType": 10
                },
                "percent": 0,
                "note": "string"
              }
            }
          }
        }
      }
    },
    "/team/payment/award-part/delete": {
      "post": {
        "operationId": "team_payment_award-part_delete",
        "summary": "🔒 #26532 Удаление штрафа, бонуса или коррекции до формирования премии; списание непогашенного переноса.",
        "description": "#26532 Удаление штрафа, бонуса или коррекции до формирования премии; списание непогашенного переноса.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:bonus`, `company:payments` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/award-part/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentAwardPartDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentAwardPartDeleteResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:bonus (correction) or company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:bonus (correction) or company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Award part not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Award part not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Award for the month is formed or part is created by the system",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Award for the month is formed or part is created by the system",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentAwardPartDeleteResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/award-part/delete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/award-part/delete', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/award-part/preview": {
      "post": {
        "operationId": "team_payment_award-part_preview",
        "summary": "🔒 #26564 Предпросмотр коррекции: премия по выработке за ресурс, сумма коррекции и месяц, в который она ляжет. Заменяет worklogs/calculation.",
        "description": "#26564 Предпросмотр коррекции: премия по выработке за ресурс, сумма коррекции и месяц, в который она ляжет. Заменяет worklogs/calculation.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:bonus` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/award-part/preview`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface TeamPaymentAwardPartPreviewBody {\n  userID: string\n  resource: {\n  worklogID?: string | null\n  entityID?: string | null\n  entityType?: SystemEntityType | null\n  startDk?: number | null\n  endDk?: number | null\n  roleType?: UserRole_Type | null\n}\n  percent: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentAwardPartPreviewResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid correction resource",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid correction resource",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:bonus required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:bonus required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentAwardPartPreviewResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/award-part/preview?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/award-part/preview', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentAwardPartPreviewBody"
              },
              "example": {
                "userID": "00000000-0000-4000-8000-000000000001",
                "resource": {
                  "worklogID": "00000000-0000-4000-8000-000000000001",
                  "entityID": "00000000-0000-4000-8000-000000000001",
                  "entityType": "project",
                  "startDk": 0,
                  "endDk": 0,
                  "roleType": 10
                },
                "percent": 0
              }
            }
          }
        }
      }
    },
    "/team/payment/award-part/update": {
      "post": {
        "operationId": "team_payment_award-part_update",
        "summary": "🔒 #26532 Правка штрафа, бонуса или коррекции, пока премия за их месяц не сформирована.",
        "description": "#26532 Правка штрафа, бонуса или коррекции, пока премия за их месяц не сформирована.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:bonus`, `company:payments` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/award-part/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentAwardPartUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\nexport interface TeamPaymentAwardPartUpdateBody {\n  amount?: number\n  title?: string\n  note?: string | null\n  percent?: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentAwardPartUpdateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:bonus (correction) or company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:bonus (correction) or company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Award part not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Award part not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Award for the month is formed or part is created by the system",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Award for the month is formed or part is created by the system",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentAwardPartUpdateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/award-part/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/award-part/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentAwardPartUpdateBody"
              },
              "example": {
                "amount": 0,
                "title": "string",
                "note": "string",
                "percent": 0
              }
            }
          }
        }
      }
    },
    "/team/payment/create": {
      "post": {
        "operationId": "team_payment_create",
        "summary": "🔒 #26532 Ручная выплата сотруднику в текущем месяце: недоплата, выплата вне расчёта. `paid` - сразу выплаченная (#26932).",
        "description": "#26532 Ручная выплата сотруднику в текущем месяце: недоплата, выплата вне расчёта. `paid` - сразу выплаченная (#26932).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface TeamPaymentCreateBody {\n  userID: string\n  type: team_payment_create_Body_type\n  amountTotal: number\n  amountPaid?: number | null\n  note?: string | null\n  paid?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentCreateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User not found in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User not found in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentCreateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentCreateBody"
              },
              "example": {
                "userID": "00000000-0000-4000-8000-000000000001",
                "type": 30,
                "amountTotal": 0,
                "amountPaid": 0,
                "note": "string",
                "paid": false
              }
            }
          }
        }
      }
    },
    "/team/payment/delete": {
      "post": {
        "operationId": "team_payment_delete",
        "summary": "🔒 #26532 Удаление невыплаченной выплаты, созданной вручную.",
        "description": "#26532 Удаление невыплаченной выплаты, созданной вручную.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentDeleteResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Payment with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Payment with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Payment is paid or created by the system",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Payment is paid or created by the system",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentDeleteResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/delete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/delete', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/disburse": {
      "post": {
        "operationId": "team_payment_disburse",
        "summary": "🔒 Выплата (погашение) денежных средств по списку платежей.",
        "description": "Выплата (погашение) денежных средств по списку платежей.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/disburse`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface TeamPaymentDisburseBody {\n  IDs: Array<string>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentDisburseResponse = IServerResponse<Resp_team_payment_disburse>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_payment_disburse>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_payment_disburse"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentDisburseResponse = IServerResponse<Resp_team_payment_disburse>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/disburse?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/disburse', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_payment_disburse>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentDisburseBody"
              },
              "example": {
                "IDs": [
                  "00000000-0000-4000-8000-000000000001"
                ]
              }
            }
          }
        }
      }
    },
    "/team/payment/list": {
      "get": {
        "operationId": "team_payment_list",
        "summary": "🔒 #26532 Выплаты и части премии: за месяц (страница выплат) или все выплаты сотрудника (профиль).",
        "description": "#26532 Выплаты и части премии: за месяц (страница выплат) или все выплаты сотрудника (профиль).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:payments`, `company:payments` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/payment/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentListParams {\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK?: number | null\n  userID?: string | null\n  type?: Payment_Type | null\n  paid?: boolean | null\n  orgID?: string | null\n  noOrg?: boolean | null\n  employmentType?: Payment_employmentType | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentListResponse = IServerResponse<Resp_team_payment_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "monthDK",
            "in": "query",
            "required": false,
            "description": "Можно передать header `monthDK` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Payment_Type"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": 0
          },
          {
            "name": "paid",
            "in": "query",
            "required": false,
            "description": "Можно передать header `paid` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          },
          {
            "name": "orgID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `orgID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "noOrg",
            "in": "query",
            "required": false,
            "description": "Можно передать header `noOrg` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          },
          {
            "name": "employmentType",
            "in": "query",
            "required": false,
            "description": "Можно передать header `employmentType` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Payment_employmentType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "none"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_payment_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_payment_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "payments": [
                      {
                        "cID": null,
                        "userID": null,
                        "ID": null,
                        "paid": null,
                        "type": null,
                        "reason": null,
                        "note": null,
                        "monthDK": null,
                        "orgID": null,
                        "orderDK": null,
                        "iterationKey": null,
                        "timeOffID": null,
                        "timeOffType": null,
                        "startDK": null,
                        "endDK": null,
                        "daysCount": null,
                        "amountTotal": null,
                        "amountPaid": null,
                        "changeNote": null,
                        "isAmountChanged": null,
                        "isAdditional": null,
                        "employmentType": null,
                        "createdDT": null,
                        "createdUID": null,
                        "paidDT": null,
                        "paidUID": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "parts": [
                      {
                        "cID": null,
                        "ID": null,
                        "userID": null,
                        "monthDK": null,
                        "type": null,
                        "amount": null,
                        "title": null,
                        "note": null,
                        "paymentID": null,
                        "percent": null,
                        "base": null,
                        "resource": null,
                        "createdDT": null,
                        "createdUID": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "hangingCarryoverIDs": [
                      "string"
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Neither monthDK nor userID is passed; orgID together with noOrg",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Neither monthDK nor userID is passed; orgID together with noOrg",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:payments (userID) or company:payments (month) required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:payments (userID) or company:payments (month) required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentListResponse = IServerResponse<Resp_team_payment_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_payment_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/month-users": {
      "get": {
        "operationId": "team_payment_month-users",
        "summary": "🔒 #26932 Сотрудники месяца выплат: должность, отработанные дни и часы, дни отпуска и больничного, начислено, удержано, выплачено, осталось; нормы месяца.",
        "description": "#26932 Сотрудники месяца выплат: должность, отработанные дни и часы, дни отпуска и больничного, начислено, удержано, выплачено, осталось; нормы месяца.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/payment/month-users`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentMonthUsersParams {\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentMonthUsersResponse = IServerResponse<Resp_team_payment_month-users>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "monthDK",
            "in": "query",
            "required": true,
            "description": "Можно передать header `monthDK` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_payment_month-users>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_payment_month-users"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "norms": null,
                    "users": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentMonthUsersResponse = IServerResponse<Resp_team_payment_month-users>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/month-users?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/month-users', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_payment_month-users>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/months": {
      "get": {
        "operationId": "team_payment_months",
        "summary": "🔒 #26532 Список месяцев со статистикой выплат: начислено, выплачено, удержано (#26932), осталось, сотрудников, есть ли невыплаченные.",
        "description": "#26532 Список месяцев со статистикой выплат: начислено, выплачено, удержано (#26932), осталось, сотрудников, есть ли невыплаченные.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/payment/months`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentMonthsParams {\n  orgID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentMonthsResponse = IServerResponse<Resp_team_payment_months>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "orgID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `orgID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_payment_months>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_payment_months"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "months": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentMonthsResponse = IServerResponse<Resp_team_payment_months>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/months?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/months', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_payment_months>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/recalc": {
      "post": {
        "operationId": "team_payment_recalc",
        "summary": "🔒 #26532 Пересчёт месяца: невыплаченные аванс, основная и премия пересчитываются по текущим данным, недостающие создаются. Ручные правки невыплаченных перезаписываются.",
        "description": "#26532 Пересчёт месяца: невыплаченные аванс, основная и премия пересчитываются по текущим данным, недостающие создаются. Ручные правки невыплаченных перезаписываются.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/recalc`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentRecalcParams {\n  /** Day key (YYYYMMDD or internal day index) */\n  monthDK: number\n  userID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentRecalcResponse = IServerResponse<Resp_team_payment_recalc>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "monthDK",
            "in": "query",
            "required": true,
            "description": "Можно передать header `monthDK` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_payment_recalc>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_payment_recalc"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "advance": 0,
                    "month": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Month is not the first day of a month",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Month is not the first day of a month",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentRecalcResponse = IServerResponse<Resp_team_payment_recalc>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/recalc?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/recalc', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_payment_recalc>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/team/payment/update": {
      "post": {
        "operationId": "team_payment_update",
        "summary": "🔒 #26532 Правка выплаты администратором: «Начислено», «Выплачено», статус и комментарий. #26929 Комментарий один: отдельного комментария к изменению сумм нет. #27044 Суммы выплаченной - только вместе со снятием статуса (`paid: false`).",
        "description": "#26532 Правка выплаты администратором: «Начислено», «Выплачено», статус и комментарий. #26929 Комментарий один: отдельного комментария к изменению сумм нет. #27044 Суммы выплаченной - только вместе со снятием статуса (`paid: false`).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:payments` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /team/payment/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamPaymentUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\nexport interface TeamPaymentUpdateBody {\n  amountTotal?: number\n  amountPaid?: number\n  paid?: boolean\n  note?: string | null\n  changeNote?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamPaymentUpdateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Team: Payments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Only the final salary payment can be negative",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Only the final salary payment can be negative",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:payments required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:payments required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Payment with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Payment with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Paid payment amounts cannot be changed: unmark it as paid first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Paid payment amounts cannot be changed: unmark it as paid first",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamPaymentUpdateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/payment/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/payment/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamPaymentUpdateBody"
              },
              "example": {
                "amountTotal": 0,
                "amountPaid": 0,
                "paid": false,
                "note": "string",
                "changeNote": "string"
              }
            }
          }
        }
      }
    },
    "/team/user-products": {
      "get": {
        "operationId": "team_user-products",
        "summary": "🔒 Вкладка «Продукты» профиля сотрудника: продукты с ролью, временем, стоимостью и датой последнего ворклога. #26673 Стоимость видна по user:allowed-products к сотруднику; без маржи, если выработка покрыта worklog:no-margin (своя, отдела у лида, продуктов у РП), иначе с маржой.",
        "description": "Вкладка «Продукты» профиля сотрудника: продукты с ролью, временем, стоимостью и датой последнего ворклога. #26673 Стоимость видна по user:allowed-products к сотруднику; без маржи, если выработка покрыта worklog:no-margin (своя, отдела у лида, продуктов у РП), иначе с маржой.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:allowed-products`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /team/user-products`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface TeamUserProductsParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type TeamUserProductsResponse = IServerResponse<Resp_team_user-products>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_team_user-products>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_team_user-products"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "products": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:allowed-products required to view another user products (privilegeRequired)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:allowed-products required to view another user products (privilegeRequired)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified user does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified user does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: TeamUserProductsResponse = IServerResponse<Resp_team_user-products>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/team/user-products?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'team/user-products', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_team_user-products>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/editor/task-details": {
      "get": {
        "operationId": "states_editor_task-details",
        "summary": "🔒 Получение данных для редактора карточки задачи (опции исполнителей, итераций и планов нагрузки).",
        "description": "Получение данных для редактора карточки задачи (опции исполнителей, итераций и планов нагрузки).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:update`, `task:create` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/editor/task-details`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesEditorTaskDetailsParams {\n  featureID?: string | null\n  category?: number | null\n  taskID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesEditorTaskDetailsResponse = IServerResponse<Resp_states_editor_task-details>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States: Editor"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "featureID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `featureID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Можно передать header `category` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          },
          {
            "name": "taskID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `taskID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_states_editor_task-details>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_states_editor_task-details"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "task": {},
                    "assigneesOptions": {
                      "approval": [
                        {}
                      ]
                    },
                    "iterationsOptions": [
                      {
                        "ID": null,
                        "key": null,
                        "year": null,
                        "month": null,
                        "week": null,
                        "startDayKey": null,
                        "endDayKey": null,
                        "start": null,
                        "end": null,
                        "title": null,
                        "timeWorked": null,
                        "notWorkDays": null,
                        "shortDays": null,
                        "updTS": null
                      }
                    ],
                    "usersIterationsPlans": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required parameters missing (both featureID and taskID undefined)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required parameters missing (both featureID and taskID undefined)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:update (taskID) / task:create (featureID) (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:update (taskID) / task:create (featureID) (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified task or feature ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified task or feature ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesEditorTaskDetailsResponse = IServerResponse<Resp_states_editor_task-details>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/editor/task-details?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/editor/task-details', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_states_editor_task-details>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/editor/version": {
      "get": {
        "operationId": "states_editor_version",
        "summary": "🔒 Получение данных для редактора версии (существующие названия, фичи и исправленные баги).",
        "description": "Получение данных для редактора версии (существующие названия, фичи и исправленные баги).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `version:update`, `version:create` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/editor/version`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesEditorVersionParams {\n  productID: string\n  versionID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesEditorVersionResponse = IServerResponse<Resp_states_editor_version>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States: Editor"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "productID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `productID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "versionID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `versionID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_states_editor_version>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_states_editor_version"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "existingTitles": [
                      "string"
                    ],
                    "version": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "title": "string",
                      "major": 0,
                      "minor": 0,
                      "build": 0,
                      "resolvedBugs": {},
                      "notes": "string",
                      "isDone": false,
                      "isPublished": false,
                      "releaseDT": "2026-01-15T12:00:00.000Z",
                      "design": {
                        "fileUrl": null
                      },
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "updateDT": "2026-01-15T12:00:00.000Z",
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updTS": 0,
                      "updUID": "string"
                    },
                    "features": [
                      {
                        "cID": null,
                        "projectID": null,
                        "productID": null,
                        "versionID": null,
                        "ID": null,
                        "key": null,
                        "title": null,
                        "status": null,
                        "spec": null,
                        "gist": null,
                        "meta": null,
                        "analyticAssignee": null,
                        "ord": null,
                        "isDeleted": null,
                        "deletedTS": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "resolvedBugs": [
                      {
                        "cID": null,
                        "projectID": null,
                        "productID": null,
                        "versionID": null,
                        "featureID": null,
                        "ID": null,
                        "status": null,
                        "state": null,
                        "category": null,
                        "type": null,
                        "priority": null,
                        "urgently": null,
                        "title": null,
                        "searchTitle": null,
                        "key": null,
                        "currentAssignee": null,
                        "ord": null,
                        "spec": null,
                        "gist": null,
                        "modules": null,
                        "components": null,
                        "approvalAssignee": null,
                        "workAssignee": null,
                        "workIterationKey": null,
                        "workTimePlan": null,
                        "workEvaluation": null,
                        "reviewAssignee": null,
                        "testAssignee": null,
                        "resolutionVersionID": null,
                        "resolutionType": null,
                        "resolutionNote": null,
                        "result": null,
                        "meta": null,
                        "git": null,
                        "createDT": null,
                        "creatorUID": null,
                        "stage": null,
                        "browser": null,
                        "bugType": null,
                        "build": null,
                        "devices": null,
                        "labels": null,
                        "fuzzy": null,
                        "updTS": null,
                        "isDeleted": null,
                        "deletedTS": null,
                        "updUID": null,
                        "rejectUID": null,
                        "rejectTS": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege version:update (versionID) or version:create required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege version:update (versionID) or version:create required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified product or version ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified product or version ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesEditorVersionResponse = IServerResponse<Resp_states_editor_version>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/editor/version?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/editor/version', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_states_editor_version>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/activity": {
      "get": {
        "operationId": "states_activity",
        "summary": "🔒 Получение ленты логов активности пользователей и сущностей.",
        "description": "Получение ленты логов активности пользователей и сущностей.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:activity` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/activity`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesActivityParams {\n  nextCursor?: string | null\n  author?: string | null\n  userID?: string | null\n  resID?: string | null\n  resTypeGroup?: states_activity_resTypeGroup | null\n  dtRange?: states_activity_dtRange | null\n  startDt?: string | null\n  finishDt?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesActivityResponse = IServerResponse<Resp_states_activity>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "nextCursor",
            "in": "query",
            "required": false,
            "description": "Можно передать header `nextCursor` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "author",
            "in": "query",
            "required": false,
            "description": "Можно передать header `author` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "resID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `resID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "resTypeGroup",
            "in": "query",
            "required": false,
            "description": "Можно передать header `resTypeGroup` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/states_activity_resTypeGroup"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "project"
          },
          {
            "name": "dtRange",
            "in": "query",
            "required": false,
            "description": "Можно передать header `dtRange` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/states_activity_dtRange"
                },
                {
                  "type": "null"
                }
              ],
              "default": "24h"
            },
            "example": "24h"
          },
          {
            "name": "startDt",
            "in": "query",
            "required": false,
            "description": "Можно передать header `startDt` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "example": "2026-01-15T12:00:00.000Z"
          },
          {
            "name": "finishDt",
            "in": "query",
            "required": false,
            "description": "Можно передать header `finishDt` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "example": "2026-01-15T12:00:00.000Z"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_states_activity>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_states_activity"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "minStartDt": "2026-01-15T12:00:00.000Z",
                    "list": [
                      {
                        "ID": null,
                        "cID": null,
                        "dt": null,
                        "iterationKey": null,
                        "dayKey": null,
                        "monthKey": null,
                        "session": null,
                        "authorID": null,
                        "apiTokenID": null,
                        "snapshot": null,
                        "resParentID": null,
                        "resID": null,
                        "resType": null,
                        "changes": null,
                        "parentLogID": null
                      }
                    ],
                    "tasks": {},
                    "meetings": {},
                    "products": {},
                    "repositories": {},
                    "nextCursor": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid parameters (resID specified without resTypeGroup or author=others without userID)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid parameters (resID specified without resTypeGroup or author=others without userID)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Non-admin user attempted to watch activity logs of another user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Non-admin user attempted to watch activity logs of another user",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Entity of the specified resTypeGroup not found by resID",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Entity of the specified resTypeGroup not found by resID",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesActivityResponse = IServerResponse<Resp_states_activity>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/activity?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/activity', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_states_activity>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/dashboard-page": {
      "get": {
        "operationId": "states_dashboard-page",
        "summary": "🔒 Получение состояния главной страницы пользователя (активные задачи и встречи).",
        "description": "Получение состояния главной страницы пользователя (активные задачи и встречи).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:allowed-products`, `task:read`, `meeting:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/dashboard-page`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesDashboardPageParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesDashboardPageResponse = IServerResponse<Resp_states_dashboard-page>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_states_dashboard-page>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_states_dashboard-page"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "tasks": [
                      {}
                    ],
                    "meeting": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "featureID": "00000000-0000-4000-8000-000000000001",
                      "entityType": null,
                      "entityID": "00000000-0000-4000-8000-000000000001",
                      "title": "string",
                      "agenda": "string",
                      "summary": "string",
                      "resolution": "string",
                      "startDtEstimated": "2026-01-15T12:00:00.000Z",
                      "endDtEstimated": "2026-01-15T12:00:00.000Z",
                      "startDtFact": "2026-01-15T12:00:00.000Z",
                      "endDtFact": "2026-01-15T12:00:00.000Z",
                      "location": "string",
                      "type": null,
                      "link": "string",
                      "participants": {},
                      "online": {
                        "integrationID": null,
                        "service": null,
                        "roomID": null,
                        "callID": null,
                        "passcode": null
                      },
                      "createdDT": "2026-01-15T12:00:00.000Z",
                      "createdUID": "00000000-0000-4000-8000-000000000001",
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updTS": 0,
                      "updUID": "string"
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired user:allowed-products - another user queue (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired user:allowed-products - another user queue (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesDashboardPageResponse = IServerResponse<Resp_states_dashboard-page>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/dashboard-page?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/dashboard-page', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_states_dashboard-page>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/entity-costs": {
      "get": {
        "operationId": "states_entity-costs",
        "summary": "🔒 Получение статистики затрат времени и денег по задаче, ошибке или фиче.",
        "description": "Получение статистики затрат времени и денег по задаче, ошибке или фиче.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `feature:read`, `task:costs`, `feature:costs` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/entity-costs`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesEntityCostsParams {\n  type: states_entity_costs_type\n  ID: string\n  iterationKey?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesEntityCostsResponse = IServerResponse<CostInfo>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/states_entity_costs_type"
            },
            "example": "task"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "iterationKey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `iterationKey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<CostInfo>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/CostInfo"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid entity type provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid entity type provided",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:read / feature:read (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:read / feature:read (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified entity ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified entity ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesEntityCostsResponse = IServerResponse<CostInfo>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/entity-costs?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/entity-costs', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<CostInfo>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/entity-page": {
      "get": {
        "operationId": "states_entity-page",
        "summary": "🔒 Получение состояния для компонента EntityPage (карточка задачи, баги или фичи).",
        "description": "Получение состояния для компонента EntityPage (карточка задачи, баги или фичи).\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `task:read`, `task:read-drafts`, `feature:read`, `product:read`, `version:read`, `task:costs`, `feature:costs` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/entity-page`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesEntityPageParams {\n  type: string\n  ID: string\n  iterationKey?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesEntityPageResponse = IServerResponse<Resp_states_entity-page>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "iterationKey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `iterationKey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_states_entity-page>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_states_entity-page"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "task": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "featureID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "status": null,
                      "state": null,
                      "category": null,
                      "type": null,
                      "priority": null,
                      "urgently": 0,
                      "title": "string",
                      "searchTitle": "string",
                      "key": 0,
                      "currentAssignee": "string",
                      "ord": 0,
                      "spec": "string",
                      "gist": "string",
                      "modules": {},
                      "components": {},
                      "approvalAssignee": "string",
                      "workAssignee": "string",
                      "workIterationKey": 0,
                      "workTimePlan": 0,
                      "workEvaluation": 0,
                      "reviewAssignee": "string",
                      "testAssignee": "string",
                      "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                      "resolutionType": null,
                      "resolutionNote": "string",
                      "result": "string",
                      "meta": {},
                      "git": {},
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "creatorUID": "00000000-0000-4000-8000-000000000001",
                      "stage": null,
                      "browser": null,
                      "bugType": null,
                      "build": "string",
                      "devices": [
                        null
                      ],
                      "labels": [
                        null
                      ],
                      "fuzzy": false,
                      "updTS": 0,
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updUID": "string",
                      "rejectUID": "string",
                      "rejectTS": 0
                    },
                    "bug": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "featureID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "status": null,
                      "state": null,
                      "category": null,
                      "type": null,
                      "priority": null,
                      "urgently": 0,
                      "title": "string",
                      "searchTitle": "string",
                      "key": 0,
                      "currentAssignee": "string",
                      "ord": 0,
                      "spec": "string",
                      "gist": "string",
                      "modules": {},
                      "components": {},
                      "approvalAssignee": "string",
                      "workAssignee": "string",
                      "workIterationKey": 0,
                      "workTimePlan": 0,
                      "workEvaluation": 0,
                      "reviewAssignee": "string",
                      "testAssignee": "string",
                      "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                      "resolutionType": null,
                      "resolutionNote": "string",
                      "result": "string",
                      "meta": {},
                      "git": {},
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "creatorUID": "00000000-0000-4000-8000-000000000001",
                      "stage": null,
                      "browser": null,
                      "bugType": null,
                      "build": "string",
                      "devices": [
                        null
                      ],
                      "labels": [
                        null
                      ],
                      "fuzzy": false,
                      "updTS": 0,
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updUID": "string",
                      "rejectUID": "string",
                      "rejectTS": 0
                    },
                    "feature": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "key": 0,
                      "title": "string",
                      "status": 0,
                      "spec": "string",
                      "gist": "string",
                      "meta": {},
                      "analyticAssignee": "string",
                      "ord": 0,
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updTS": 0,
                      "updUID": "string"
                    },
                    "commitsCount": 0,
                    "chatMessagesCount": 0,
                    "featureComponents": {
                      "allIDs": {}
                    },
                    "designs": {},
                    "relations": {},
                    "costs": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesEntityPageResponse = IServerResponse<Resp_states_entity-page>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/entity-page?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/entity-page', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_states_entity-page>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/states/kanban-page": {
      "get": {
        "operationId": "states_kanban-page",
        "summary": "🔒 Получение данных канбан-доски за указанную или текущую итерацию.",
        "description": "Получение данных канбан-доски за указанную или текущую итерацию.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /states/kanban-page`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface StatesKanbanPageParams {\n  iterationKey?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type StatesKanbanPageResponse = IServerResponse<Resp_states_kanban-page>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "States"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "iterationKey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `iterationKey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_states_kanban-page>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_states_kanban-page"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "group": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: StatesKanbanPageResponse = IServerResponse<Resp_states_kanban-page>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/states/kanban-page?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'states/kanban-page', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_states_kanban-page>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/sse/confirm-resync": {
      "get": {
        "operationId": "sse_confirm-resync",
        "summary": "🔒 Подтверждение успешного применения forceLastUpdTS / ресинхронизации стейта клиентом.",
        "description": "Подтверждение успешного применения forceLastUpdTS / ресинхронизации стейта клиентом.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — technical operation of the current session\n\n### TypeScript (copy-paste)\n\n**`GET /sse/confirm-resync`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SseConfirmResyncResponse = IServerResponse<Resp_sse_confirm-resync>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "SSE"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_sse_confirm-resync>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_sse_confirm-resync"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SseConfirmResyncResponse = IServerResponse<Resp_sse_confirm-resync>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/sse/confirm-resync?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'sse/confirm-resync', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_sse_confirm-resync>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/signin/provider/complete": {
      "post": {
        "operationId": "signin_provider_complete",
        "summary": "🔓 #26810 Вход через VK ID или Яндекс ID по одноразовому билету адреса возврата: запись по привязке к провайдеру, затем по email и телефону от провайдера (найденная получает привязку; email - только подтверждённый, иначе 403 email_not_confirmed); нет - пользователь-черновик с контактами и именем провайдера. Ответ - как у `signin/auth`.",
        "description": "#26810 Вход через VK ID или Яндекс ID по одноразовому билету адреса возврата: запись по привязке к провайдеру, затем по email и телефону от провайдера (найденная получает привязку; email - только подтверждённый, иначе 403 email_not_confirmed); нет - пользователь-черновик с контактами и именем провайдера. Ответ - как у `signin/auth`.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`POST /signin/provider/complete`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface SigninProviderCompleteBody {\n  ticket: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninProviderCompleteResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: params.code - email_not_confirmed (the provider email matches a user whose email is not confirmed)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: params.code - email_not_confirmed (the provider email matches a user whose email is not confirmed)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - provider_ticket (ticket unknown, expired, used or issued for another device)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - provider_ticket (ticket unknown, expired, used or issued for another device)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninProviderCompleteResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/provider/complete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SigninProviderCompleteBody"
              },
              "example": {
                "ticket": "string"
              }
            }
          }
        }
      }
    },
    "/signin/provider/start": {
      "post": {
        "operationId": "signin_provider_start",
        "summary": "🔓 #26810 Начало входа через VK ID или Яндекс ID: адрес провайдера с одноразовым state (10 минут) и PKCE. Завершение - на устройстве, начавшем вход (`signin/provider/complete`).",
        "description": "#26810 Начало входа через VK ID или Яндекс ID: адрес провайдера с одноразовым state (10 минут) и PKCE. Завершение - на устройстве, начавшем вход (`signin/provider/complete`).\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`POST /signin/provider/start`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface SigninProviderStartBody {\n  provider: User_Provider\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninProviderStartResponse = IServerResponse<Resp_signin_provider_start>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_signin_provider_start>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_signin_provider_start"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "url": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - provider_disabled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - provider_disabled",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninProviderStartResponse = IServerResponse<Resp_signin_provider_start>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/provider/start?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_signin_provider_start>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SigninProviderStartBody"
              },
              "example": {
                "provider": "vkid"
              }
            }
          }
        }
      }
    },
    "/signin/auth": {
      "get": {
        "operationId": "signin_auth",
        "summary": "🔓 Авторизация пользователя по телефону или email и 4-значному коду (#26729). Новый контакт - пользователь-черновик с подтверждённым контактом. Email входит только подтверждённый: ввёл администратор, а владелец не подтверждал - 403 email_not_confirmed.",
        "description": "Авторизация пользователя по телефону или email и 4-значному коду (#26729). Новый контакт - пользователь-черновик с подтверждённым контактом. Email входит только подтверждённый: ввёл администратор, а владелец не подтверждал - 403 email_not_confirmed.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`GET /signin/auth`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface SigninAuthParams {\n  phone?: string | null\n  email?: string | null\n  code: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninAuthResponse = IServerResponse<Resp_signin_auth>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "Можно передать header `phone` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Можно передать header `email` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "Можно передать header `code` (сервер мержит headers+query)",
            "schema": {
              "type": "integer"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_signin_auth>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_signin_auth"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "session": null,
                    "currentUser": {},
                    "company": {
                      "ID": null,
                      "title": null,
                      "logoFID": null,
                      "phone": null,
                      "email": null,
                      "url": null,
                      "description": null,
                      "address": null,
                      "foundationDT": null,
                      "country": null,
                      "defaultMarginPercent": null,
                      "demoSet": null,
                      "testSlot": null,
                      "agentPrices": null,
                      "docs": null,
                      "timeZone": null,
                      "language": null,
                      "activityType": null,
                      "activityDescription": null,
                      "titleHash": null,
                      "updTS": null,
                      "updUID": null,
                      "createDT": null,
                      "createUID": null
                    },
                    "dictionaries": null,
                    "availableCompanies": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: params.code - code_wrong (code does not match), email_not_confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: params.code - code_wrong (code does not match), email_not_confirmed",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - code_not_found (code was not requested or has expired)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - code_not_found (code was not requested or has expired)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - code_attempts_exceeded, code_daily_exceeded, code_ip_blocked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - code_attempts_exceeded, code_daily_exceeded, code_ip_blocked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninAuthResponse = IServerResponse<Resp_signin_auth>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/auth?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_signin_auth>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/signin/code": {
      "get": {
        "operationId": "signin_code",
        "summary": "🔓 Запрос кода входа на телефон или email (#26729): код действует 5 минут, пока он действует, новый не выдаётся. Число запросов и неверных попыток на контакт ограничено. Email - только при настроенной почте.",
        "description": "Запрос кода входа на телефон или email (#26729): код действует 5 минут, пока он действует, новый не выдаётся. Число запросов и неверных попыток на контакт ограничено. Email - только при настроенной почте.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`GET /signin/code`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface SigninCodeParams {\n  phone?: string | null\n  email?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninCodeResponse = IServerResponse<Resp_signin_code>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "Можно передать header `phone` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Можно передать header `email` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_signin_code>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_signin_code"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "codeStatus": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: exactly one of phone or email is required, or the contact is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: exactly one of phone or email is required, or the contact is invalid",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - code_already_sent (active code exists), code_requests_exceeded, code_send_failed, email_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - code_already_sent (active code exists), code_requests_exceeded, code_send_failed, email_unavailable",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninCodeResponse = IServerResponse<Resp_signin_code>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/code?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_signin_code>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/signin/company": {
      "get": {
        "operationId": "signin_company",
        "summary": "🔒 Переключение активной компании пользователя.",
        "description": "Переключение активной компании пользователя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — switching the session company: access to the target company is checked by its UserAccess\n\n### TypeScript (copy-paste)\n\n**`GET /signin/company`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface SigninCompanyParams {\n  cID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninCompanyResponse = IServerResponse<Resp_signin_company>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "cID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `cID` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_signin_company>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_signin_company"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "session": null,
                    "currentUser": {},
                    "company": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "title": "string",
                      "logoFID": "00000000-0000-4000-8000-000000000001",
                      "phone": "string",
                      "email": "string",
                      "url": "string",
                      "description": "string",
                      "address": "string",
                      "foundationDT": "2026-01-15T12:00:00.000Z",
                      "country": "string",
                      "defaultMarginPercent": 0,
                      "demoSet": "string",
                      "testSlot": 0,
                      "agentPrices": {},
                      "docs": {
                        "INN": null,
                        "other1": null,
                        "other2": null,
                        "requisites": null
                      },
                      "timeZone": "Europe/Moscow",
                      "language": "string",
                      "activityType": [
                        null
                      ],
                      "activityDescription": "string",
                      "titleHash": "string",
                      "updTS": 0,
                      "updUID": "string",
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "createUID": "string"
                    },
                    "dictionaries": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: User is not a member of or blocked in requested company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: User is not a member of or blocked in requested company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified company ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified company ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninCompanyResponse = IServerResponse<Resp_signin_company>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/company?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'signin/company', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_signin_company>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/signin/handoff": {
      "post": {
        "operationId": "signin_handoff",
        "summary": "🔓 Сквозная авторизация по одноразовому handoff-коду: выпускает СОБСТВЕННУЮ сессию, дочернюю к выпустившей код. Инвалидация родителя каскадно гасит дочернюю.",
        "description": "Сквозная авторизация по одноразовому handoff-коду: выпускает СОБСТВЕННУЮ сессию, дочернюю к выпустившей код. Инвалидация родителя каскадно гасит дочернюю.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`POST /signin/handoff`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface SigninHandoffBody {\n  code: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninHandoffResponse = IServerResponse<Resp_signin_handoff>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_signin_handoff>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_signin_handoff"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "session": null,
                    "currentUser": {},
                    "company": {
                      "ID": null,
                      "title": null,
                      "logoFID": null,
                      "phone": null,
                      "email": null,
                      "url": null,
                      "description": null,
                      "address": null,
                      "foundationDT": null,
                      "country": null,
                      "defaultMarginPercent": null,
                      "demoSet": null,
                      "testSlot": null,
                      "agentPrices": null,
                      "docs": null,
                      "timeZone": null,
                      "language": null,
                      "activityType": null,
                      "activityDescription": null,
                      "titleHash": null,
                      "updTS": null,
                      "updUID": null,
                      "createDT": null,
                      "createUID": null
                    },
                    "dictionaries": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Handoff code already used, issued for another device, or parent session is no longer active",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Handoff code already used, issued for another device, or parent session is no longer active",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Handoff code not found or expired",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Handoff code not found or expired",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Handoff rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Handoff rate limit exceeded",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninHandoffResponse = IServerResponse<Resp_signin_handoff>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/handoff?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_signin_handoff>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SigninHandoffBody"
              },
              "example": {
                "code": "string"
              }
            }
          }
        }
      }
    },
    "/signin/methods": {
      "get": {
        "operationId": "signin_methods",
        "summary": "🔓 #26729 Доступные способы входа для экрана входа: email - только при настроенной почте, провайдеры - когда включены.",
        "description": "#26729 Доступные способы входа для экрана входа: email - только при настроенной почте, провайдеры - когда включены.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `read` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`GET /signin/methods`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface SigninMethodsParams {\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SigninMethodsResponse = IServerResponse<Resp_signin_methods>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_signin_methods>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_signin_methods"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "phone": {},
                    "email": false,
                    "vkid": false,
                    "yandex": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SigninMethodsResponse = IServerResponse<Resp_signin_methods>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/signin/methods?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_signin_methods>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/session/handoff": {
      "get": {
        "operationId": "session_handoff",
        "summary": "🔒 Выпуск одноразового кода сквозной авторизации (handoff) для действующей сессии. Код обменивается на дочернюю сессию через signin/handoff.",
        "description": "Выпуск одноразового кода сквозной авторизации (handoff) для действующей сессии. Код обменивается на дочернюю сессию через signin/handoff.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — handoff code of the current session\n\n### TypeScript (copy-paste)\n\n**`GET /session/handoff`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SessionHandoffResponse = IServerResponse<Resp_session_handoff>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_session_handoff>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_session_handoff"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "code": "string",
                    "expTs": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Handoff rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Handoff rate limit exceeded",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SessionHandoffResponse = IServerResponse<Resp_session_handoff>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/session/handoff?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'session/handoff', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_session_handoff>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/session/list": {
      "get": {
        "operationId": "session_list",
        "summary": "🔒 Получение списка всех активных и неактивных сессий пользователя.",
        "description": "Получение списка всех активных и неактивных сессий пользователя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `user:sessions` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /session/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface SessionListParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type SessionListResponse = IServerResponse<Resp_session_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_session_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_session_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {
                        "ID": "00000000-0000-4000-8000-000000000001",
                        "parentID": "00000000-0000-4000-8000-000000000001",
                        "expTs": {},
                        "createTs": {},
                        "lastActiveTs": {},
                        "ip": {},
                        "country": {},
                        "city": {},
                        "device": {}
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Non-admin user attempted to list active sessions of another user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Non-admin user attempted to list active sessions of another user",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: SessionListResponse = IServerResponse<Resp_session_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/session/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'session/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_session_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/relation/create": {
      "post": {
        "operationId": "relation_create",
        "summary": "🔒 Создание связи между двумя сущностями (задача, баг, фича, митинг).",
        "description": "Создание связи между двумя сущностями (задача, баг, фича, митинг).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:relations`, `task:read`, `feature:update`, `feature:read`, `meeting:update`, `meeting:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /relation/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type RelationCreateBody = Partial<Relation>\n\nexport interface RelationCreateBodyFields {\n  cID?: string\n  ID?: string\n  fromID?: string\n  fromType?: string\n  toID?: string\n  toType?: string\n  type?: RelationType\n  note?: string | null\n  meta?: Record<string, any> | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type RelationCreateResponse = IServerResponse<Relation>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Relations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Relation>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Relation"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired - relations of neither end or the other end is not visible (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired - relations of neither end or the other end is not visible (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Missing required relation parameters or target entity does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Missing required relation parameters or target entity does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: RelationCreateResponse = IServerResponse<Relation>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/relation/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'relation/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Relation>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RelationCreateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "fromID": "00000000-0000-4000-8000-000000000001",
                "fromType": "string",
                "toID": "00000000-0000-4000-8000-000000000001",
                "toType": "string",
                "type": "blocker",
                "note": "string",
                "meta": {},
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/relation/delete": {
      "get": {
        "operationId": "relation_delete",
        "summary": "🔒 Удаление связи между двумя сущностями.",
        "description": "Удаление связи между двумя сущностями.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:relations`, `task:read`, `feature:update`, `feature:read`, `meeting:update`, `meeting:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /relation/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface RelationDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type RelationDeleteResponse = IServerResponse<Resp_relation_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Relations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_relation_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_relation_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired - relations of neither end or the other end is not visible (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired - relations of neither end or the other end is not visible (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Relation with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Relation with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: RelationDeleteResponse = IServerResponse<Resp_relation_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/relation/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'relation/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_relation_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/relation/list": {
      "get": {
        "operationId": "relation_list",
        "summary": "🔒 Получение списка связей для задачи, баги или митинга.",
        "description": "Получение списка связей для задачи, баги или митинга.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `meeting:read`, `meeting:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /relation/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface RelationListParams {\n  refID: string\n  refType: relation_list_refType\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type RelationListResponse = IServerResponse<EntityRelationsData>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Relations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "refID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `refID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "refType",
            "in": "query",
            "required": true,
            "description": "Можно передать header `refType` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/relation_list_refType"
            },
            "example": "task"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<EntityRelationsData>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/EntityRelationsData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:read / meeting:read (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:read / meeting:read (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target reference entity (task/meeting) does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target reference entity (task/meeting) does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: RelationListResponse = IServerResponse<EntityRelationsData>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/relation/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'relation/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<EntityRelationsData>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/relation/update": {
      "post": {
        "operationId": "relation_update",
        "summary": "🔒 Изменение типа, комментария или meta связи. Концы не меняются — удали и создай новую.",
        "description": "Изменение типа, комментария или meta связи. Концы не меняются — удали и создай новую.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:relations`, `task:read`, `feature:update`, `feature:read`, `meeting:update`, `meeting:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /relation/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface RelationUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface RelationUpdateBody {\n  type?: RelationType | null\n  note?: string | null\n  meta?: Record<string, any> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type RelationUpdateResponse = IServerResponse<Relation>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Relations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Relation>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Relation"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired - relations of neither end or the other end is not visible (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired - relations of neither end or the other end is not visible (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Relation with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Relation with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid relation type or comment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid relation type or comment",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: RelationUpdateResponse = IServerResponse<Relation>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/relation/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'relation/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Relation>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RelationUpdateBody"
              },
              "example": {
                "type": "blocker",
                "note": "string",
                "meta": {}
              }
            }
          }
        }
      }
    },
    "/projects/version/create": {
      "post": {
        "operationId": "projects_version_create",
        "summary": "🔒 Создание новой версии продукта.",
        "description": "Создание новой версии продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `version:create` (все обязательны; ресурс — `productID`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/version/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsVersionCreateBody = Partial<Version>\n\nexport interface ProjectsVersionCreateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  ID?: string\n  title?: string\n  major?: number\n  minor?: number\n  build?: number | null\n  resolvedBugs?: Record<string, any> | null\n  notes?: string\n  isDone?: boolean\n  isPublished?: boolean\n  releaseDT?: string | null\n  design?: {\n  fileUrl?: string | null\n} | null\n  createDT?: string\n  updateDT?: string\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsVersionCreateResponse = IServerResponse<Version>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Versions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Version>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Version"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "major": 0,
                    "minor": 0,
                    "build": 0,
                    "resolvedBugs": {},
                    "notes": "string",
                    "isDone": false,
                    "isPublished": false,
                    "releaseDT": "2026-01-15T12:00:00.000Z",
                    "design": {
                      "fileUrl": "string"
                    },
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "updateDT": "2026-01-15T12:00:00.000Z",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege version:create required or the product is archived",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege version:create required or the product is archived",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Missing productID, or version with same ID or version numbers (major, minor, build) already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Missing productID, or version with same ID or version numbers (major, minor, build) already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsVersionCreateResponse = IServerResponse<Version>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/version/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/version/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Version>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsVersionCreateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "major": 0,
                "minor": 0,
                "build": 0,
                "resolvedBugs": {},
                "notes": "string",
                "isDone": false,
                "isPublished": false,
                "releaseDT": "2026-01-15T12:00:00.000Z",
                "design": {
                  "fileUrl": "string"
                },
                "createDT": "2026-01-15T12:00:00.000Z",
                "updateDT": "2026-01-15T12:00:00.000Z",
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/version/delete": {
      "get": {
        "operationId": "projects_version_delete",
        "summary": "🔒 Удаление (архивация) версии продукта.",
        "description": "Удаление (архивация) версии продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `version:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/version/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsVersionDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsVersionDeleteResponse = IServerResponse<Resp_projects_version_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Versions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_version_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_version_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege version:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege version:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Version with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Version with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Product backlog version cannot be deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Product backlog version cannot be deleted",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsVersionDeleteResponse = IServerResponse<Resp_projects_version_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/version/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/version/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_version_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/version/team": {
      "get": {
        "operationId": "projects_version_team",
        "summary": "🔒 projects/version/team",
        "description": "**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `version:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/version/team`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsVersionTeamParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsVersionTeamResponse = IServerResponse<Resp_projects_version_team>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Versions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_version_team>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_version_team"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "groups": [
                      null
                    ],
                    "timeSpent": 0,
                    "team": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsVersionTeamResponse = IServerResponse<Resp_projects_version_team>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/version/team?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/version/team', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_version_team>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/version/update": {
      "post": {
        "operationId": "projects_version_update",
        "summary": "🔒 Обновление параметров существующей версии продукта.",
        "description": "Обновление параметров существующей версии продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `version:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/version/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsVersionUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsVersionUpdateBody = Partial<Version>\n\nexport interface ProjectsVersionUpdateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  ID?: string\n  title?: string\n  major?: number\n  minor?: number\n  build?: number | null\n  resolvedBugs?: Record<string, any> | null\n  notes?: string\n  isDone?: boolean\n  isPublished?: boolean\n  releaseDT?: string | null\n  design?: {\n  fileUrl?: string | null\n} | null\n  createDT?: string\n  updateDT?: string\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsVersionUpdateResponse = IServerResponse<Version>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Versions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Version>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Version"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "major": 0,
                    "minor": 0,
                    "build": 0,
                    "resolvedBugs": {},
                    "notes": "string",
                    "isDone": false,
                    "isPublished": false,
                    "releaseDT": "2026-01-15T12:00:00.000Z",
                    "design": {
                      "fileUrl": "string"
                    },
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "updateDT": "2026-01-15T12:00:00.000Z",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege version:update required; version:release to change isDone, isPublished or releaseDT",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege version:update required; version:release to change isDone, isPublished or releaseDT",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Version with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Version with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: System BackLog version allows updating only notes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: System BackLog version allows updating only notes",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsVersionUpdateResponse = IServerResponse<Version>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/version/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/version/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Version>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsVersionUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "major": 0,
                "minor": 0,
                "build": 0,
                "resolvedBugs": {},
                "notes": "string",
                "isDone": false,
                "isPublished": false,
                "releaseDT": "2026-01-15T12:00:00.000Z",
                "design": {
                  "fileUrl": "string"
                },
                "createDT": "2026-01-15T12:00:00.000Z",
                "updateDT": "2026-01-15T12:00:00.000Z",
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/task/create": {
      "post": {
        "operationId": "projects_task_create",
        "summary": "🔒 Создание новой задачи в проекте.",
        "description": "Создание новой задачи в проекте.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:create` (все обязательны; ресурс — `fields.productID`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/task/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsTaskCreateBody = Partial<Task>\n\nexport interface ProjectsTaskCreateBodyFields {\n  fields?: {\n  cID: string\n  projectID: string\n  productID: string\n  versionID?: string | null\n  featureID?: string | null\n  ID: string\n  status: TaskStatus\n  state: TaskState\n  category: TaskCategory\n  type: TaskType\n  priority: TaskPriority\n  urgently?: number | null\n  title: string\n  searchTitle: string\n  key: number\n  currentAssignee: string\n  ord: number\n  spec: string\n  gist?: string | null\n  modules?: Record<string, any> | null\n  components?: Record<string, any> | null\n  approvalAssignee?: string | null\n  workAssignee: string\n  workIterationKey?: number | null\n  workTimePlan?: number | null\n  workEvaluation?: number | null\n  reviewAssignee?: string | null\n  testAssignee?: string | null\n  resolutionVersionID?: string | null\n  resolutionType?: TaskResolutionType | null\n  resolutionNote?: string | null\n  result?: string | null\n  meta?: Record<string, any> | null\n  git?: Record<string, any> | null\n  createDT: string\n  creatorUID: string\n  stage: TaskStageType\n  browser?: TaskBrowser | null\n  bugType?: TaskBugType | null\n  build?: string | null\n  devices?: Array<any> | null\n  labels?: Array<any> | null\n  fuzzy?: boolean | null\n  updTS: number\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  updUID: string\n  rejectUID?: string | null\n  rejectTS?: number | null\n}\n  relations?: Array<any> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskCreateResponse = IServerResponse<Task>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Task>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "status": 0,
                    "state": -1,
                    "category": 1,
                    "type": 11,
                    "priority": -10,
                    "urgently": 0,
                    "title": "string",
                    "searchTitle": "string",
                    "key": 0,
                    "currentAssignee": "string",
                    "ord": 0,
                    "spec": "string",
                    "gist": "string",
                    "modules": {},
                    "components": {},
                    "approvalAssignee": "string",
                    "workAssignee": "string",
                    "workIterationKey": 0,
                    "workTimePlan": 0,
                    "workEvaluation": 0,
                    "reviewAssignee": "string",
                    "testAssignee": "string",
                    "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                    "resolutionType": 0,
                    "resolutionNote": "string",
                    "result": "string",
                    "meta": {},
                    "git": {},
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "creatorUID": "00000000-0000-4000-8000-000000000001",
                    "stage": 0,
                    "browser": 0,
                    "bugType": 10,
                    "build": "string",
                    "devices": [
                      {}
                    ],
                    "labels": [
                      {}
                    ],
                    "fuzzy": false,
                    "updTS": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updUID": "string",
                    "rejectUID": "string",
                    "rejectTS": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Authentication is required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: User does not have access to the product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: User does not have access to the product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified parent project, feature, or module not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified parent project, feature, or module not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid task fields or parameters provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid task fields or parameters provided",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskCreateResponse = IServerResponse<Task>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Task>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsTaskCreateBody"
              },
              "example": {
                "fields": {
                  "cID": "00000000-0000-4000-8000-000000000001",
                  "projectID": "00000000-0000-4000-8000-000000000001",
                  "productID": "00000000-0000-4000-8000-000000000001",
                  "versionID": "00000000-0000-4000-8000-000000000001",
                  "featureID": "00000000-0000-4000-8000-000000000001",
                  "ID": "00000000-0000-4000-8000-000000000001",
                  "status": 0,
                  "state": -1,
                  "category": 1,
                  "type": 11,
                  "priority": -10,
                  "urgently": 0,
                  "title": "string",
                  "searchTitle": "string",
                  "key": 0,
                  "currentAssignee": "string",
                  "ord": 0,
                  "spec": "string",
                  "gist": "string",
                  "modules": {},
                  "components": {},
                  "approvalAssignee": "string",
                  "workAssignee": "string",
                  "workIterationKey": 0,
                  "workTimePlan": 0,
                  "workEvaluation": 0,
                  "reviewAssignee": "string",
                  "testAssignee": "string",
                  "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                  "resolutionType": 0,
                  "resolutionNote": "string",
                  "result": "string",
                  "meta": {},
                  "git": {},
                  "createDT": "2026-01-15T12:00:00.000Z",
                  "creatorUID": "00000000-0000-4000-8000-000000000001",
                  "stage": 0,
                  "browser": 0,
                  "bugType": 10,
                  "build": "string",
                  "devices": [
                    {}
                  ],
                  "labels": [
                    {}
                  ],
                  "fuzzy": false,
                  "updTS": 0,
                  "isDeleted": false,
                  "deletedTS": 0,
                  "updUID": "string",
                  "rejectUID": "string",
                  "rejectTS": 0
                },
                "relations": [
                  {}
                ]
              }
            }
          }
        }
      }
    },
    "/projects/task/delete": {
      "get": {
        "operationId": "projects_task_delete",
        "summary": "🔒 Удаление (архивация) задачи.",
        "description": "Удаление (архивация) задачи.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:delete`, `task:delete-draft` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/task/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskDeleteResponse = IServerResponse<Resp_projects_task_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_task_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_task_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:delete; own draft - task:delete-draft (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:delete; own draft - task:delete-draft (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Task with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Task with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskDeleteResponse = IServerResponse<Resp_projects_task_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_task_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/task/get": {
      "get": {
        "operationId": "projects_task_get",
        "summary": "🔒 Получение подробной информации о задаче по ID или по номеру (key).",
        "description": "Получение подробной информации о задаче по ID или по номеру (key).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `task:read-drafts` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/task/get`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskGetParams {\n  ID?: string | null\n  key?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskGetResponse = IServerResponse<TaskWithSpentTime>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "Можно передать header `key` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<TaskWithSpentTime>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskWithSpentTime"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:read; foreign draft - task:read-drafts (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:read; foreign draft - task:read-drafts (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Task with specified ID or key does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Task with specified ID or key does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: ID or key is required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: ID or key is required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskGetResponse = IServerResponse<TaskWithSpentTime>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/get?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/get', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<TaskWithSpentTime>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/task/list": {
      "get": {
        "operationId": "projects_task_list",
        "summary": "🔒 Получение списка задач с фильтрацией по сущностям, категориям, исполнителям и пагинацией.",
        "description": "Получение списка задач с фильтрацией по сущностям, категориям, исполнителям и пагинацией.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `task:read-drafts` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/task/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskListParams {\n  ID?: string | null\n  type?: EntityType | null\n  resolutionVersionID?: string | null\n  allNestedTasks?: boolean | null\n  notClosed?: boolean | null\n  category?: TaskCategory | null\n  status?: TaskStatus | null\n  components?: Array<string> | null\n  currentAssignee?: string | null\n  nextCursor?: string | null\n  sortBy?: projects_task_list_sortBy\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskListResponse = IServerResponse<Resp_projects_task_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/EntityType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "project"
          },
          {
            "name": "resolutionVersionID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `resolutionVersionID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "allNestedTasks",
            "in": "query",
            "required": false,
            "description": "Можно передать header `allNestedTasks` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false
            },
            "example": false
          },
          {
            "name": "notClosed",
            "in": "query",
            "required": false,
            "description": "Можно передать header `notClosed` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false
            },
            "example": false
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Можно передать header `category` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TaskCategory"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": 1
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Можно передать header `status` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TaskStatus"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": 0
          },
          {
            "name": "components",
            "in": "query",
            "required": false,
            "description": "Можно передать header `components` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "example": [
              "00000000-0000-4000-8000-000000000001"
            ]
          },
          {
            "name": "currentAssignee",
            "in": "query",
            "required": false,
            "description": "Можно передать header `currentAssignee` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "pattern": "^(any|[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12})$"
            },
            "example": "string"
          },
          {
            "name": "nextCursor",
            "in": "query",
            "required": false,
            "description": "Можно передать header `nextCursor` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "Можно передать header `sortBy` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/projects_task_list_sortBy",
              "default": "ord"
            },
            "example": "ord"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_task_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_task_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {}
                    ],
                    "categories": {},
                    "nextCursor": "string",
                    "filters": {
                      "statuses": [
                        {}
                      ]
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid entity type or invalid cursor provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid entity type or invalid cursor provided",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Filter entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Filter entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskListResponse = IServerResponse<Resp_projects_task_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_task_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/task/reopen": {
      "post": {
        "operationId": "projects_task_reopen",
        "summary": "🔒 Повторное открытие (переоткрытие) закрытой задачи.",
        "description": "Повторное открытие (переоткрытие) закрытой задачи.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:reopen` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/task/reopen`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskReopenParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsTaskReopenBody {\n  resolutionType?: TaskResolutionType | null\n  resolutionNote?: string | null\n  workAssignee: string\n  workIterationKey: number\n  workTimePlan?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskReopenResponse = IServerResponse<Task>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Task>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "status": 0,
                    "state": -1,
                    "category": 1,
                    "type": 11,
                    "priority": -10,
                    "urgently": 0,
                    "title": "string",
                    "searchTitle": "string",
                    "key": 0,
                    "currentAssignee": "string",
                    "ord": 0,
                    "spec": "string",
                    "gist": "string",
                    "modules": {},
                    "components": {},
                    "approvalAssignee": "string",
                    "workAssignee": "string",
                    "workIterationKey": 0,
                    "workTimePlan": 0,
                    "workEvaluation": 0,
                    "reviewAssignee": "string",
                    "testAssignee": "string",
                    "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                    "resolutionType": 0,
                    "resolutionNote": "string",
                    "result": "string",
                    "meta": {},
                    "git": {},
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "creatorUID": "00000000-0000-4000-8000-000000000001",
                    "stage": 0,
                    "browser": 0,
                    "bugType": 10,
                    "build": "string",
                    "devices": [
                      {}
                    ],
                    "labels": [
                      {}
                    ],
                    "fuzzy": false,
                    "updTS": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updUID": "string",
                    "rejectUID": "string",
                    "rejectTS": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:reopen (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:reopen (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified task or the assignee in the company does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified task or the assignee in the company does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Task is not closed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Task is not closed",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskReopenResponse = IServerResponse<Task>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/reopen?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/reopen', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Task>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsTaskReopenBody"
              },
              "example": {
                "resolutionType": 0,
                "resolutionNote": "string",
                "workAssignee": "string",
                "workIterationKey": 0,
                "workTimePlan": 0
              }
            }
          }
        }
      }
    },
    "/projects/task/resolutes": {
      "get": {
        "operationId": "projects_task_resolutes",
        "summary": "🔒 Получение списка исправленных багов по версиям для сущности.",
        "description": "Получение списка исправленных багов по версиям для сущности.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `task:read-drafts` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/task/resolutes`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskResolutesParams {\n  type: EntityType\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskResolutesResponse = IServerResponse<Resp_projects_task_resolutes>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/EntityType"
            },
            "example": "project"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_task_resolutes>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_task_resolutes"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid entity type provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid entity type provided",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target filter entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target filter entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskResolutesResponse = IServerResponse<Resp_projects_task_resolutes>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/resolutes?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/resolutes', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_task_resolutes>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/task/search": {
      "get": {
        "operationId": "projects_task_search",
        "summary": "🔒 Поиск задач по номеру (ключу) либо гибридным текстовым поиском по названию, постановке и результату. Пустой запрос вместе с featureID отдаёт короткий список задач и ошибок этой фичи.",
        "description": "Поиск задач по номеру (ключу) либо гибридным текстовым поиском по названию, постановке и результату. Пустой запрос вместе с featureID отдаёт короткий список задач и ошибок этой фичи.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `task:read-drafts` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/task/search`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskSearchParams {\n  query: string\n  prjID?: string | null\n  productID?: string | null\n  featureID?: string | null\n  sourceTaskID?: string | null\n  relationType?: string | null\n  limit?: number | null\n  cursor?: string | null\n  category?: TaskCategory | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskSearchResponse = IServerResponse<Resp_projects_task_search>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "Можно передать header `query` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "prjID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `prjID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "productID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `productID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "featureID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `featureID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "sourceTaskID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `sourceTaskID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "relationType",
            "in": "query",
            "required": false,
            "description": "Можно передать header `relationType` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Можно передать header `limit` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 50
            },
            "example": 0
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Можно передать header `cursor` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Можно передать header `category` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TaskCategory"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": 1
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_task_search>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_task_search"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid search cursor",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid search cursor",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskSearchResponse = IServerResponse<Resp_projects_task_search>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/search?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/search', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_task_search>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/task/switch": {
      "post": {
        "operationId": "projects_task_switch",
        "summary": "🔒 Перевод жизненного цикла (статуса и состояния) задачи.",
        "description": "Перевод жизненного цикла (статуса и состояния) задачи.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:publish`, `task:work`, `task:pause`, `task:approve`, `task:done`, `task:review`, `task:deploy`, `task:test`, `task:close`, `task:reopen` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/task/switch`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskSwitchParams {\n  ID: string\n  transition: TaskTransition\n  resolutionType?: TaskResolutionType | null\n  resolutionNote?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsTaskSwitchBody {\n  comment?: {\n  text: string\n  mentioned?: Record<string, any> | null\n  attachments?: Array<any> | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskSwitchResponse = IServerResponse<Task>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "transition",
            "in": "query",
            "required": true,
            "description": "Можно передать header `transition` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/TaskTransition"
            },
            "example": 1
          },
          {
            "name": "resolutionType",
            "in": "query",
            "required": false,
            "description": "Можно передать header `resolutionType` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TaskResolutionType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": 0
          },
          {
            "name": "resolutionNote",
            "in": "query",
            "required": false,
            "description": "Можно передать header `resolutionNote` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Task>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "status": 0,
                    "state": -1,
                    "category": 1,
                    "type": 11,
                    "priority": -10,
                    "urgently": 0,
                    "title": "string",
                    "searchTitle": "string",
                    "key": 0,
                    "currentAssignee": "string",
                    "ord": 0,
                    "spec": "string",
                    "gist": "string",
                    "modules": {},
                    "components": {},
                    "approvalAssignee": "string",
                    "workAssignee": "string",
                    "workIterationKey": 0,
                    "workTimePlan": 0,
                    "workEvaluation": 0,
                    "reviewAssignee": "string",
                    "testAssignee": "string",
                    "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                    "resolutionType": 0,
                    "resolutionNote": "string",
                    "result": "string",
                    "meta": {},
                    "git": {},
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "creatorUID": "00000000-0000-4000-8000-000000000001",
                    "stage": 0,
                    "browser": 0,
                    "bugType": 10,
                    "build": "string",
                    "devices": [
                      {}
                    ],
                    "labels": [
                      {}
                    ],
                    "fuzzy": false,
                    "updTS": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updUID": "string",
                    "rejectUID": "string",
                    "rejectTS": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired - no privilege of the transition to the task (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired - no privilege of the transition to the task (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified task ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified task ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Transition is not possible in the current task state or archived product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Transition is not possible in the current task state or archived product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskSwitchResponse = IServerResponse<Task>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/switch?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/switch', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Task>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsTaskSwitchBody"
              },
              "example": {
                "comment": {
                  "text": "string",
                  "mentioned": {},
                  "attachments": [
                    {}
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/projects/task/update": {
      "post": {
        "operationId": "projects_task_update",
        "summary": "🔒 Обновление существующей задачи: любые поля ITask - атрибуты, спецификация и результат, исполнители этапов, привязки к фиче/версии, затронутые модули и компоненты.",
        "description": "Обновление существующей задачи: любые поля ITask - атрибуты, спецификация и результат, исполнители этапов, привязки к фиче/версии, затронутые модули и компоненты.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:update`, `task:move`, `task:approve` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/task/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsTaskUpdateBody = Partial<Task>\n\nexport interface ProjectsTaskUpdateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  versionID?: string | null\n  featureID?: string | null\n  ID?: string\n  status?: TaskStatus\n  state?: TaskState\n  category?: TaskCategory\n  type?: TaskType\n  priority?: TaskPriority\n  urgently?: number | null\n  title?: string\n  searchTitle?: string\n  key?: number\n  currentAssignee?: string\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  spec?: string\n  gist?: string | null\n  modules?: Record<string, any> | null\n  components?: Record<string, any> | null\n  approvalAssignee?: string | null\n  workAssignee?: string\n  workIterationKey?: number | null\n  workTimePlan?: number | null\n  workEvaluation?: number | null\n  reviewAssignee?: string | null\n  testAssignee?: string | null\n  resolutionVersionID?: string | null\n  resolutionType?: TaskResolutionType | null\n  resolutionNote?: string | null\n  result?: string | null\n  meta?: Record<string, any> | null\n  git?: Record<string, any> | null\n  createDT?: string\n  creatorUID?: string\n  stage?: TaskStageType\n  browser?: TaskBrowser | null\n  bugType?: TaskBugType | null\n  build?: string | null\n  devices?: Array<any> | null\n  labels?: Array<any> | null\n  fuzzy?: boolean | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  updUID?: string\n  rejectUID?: string | null\n  rejectTS?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskUpdateResponse = IServerResponse<Task>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Task>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "status": 0,
                    "state": -1,
                    "category": 1,
                    "type": 11,
                    "priority": -10,
                    "urgently": 0,
                    "title": "string",
                    "searchTitle": "string",
                    "key": 0,
                    "currentAssignee": "string",
                    "ord": 0,
                    "spec": "string",
                    "gist": "string",
                    "modules": {},
                    "components": {},
                    "approvalAssignee": "string",
                    "workAssignee": "string",
                    "workIterationKey": 0,
                    "workTimePlan": 0,
                    "workEvaluation": 0,
                    "reviewAssignee": "string",
                    "testAssignee": "string",
                    "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                    "resolutionType": 0,
                    "resolutionNote": "string",
                    "result": "string",
                    "meta": {},
                    "git": {},
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "creatorUID": "00000000-0000-4000-8000-000000000001",
                    "stage": 0,
                    "browser": 0,
                    "bugType": 10,
                    "build": "string",
                    "devices": [
                      {}
                    ],
                    "labels": [
                      {}
                    ],
                    "fuzzy": false,
                    "updTS": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updUID": "string",
                    "rejectUID": "string",
                    "rejectTS": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Authentication is required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:update / task:move / task:approve; result - task:update own or self (params.allow, params.relation)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:update / task:move / task:approve; result - task:update own or self (params.allow, params.relation)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Task with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Task with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Specification revision conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Specification revision conflict",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskUpdateResponse = IServerResponse<Task>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Task>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsTaskUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "versionID": "00000000-0000-4000-8000-000000000001",
                "featureID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "status": 0,
                "state": -1,
                "category": 1,
                "type": 11,
                "priority": -10,
                "urgently": 0,
                "title": "string",
                "searchTitle": "string",
                "key": 0,
                "currentAssignee": "string",
                "ord": 0,
                "spec": "string",
                "gist": "string",
                "modules": {},
                "components": {},
                "approvalAssignee": "string",
                "workAssignee": "string",
                "workIterationKey": 0,
                "workTimePlan": 0,
                "workEvaluation": 0,
                "reviewAssignee": "string",
                "testAssignee": "string",
                "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                "resolutionType": 0,
                "resolutionNote": "string",
                "result": "string",
                "meta": {},
                "git": {},
                "createDT": "2026-01-15T12:00:00.000Z",
                "creatorUID": "00000000-0000-4000-8000-000000000001",
                "stage": 0,
                "browser": 0,
                "bugType": 10,
                "build": "string",
                "devices": [
                  {}
                ],
                "labels": [
                  {}
                ],
                "fuzzy": false,
                "updTS": 0,
                "isDeleted": false,
                "deletedTS": 0,
                "updUID": "string",
                "rejectUID": "string",
                "rejectTS": 0
              }
            }
          }
        }
      }
    },
    "/projects/task/work-evaluation": {
      "post": {
        "operationId": "projects_task_work-evaluation",
        "summary": "🔒 #26682 Ручная правка итогового коэффициента исполнения задачи (workEvaluation): лид отдела исполнителя, руководитель продукта, администратор. Правка помечается и не перезаписывается автоматической переоценкой.",
        "description": "#26682 Ручная правка итогового коэффициента исполнения задачи (workEvaluation): лид отдела исполнителя, руководитель продукта, администратор. Правка помечается и не перезаписывается автоматической переоценкой.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:work-evaluation` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/task/work-evaluation`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsTaskWorkEvaluationBody {\n  taskID: string\n  value?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskWorkEvaluationResponse = IServerResponse<Resp_projects_task_work-evaluation>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_task_work-evaluation>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_task_work-evaluation"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "workEvaluation": 0,
                    "correction": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:work-evaluation (params.allow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:work-evaluation (params.allow)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: the task does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: the task does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the value is not 0-2 with step 0.1 (reason: factor) or the task is a draft (reason: draft)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the value is not 0-2 with step 0.1 (reason: factor) or the task is a draft (reason: draft)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskWorkEvaluationResponse = IServerResponse<Resp_projects_task_work-evaluation>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/work-evaluation?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/work-evaluation', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_task_work-evaluation>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsTaskWorkEvaluationBody"
              },
              "example": {
                "taskID": "00000000-0000-4000-8000-000000000001",
                "value": 0
              }
            }
          }
        }
      }
    },
    "/projects/task/worklogs": {
      "get": {
        "operationId": "projects_task_worklogs",
        "summary": "🔒 Получение статистики и сгруппированных ворклогов по задаче.",
        "description": "Получение статистики и сгруппированных ворклогов по задаче.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/task/worklogs`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsTaskWorklogsParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsTaskWorklogsResponse = IServerResponse<Resp_projects_task_worklogs>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Tasks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_task_worklogs>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_task_worklogs"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "task": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "featureID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "status": null,
                      "state": null,
                      "category": null,
                      "type": null,
                      "priority": null,
                      "urgently": 0,
                      "title": "string",
                      "searchTitle": "string",
                      "key": 0,
                      "currentAssignee": "string",
                      "ord": 0,
                      "spec": "string",
                      "gist": "string",
                      "modules": {},
                      "components": {},
                      "approvalAssignee": "string",
                      "workAssignee": "string",
                      "workIterationKey": 0,
                      "workTimePlan": 0,
                      "workEvaluation": 0,
                      "reviewAssignee": "string",
                      "testAssignee": "string",
                      "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                      "resolutionType": null,
                      "resolutionNote": "string",
                      "result": "string",
                      "meta": {},
                      "git": {},
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "creatorUID": "00000000-0000-4000-8000-000000000001",
                      "stage": null,
                      "browser": null,
                      "bugType": null,
                      "build": "string",
                      "devices": [
                        null
                      ],
                      "labels": [
                        null
                      ],
                      "fuzzy": false,
                      "updTS": 0,
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updUID": "string",
                      "rejectUID": "string",
                      "rejectTS": 0
                    },
                    "groups": [
                      null
                    ],
                    "timeSpent": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Task with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Task with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsTaskWorklogsResponse = IServerResponse<Resp_projects_task_worklogs>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/task/worklogs?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/task/worklogs', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_task_worklogs>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/project/repository/link": {
      "post": {
        "operationId": "projects_project_repository_link",
        "summary": "🔒 Подключить репозиторий Git-интеграции к проекту с выбором доступа ИИ-агентов: с этого момента он синхронизируется; повторный вызов меняет доступ агентов у существующей связи.",
        "description": "Подключить репозиторий Git-интеграции к проекту с выбором доступа ИИ-агентов: с этого момента он синхронизируется; повторный вызов меняет доступ агентов у существующей связи.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `project:update`, `integration:git` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/project/repository/link`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProjectRepositoryLinkParams {\n  ID: string\n  repositoryID: string\n  agentAccess?: ProjectRepository_AgentAccess | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsProjectRepositoryLinkBody {\n  agentAccess?: ProjectRepository_AgentAccess | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProjectRepositoryLinkResponse = IServerResponse<Resp_projects_project_repository_link>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "repositoryID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `repositoryID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "agentAccess",
            "in": "query",
            "required": false,
            "description": "Можно передать header `agentAccess` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/ProjectRepository_AgentAccess"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "read"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_project_repository_link>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_project_repository_link"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "link": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "repositoryID": "00000000-0000-4000-8000-000000000001",
                      "integrationID": "00000000-0000-4000-8000-000000000001",
                      "agentAccess": null,
                      "createdUID": "00000000-0000-4000-8000-000000000001",
                      "createdDT": "2026-01-15T12:00:00.000Z",
                      "updTS": 0
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege project:update (to the project) or integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege project:update (to the project) or integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Project or repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Project or repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Repository was removed at provider",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Repository was removed at provider",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProjectRepositoryLinkResponse = IServerResponse<Resp_projects_project_repository_link>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/project/repository/link?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/project/repository/link', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_project_repository_link>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsProjectRepositoryLinkBody"
              },
              "example": {
                "agentAccess": "read"
              }
            }
          }
        }
      }
    },
    "/projects/project/repository/list": {
      "get": {
        "operationId": "projects_project_repository_list",
        "summary": "🔒 Репозитории Git-интеграций, подключённые к проекту.",
        "description": "Репозитории Git-интеграций, подключённые к проекту.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `project:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/project/repository/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProjectRepositoryListParams {\n  ID: string\n  productID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProjectRepositoryListResponse = IServerResponse<Resp_projects_project_repository_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "productID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `productID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_project_repository_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_project_repository_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege project:read required; product:read for productID",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege project:read required; product:read for productID",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Project with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Project with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProjectRepositoryListResponse = IServerResponse<Resp_projects_project_repository_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/project/repository/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/project/repository/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_project_repository_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/project/repository/unlink": {
      "post": {
        "operationId": "projects_project_repository_unlink",
        "summary": "🔒 Отключить репозиторий от проекта. Репозиторий без проектов остаётся в каталоге интеграции, но не синхронизируется; у GitLab снимается вебхук.",
        "description": "Отключить репозиторий от проекта. Репозиторий без проектов остаётся в каталоге интеграции, но не синхронизируется; у GitLab снимается вебхук.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `project:update`, `integration:git` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/project/repository/unlink`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProjectRepositoryUnlinkParams {\n  ID: string\n  repositoryID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProjectRepositoryUnlinkResponse = IServerResponse<Resp_projects_project_repository_unlink>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "repositoryID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `repositoryID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_project_repository_unlink>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_project_repository_unlink"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege project:update (to the project) or integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege project:update (to the project) or integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProjectRepositoryUnlinkResponse = IServerResponse<Resp_projects_project_repository_unlink>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/project/repository/unlink?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/project/repository/unlink', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_project_repository_unlink>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/project/create": {
      "post": {
        "operationId": "projects_project_create",
        "summary": "🔒 Создание нового проекта компании (доступно администраторам).",
        "description": "Создание нового проекта компании (доступно администраторам).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `project:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/project/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsProjectCreateBody = Partial<Project>\n\nexport interface ProjectsProjectCreateBodyFields {\n  cID?: string\n  ID?: string\n  title?: string\n  logoFID?: string | null\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProjectCreateResponse = IServerResponse<Project>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Project>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required ID field missing in request body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required ID field missing in request body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege project:create required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege project:create required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Project with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Project with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProjectCreateResponse = IServerResponse<Project>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/project/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/project/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Project>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsProjectCreateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "ord": 0,
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/project/delete": {
      "get": {
        "operationId": "projects_project_delete",
        "summary": "🔒 Удаление (архивация) проекта компании.",
        "description": "Удаление (архивация) проекта компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `project:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/project/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProjectDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProjectDeleteResponse = IServerResponse<Resp_projects_project_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_project_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_project_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege project:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege project:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Project with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Project with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProjectDeleteResponse = IServerResponse<Resp_projects_project_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/project/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/project/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_project_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/project/update": {
      "post": {
        "operationId": "projects_project_update",
        "summary": "🔒 Обновление параметров существующего проекта компании.",
        "description": "Обновление параметров существующего проекта компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `project:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/project/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProjectUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsProjectUpdateBody = Partial<Project>\n\nexport interface ProjectsProjectUpdateBodyFields {\n  cID?: string\n  ID?: string\n  title?: string\n  logoFID?: string | null\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProjectUpdateResponse = IServerResponse<Project>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Project>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege project:update required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege project:update required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Project with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Project with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProjectUpdateResponse = IServerResponse<Project>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/project/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/project/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Project>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsProjectUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "ord": 0,
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/product/create": {
      "post": {
        "operationId": "projects_product_create",
        "summary": "🔒 Создание нового продукта в проекте с инициализацией базового контента.",
        "description": "Создание нового продукта в проекте с инициализацией базового контента.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/product/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProductCreateParams {\n  skipCreateContent?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsProductCreateBody = Partial<Product>\n\nexport interface ProjectsProductCreateBodyFields {\n  cID?: string\n  projectID?: string\n  ID?: string\n  logoFID?: string | null\n  cardFID?: string | null\n  analyticAssignee?: string\n  platform?: Product_Platform\n  title?: string\n  techStack?: Array<string>\n  leadUID?: string\n  startD?: string\n  isDeleted?: boolean | null\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n  isArchived?: boolean | null\n  /** Unix timestamp in milliseconds */\n  archivedTS?: number | null\n  isDeployEnabled?: boolean | null\n  team?: Record<string, any> | null\n  git?: Record<string, any> | null\n  design?: {\n  fileUrl?: string | null\n  uiKitUrl?: string | null\n  refUrls?: Array<{\n  title?: string | null\n  url: string\n}> | null\n} | null\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  spec?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProductCreateResponse = IServerResponse<Product>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Products"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "skipCreateContent",
            "in": "query",
            "required": false,
            "description": "Можно передать header `skipCreateContent` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Product>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "cardFID": "00000000-0000-4000-8000-000000000001",
                    "analyticAssignee": "string",
                    "platform": 10,
                    "title": "string",
                    "techStack": [
                      "string"
                    ],
                    "leadUID": "00000000-0000-4000-8000-000000000001",
                    "startD": "2026-01-15T12:00:00.000Z",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "isArchived": false,
                    "archivedTS": 0,
                    "isDeployEnabled": false,
                    "team": {},
                    "git": {},
                    "design": {
                      "fileUrl": "string",
                      "uiKitUrl": "string",
                      "refUrls": [
                        {
                          "title": null,
                          "url": null
                        }
                      ]
                    },
                    "ord": 0,
                    "spec": "string",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required ID or projectID missing in request body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required ID or projectID missing in request body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:create required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:create required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Parent project with specified projectID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Parent project with specified projectID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Product with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Product with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProductCreateResponse = IServerResponse<Product>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/product/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/product/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Product>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsProductCreateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "cardFID": "00000000-0000-4000-8000-000000000001",
                "analyticAssignee": "string",
                "platform": 10,
                "title": "string",
                "techStack": [
                  "string"
                ],
                "leadUID": "00000000-0000-4000-8000-000000000001",
                "startD": "2026-01-15T12:00:00.000Z",
                "isDeleted": false,
                "deletedTS": 0,
                "isArchived": false,
                "archivedTS": 0,
                "isDeployEnabled": false,
                "team": {},
                "git": {},
                "design": {
                  "fileUrl": "string",
                  "uiKitUrl": "string",
                  "refUrls": [
                    {
                      "title": "string",
                      "url": "string"
                    }
                  ]
                },
                "ord": 0,
                "spec": "string",
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/product/delete": {
      "get": {
        "operationId": "projects_product_delete",
        "summary": "🔒 Удаление (архивация) продукта из проекта.",
        "description": "Удаление (архивация) продукта из проекта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/product/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProductDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProductDeleteResponse = IServerResponse<Resp_projects_product_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Products"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_product_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_product_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Product with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Product with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProductDeleteResponse = IServerResponse<Resp_projects_product_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/product/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/product/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_product_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/product/filter-features": {
      "post": {
        "operationId": "projects_product_filter-features",
        "summary": "🔒 Получить список фич продукта на основе выбранных модулей/компонентов и их версий.",
        "description": "Получить список фич продукта на основе выбранных модулей/компонентов и их версий.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/product/filter-features`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsProductFilterFeaturesBody {\n  productID: string\n  moduleIDs?: Array<string> | null\n  componentIDs?: Array<string> | null\n  mode?: projects_product_filter_features_Body_mode | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProductFilterFeaturesResponse = IServerResponse<Resp_projects_product_filter-features>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Products"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_product_filter-features>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_product_filter-features"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "features": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid Body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid Body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Product or specified modules/components do not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Product or specified modules/components do not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProductFilterFeaturesResponse = IServerResponse<Resp_projects_product_filter-features>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/product/filter-features?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/product/filter-features', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_product_filter-features>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsProductFilterFeaturesBody"
              },
              "example": {
                "productID": "00000000-0000-4000-8000-000000000001",
                "moduleIDs": [
                  "00000000-0000-4000-8000-000000000001"
                ],
                "componentIDs": [
                  "00000000-0000-4000-8000-000000000001"
                ],
                "mode": "or"
              }
            }
          }
        }
      }
    },
    "/projects/product/team": {
      "get": {
        "operationId": "projects_product_team",
        "summary": "🔒 Получение статистики распределения времени и затрат команды по фичам продукта.",
        "description": "Получение статистики распределения времени и затрат команды по фичам продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/product/team`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProductTeamParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProductTeamResponse = IServerResponse<Resp_projects_product_team>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Products"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_product_team>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_product_team"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "groups": [
                      null
                    ],
                    "timeSpent": 0,
                    "team": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Product with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Product with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProductTeamResponse = IServerResponse<Resp_projects_product_team>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/product/team?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/product/team', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_product_team>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/product/update": {
      "post": {
        "operationId": "projects_product_update",
        "summary": "🔒 Обновление параметров продукта в проекте.",
        "description": "Обновление параметров продукта в проекте.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/product/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsProductUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsProductUpdateBody = Partial<Product>\n\nexport interface ProjectsProductUpdateBodyFields {\n  cID?: string\n  projectID?: string\n  ID?: string\n  logoFID?: string | null\n  cardFID?: string | null\n  analyticAssignee?: string\n  platform?: Product_Platform\n  title?: string\n  techStack?: Array<string>\n  leadUID?: string\n  startD?: string\n  isDeleted?: boolean | null\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n  isArchived?: boolean | null\n  /** Unix timestamp in milliseconds */\n  archivedTS?: number | null\n  isDeployEnabled?: boolean | null\n  team?: Record<string, any> | null\n  git?: Record<string, any> | null\n  design?: {\n  fileUrl?: string | null\n  uiKitUrl?: string | null\n  refUrls?: Array<{\n  title?: string | null\n  url: string\n}> | null\n} | null\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  spec?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsProductUpdateResponse = IServerResponse<Product>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Products"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Product>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "cardFID": "00000000-0000-4000-8000-000000000001",
                    "analyticAssignee": "string",
                    "platform": 10,
                    "title": "string",
                    "techStack": [
                      "string"
                    ],
                    "leadUID": "00000000-0000-4000-8000-000000000001",
                    "startD": "2026-01-15T12:00:00.000Z",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "isArchived": false,
                    "archivedTS": 0,
                    "isDeployEnabled": false,
                    "team": {},
                    "git": {},
                    "design": {
                      "fileUrl": "string",
                      "uiKitUrl": "string",
                      "refUrls": [
                        {
                          "title": null,
                          "url": null
                        }
                      ]
                    },
                    "ord": 0,
                    "spec": "string",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:update required; product:delete to archive or restore",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:update required; product:delete to archive or restore",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Product with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Product with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsProductUpdateResponse = IServerResponse<Product>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/product/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/product/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Product>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsProductUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "cardFID": "00000000-0000-4000-8000-000000000001",
                "analyticAssignee": "string",
                "platform": 10,
                "title": "string",
                "techStack": [
                  "string"
                ],
                "leadUID": "00000000-0000-4000-8000-000000000001",
                "startD": "2026-01-15T12:00:00.000Z",
                "isDeleted": false,
                "deletedTS": 0,
                "isArchived": false,
                "archivedTS": 0,
                "isDeployEnabled": false,
                "team": {},
                "git": {},
                "design": {
                  "fileUrl": "string",
                  "uiKitUrl": "string",
                  "refUrls": [
                    {
                      "title": "string",
                      "url": "string"
                    }
                  ]
                },
                "ord": 0,
                "spec": "string",
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/module/create": {
      "post": {
        "operationId": "projects_module_create",
        "summary": "🔒 Создание нового программного модуля в продукте.",
        "description": "Создание нового программного модуля в продукте.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:structure` (все обязательны; ресурс — `productID`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/module/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsModuleCreateParams {\n  skipCreateContent?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsModuleCreateBody = Partial<Module>\n\nexport interface ProjectsModuleCreateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  parentID?: string | null\n  ID?: string\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  title?: string\n  desc?: string\n  components?: Record<string, any>\n  ver?: number\n  designID?: string | null\n  path?: {\n  key: string\n  title: string\n} | null\n  isDeleted?: boolean | null\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsModuleCreateResponse = IServerResponse<Module>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Modules"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "skipCreateContent",
            "in": "query",
            "required": false,
            "description": "Можно передать header `skipCreateContent` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": true
            },
            "example": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Module>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Module"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "parentID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "ord": 0,
                    "title": "string",
                    "desc": "string",
                    "components": {},
                    "ver": 0,
                    "designID": "00000000-0000-4000-8000-000000000001",
                    "path": {
                      "key": "string",
                      "title": "string"
                    },
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required productID parameter missing in request body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required productID parameter missing in request body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:structure required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:structure required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified parent product does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified parent product does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Module with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Module with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsModuleCreateResponse = IServerResponse<Module>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/module/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/module/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Module>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsModuleCreateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "parentID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "ord": 0,
                "title": "string",
                "desc": "string",
                "components": {},
                "ver": 0,
                "designID": "00000000-0000-4000-8000-000000000001",
                "path": {
                  "key": "string",
                  "title": "string"
                },
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/module/delete": {
      "get": {
        "operationId": "projects_module_delete",
        "summary": "🔒 Удаление (архивация) программного модуля.",
        "description": "Удаление (архивация) программного модуля.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:structure` (все обязательны; ресурс — `ID (module)`)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/module/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsModuleDeleteParams {\n  ID: string\n  path_key: string\n  path_title: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsModuleDeleteResponse = IServerResponse<Resp_projects_module_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Modules"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "path_key",
            "in": "query",
            "required": true,
            "description": "Можно передать header `path_key` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "path_title",
            "in": "query",
            "required": true,
            "description": "Можно передать header `path_title` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_module_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_module_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "updated": [
                      {
                        "cID": null,
                        "projectID": null,
                        "productID": null,
                        "parentID": null,
                        "ID": null,
                        "ord": null,
                        "title": null,
                        "desc": null,
                        "components": null,
                        "ver": null,
                        "designID": null,
                        "path": null,
                        "isDeleted": null,
                        "deletedTS": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:structure required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:structure required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Module with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Module with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsModuleDeleteResponse = IServerResponse<Resp_projects_module_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/module/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/module/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_module_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/module/list": {
      "post": {
        "operationId": "projects_module_list",
        "summary": "🔒 Получение списка программных модулей по идентификаторам.",
        "description": "Получение списка программных модулей по идентификаторам.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/module/list`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsModuleListBody {\n  IDs: Array<string>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsModuleListResponse = IServerResponse<Resp_projects_module_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Modules"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_module_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_module_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {
                        "cID": null,
                        "projectID": null,
                        "productID": null,
                        "parentID": null,
                        "ID": null,
                        "ord": null,
                        "title": null,
                        "desc": null,
                        "components": null,
                        "ver": null,
                        "designID": null,
                        "path": null,
                        "isDeleted": null,
                        "deletedTS": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid IDs array",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid IDs array",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsModuleListResponse = IServerResponse<Resp_projects_module_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/module/list?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/module/list', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_module_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsModuleListBody"
              },
              "example": {
                "IDs": [
                  "00000000-0000-4000-8000-000000000001"
                ]
              }
            }
          }
        }
      }
    },
    "/projects/module/update": {
      "post": {
        "operationId": "projects_module_update",
        "summary": "🔒 Обновление параметров программного модуля.",
        "description": "Обновление параметров программного модуля.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:structure` (все обязательны; ресурс — `ID (module)`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/module/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsModuleUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsModuleUpdateBody = Partial<Module>\n\nexport interface ProjectsModuleUpdateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  parentID?: string | null\n  ID?: string\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  title?: string\n  desc?: string\n  components?: Record<string, any>\n  ver?: number\n  designID?: string | null\n  path?: {\n  key: string\n  title: string\n} | null\n  isDeleted?: boolean | null\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsModuleUpdateResponse = IServerResponse<Module>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Modules"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Module>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Module"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "parentID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "ord": 0,
                    "title": "string",
                    "desc": "string",
                    "components": {},
                    "ver": 0,
                    "designID": "00000000-0000-4000-8000-000000000001",
                    "path": {
                      "key": "string",
                      "title": "string"
                    },
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:structure required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:structure required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Module with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Module with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsModuleUpdateResponse = IServerResponse<Module>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/module/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/module/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Module>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsModuleUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "parentID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "ord": 0,
                "title": "string",
                "desc": "string",
                "components": {},
                "ver": 0,
                "designID": "00000000-0000-4000-8000-000000000001",
                "path": {
                  "key": "string",
                  "title": "string"
                },
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/feature/status/acceptance": {
      "get": {
        "operationId": "projects_feature_status_acceptance",
        "summary": "🔒 Перевод фичи на приёмку.",
        "description": "Перевод фичи на приёмку.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:test` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/status/acceptance`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusAcceptanceParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureStatusAcceptanceResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: User is not allowed to move feature to acceptance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: User is not allowed to move feature to acceptance",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid feature status transition",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid feature status transition",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureStatusAcceptanceResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/status/acceptance?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/status/acceptance', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/status/development": {
      "post": {
        "operationId": "projects_feature_status_development",
        "summary": "🔒 Перевод фичи в разработку.",
        "description": "Перевод фичи в разработку.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:publish`, `feature:test`, `feature:check`, `feature:reopen` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/feature/status/development`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusDevelopmentParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusDevelopmentBody {\n  comment?: {\n  text: string\n  mentioned?: Record<string, any> | null\n  attachments?: Array<any> | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureStatusDevelopmentResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: User is not allowed to move feature to development",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: User is not allowed to move feature to development",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid feature status transition",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid feature status transition",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureStatusDevelopmentResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/status/development?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/status/development', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsFeatureStatusDevelopmentBody"
              },
              "example": {
                "comment": {
                  "text": "string",
                  "mentioned": {},
                  "attachments": [
                    {}
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/projects/feature/status/done": {
      "get": {
        "operationId": "projects_feature_status_done",
        "summary": "🔒 Завершение фичи.",
        "description": "Завершение фичи.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:done` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/status/done`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusDoneParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureStatusDoneResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: User is not allowed to move feature to done",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: User is not allowed to move feature to done",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid feature status transition",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid feature status transition",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureStatusDoneResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/status/done?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/status/done', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/status/testing": {
      "post": {
        "operationId": "projects_feature_status_testing",
        "summary": "🔒 Перевод фичи на тестирование.",
        "description": "Перевод фичи на тестирование.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:check` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/feature/status/testing`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusTestingParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusTestingBody {\n  comment?: {\n  text: string\n  mentioned?: Record<string, any> | null\n  attachments?: Array<any> | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureStatusTestingResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: User is not allowed to move feature to testing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: User is not allowed to move feature to testing",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid feature status transition",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid feature status transition",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureStatusTestingResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/status/testing?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/status/testing', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsFeatureStatusTestingBody"
              },
              "example": {
                "comment": {
                  "text": "string",
                  "mentioned": {},
                  "attachments": [
                    {}
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/projects/feature/create": {
      "post": {
        "operationId": "projects_feature_create",
        "summary": "🔒 Создание нового функционала (фичи) с автоматической инициализацией аналитических и UI задач.",
        "description": "Создание нового функционала (фичи) с автоматической инициализацией аналитических и UI задач.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:create` (все обязательны; ресурс — `fields.productID`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/feature/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureCreateParams {\n  skipCreateContent?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsFeatureCreateBody = Partial<Feature>\n\nexport interface ProjectsFeatureCreateBodyFields {\n  fields?: {\n  cID: string\n  projectID: string\n  productID: string\n  versionID: string\n  ID: string\n  key?: number | null\n  title: string\n  status: number\n  spec: string\n  gist?: string | null\n  meta?: Record<string, any> | null\n  analyticAssignee: string\n  ord: number\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  updTS: number\n  updUID: string\n}\n  relations?: Array<any> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureCreateResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "skipCreateContent",
            "in": "query",
            "required": false,
            "description": "Можно передать header `skipCreateContent` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:create required or the product is archived",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:create required or the product is archived",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Product/version not found, duplicate feature ID or invalid relation item",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Product/version not found, duplicate feature ID or invalid relation item",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureCreateResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsFeatureCreateBody"
              },
              "example": {
                "fields": {
                  "cID": "00000000-0000-4000-8000-000000000001",
                  "projectID": "00000000-0000-4000-8000-000000000001",
                  "productID": "00000000-0000-4000-8000-000000000001",
                  "versionID": "00000000-0000-4000-8000-000000000001",
                  "ID": "00000000-0000-4000-8000-000000000001",
                  "key": 0,
                  "title": "string",
                  "status": 0,
                  "spec": "string",
                  "gist": "string",
                  "meta": {},
                  "analyticAssignee": "string",
                  "ord": 0,
                  "isDeleted": false,
                  "deletedTS": 0,
                  "updTS": 0,
                  "updUID": "string"
                },
                "relations": [
                  {}
                ]
              }
            }
          }
        }
      }
    },
    "/projects/feature/delete": {
      "get": {
        "operationId": "projects_feature_delete",
        "summary": "🔒 Удаление (архивация) функционала (фичи).",
        "description": "Удаление (архивация) функционала (фичи).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureDeleteResponse = IServerResponse<Resp_projects_feature_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_feature_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_feature_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureDeleteResponse = IServerResponse<Resp_projects_feature_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_feature_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/get": {
      "get": {
        "operationId": "projects_feature_get",
        "summary": "🔒 Получение фичи по ID или по ключу (#F12).",
        "description": "Получение фичи по ID или по ключу (#F12).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `feature:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/get`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureGetParams {\n  ID?: string | null\n  key?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureGetResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "Можно передать header `key` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature with specified ID or key does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature with specified ID or key does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Neither ID nor valid key is specified",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Neither ID nor valid key is specified",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureGetResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/get?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/get', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/modules": {
      "get": {
        "operationId": "projects_feature_modules",
        "summary": "🔒 Получение объединения модулей и компонентов из задач и ошибок фичи (динамические модули фичи).",
        "description": "Получение объединения модулей и компонентов из задач и ошибок фичи (динамические модули фичи).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `feature:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/modules`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureModulesParams {\n  featureID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureModulesResponse = IServerResponse<Resp_projects_feature_modules>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "featureID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `featureID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_feature_modules>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_feature_modules"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "modules": {},
                    "components": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureModulesResponse = IServerResponse<Resp_projects_feature_modules>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/modules?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/modules', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_feature_modules>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/status": {
      "get": {
        "operationId": "projects_feature_status",
        "summary": "🔒 Получение подробной статистики прогресса и стоимости функционала (фичи).",
        "description": "Получение подробной статистики прогресса и стоимости функционала (фичи).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `feature:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/status`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureStatusParams {\n  type: EntityType\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureStatusResponse = IServerResponse<Resp_projects_feature_status>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/EntityType"
            },
            "example": "project"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_feature_status>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_feature_status"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureStatusResponse = IServerResponse<Resp_projects_feature_status>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/status?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/status', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_feature_status>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/team": {
      "get": {
        "operationId": "projects_feature_team",
        "summary": "🔒 Получение статистики распределения времени и затрат команды по ролям и задачам фичи.",
        "description": "Получение статистики распределения времени и затрат команды по ролям и задачам фичи.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `feature:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/feature/team`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureTeamParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureTeamResponse = IServerResponse<Resp_projects_feature_team>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_feature_team>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_feature_team"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "groups": [
                      null
                    ],
                    "timeSpent": 0,
                    "team": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureTeamResponse = IServerResponse<Resp_projects_feature_team>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/team?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/team', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_feature_team>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/feature/update": {
      "post": {
        "operationId": "projects_feature_update",
        "summary": "🔒 Обновление параметров существующей сущности функционала (фичи).",
        "description": "Обновление параметров существующей сущности функционала (фичи).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `feature:update`, `feature:move` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/feature/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsFeatureUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsFeatureUpdateBody = Partial<Feature>\n\nexport interface ProjectsFeatureUpdateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  versionID?: string\n  ID?: string\n  key?: number | null\n  title?: string\n  status?: number\n  spec?: string\n  gist?: string | null\n  meta?: Record<string, any> | null\n  analyticAssignee?: string\n  /** Unix timestamp in milliseconds */\n  ord?: number\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsFeatureUpdateResponse = IServerResponse<Feature>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Features"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Feature>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Feature"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": 0,
                    "title": "string",
                    "status": 0,
                    "spec": "string",
                    "gist": "string",
                    "meta": {},
                    "analyticAssignee": "string",
                    "ord": 0,
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege feature:update required; feature:move to change the version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege feature:update required; feature:move to change the version",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Feature with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Feature with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Specification revision conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Specification revision conflict",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsFeatureUpdateResponse = IServerResponse<Feature>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/feature/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/feature/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Feature>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsFeatureUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "versionID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "key": 0,
                "title": "string",
                "status": 0,
                "spec": "string",
                "gist": "string",
                "meta": {},
                "analyticAssignee": "string",
                "ord": 0,
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/component/create": {
      "post": {
        "operationId": "projects_component_create",
        "summary": "🔒 Создание нового компонента архитектуры продукта.",
        "description": "Создание нового компонента архитектуры продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:structure` (все обязательны; ресурс — `productID`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/component/create`**\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsComponentCreateBody = Partial<Component>\n\nexport interface ProjectsComponentCreateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  ID?: string\n  ver?: number\n  title?: string\n  desc?: string\n  designID?: string | null\n  isDeleted?: boolean | null\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsComponentCreateResponse = IServerResponse<Component>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Components"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Component>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Component"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "ver": 0,
                    "title": "string",
                    "desc": "string",
                    "designID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required productID missing in request body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required productID missing in request body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:structure required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:structure required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Parent product with specified productID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Parent product with specified productID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Component with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Component with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsComponentCreateResponse = IServerResponse<Component>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/component/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/component/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Component>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsComponentCreateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "ver": 0,
                "title": "string",
                "desc": "string",
                "designID": "00000000-0000-4000-8000-000000000001",
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/projects/component/delete": {
      "get": {
        "operationId": "projects_component_delete",
        "summary": "🔒 Удаление (архивация) компонента продукта.",
        "description": "Удаление (архивация) компонента продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:structure` (все обязательны; ресурс — `ID (component)`)\n\n### TypeScript (copy-paste)\n\n**`GET /projects/component/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsComponentDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsComponentDeleteResponse = IServerResponse<Resp_projects_component_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Components"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_component_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_component_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:structure required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:structure required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Component with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Component with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsComponentDeleteResponse = IServerResponse<Resp_projects_component_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/component/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/component/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_component_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/projects/component/list": {
      "post": {
        "operationId": "projects_component_list",
        "summary": "🔒 Получение списка компонентов по идентификаторам.",
        "description": "Получение списка компонентов по идентификаторам.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/component/list`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ProjectsComponentListBody {\n  IDs: Array<string>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsComponentListResponse = IServerResponse<Resp_projects_component_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Components"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_projects_component_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_projects_component_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {
                        "cID": null,
                        "projectID": null,
                        "productID": null,
                        "ID": null,
                        "ver": null,
                        "title": null,
                        "desc": null,
                        "designID": null,
                        "isDeleted": null,
                        "deletedTS": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid IDs array",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid IDs array",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsComponentListResponse = IServerResponse<Resp_projects_component_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/component/list?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/component/list', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_projects_component_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsComponentListBody"
              },
              "example": {
                "IDs": [
                  "00000000-0000-4000-8000-000000000001"
                ]
              }
            }
          }
        }
      }
    },
    "/projects/component/update": {
      "post": {
        "operationId": "projects_component_update",
        "summary": "🔒 Обновление параметров компонента продукта.",
        "description": "Обновление параметров компонента продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `product:structure` (все обязательны; ресурс — `ID (component)`)\n\n### TypeScript (copy-paste)\n\n**`POST /projects/component/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ProjectsComponentUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ProjectsComponentUpdateBody = Partial<Component>\n\nexport interface ProjectsComponentUpdateBodyFields {\n  cID?: string\n  projectID?: string\n  productID?: string\n  ID?: string\n  ver?: number\n  title?: string\n  desc?: string\n  designID?: string | null\n  isDeleted?: boolean | null\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ProjectsComponentUpdateResponse = IServerResponse<Component>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Projects: Components"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Component>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Component"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "ver": 0,
                    "title": "string",
                    "desc": "string",
                    "designID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:structure required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:structure required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Component with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Component with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ProjectsComponentUpdateResponse = IServerResponse<Component>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/projects/component/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'projects/component/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Component>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsComponentUpdateBody"
              },
              "example": {
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "ID": "00000000-0000-4000-8000-000000000001",
                "ver": 0,
                "title": "string",
                "desc": "string",
                "designID": "00000000-0000-4000-8000-000000000001",
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/oauth/connect/decide": {
      "post": {
        "operationId": "oauth_connect_decide",
        "summary": "🔒 #26729 Решение на экране подключения ИИ-приложения: «Разрешить» для компании с действующим доступом (запись - отметкой) или «Отклонить». Записывается один раз; отдаёт адрес завершения с одноразовым билетом - код авторизации выдаётся только в браузере, начавшем подключение.",
        "description": "#26729 Решение на экране подключения ИИ-приложения: «Разрешить» для компании с действующим доступом (запись - отметкой) или «Отклонить». Записывается один раз; отдаёт адрес завершения с одноразовым билетом - код авторизации выдаётся только в браузере, начавшем подключение.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — own consent: connects an app on the user's own behalf, company checked for active access\n\n### TypeScript (copy-paste)\n\n**`POST /oauth/connect/decide`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface OauthConnectDecideParams {\n  request: string\n  allow: boolean\n  cID?: string | null\n  write?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type OauthConnectDecideResponse = IServerResponse<Resp_oauth_connect_decide>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "request",
            "in": "query",
            "required": true,
            "description": "Можно передать header `request` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "allow",
            "in": "query",
            "required": true,
            "description": "Можно передать header `allow` (сервер мержит headers+query)",
            "schema": {
              "type": "boolean"
            },
            "example": false
          },
          {
            "name": "cID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `cID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "write",
            "in": "query",
            "required": false,
            "description": "Можно передать header `write` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_oauth_connect_decide>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_oauth_connect_decide"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "url": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: cID required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: cID required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: no active access to the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: no active access to the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - connect_request_expired",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - connect_request_expired",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - connect_request_used (already decided)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - connect_request_used (already decided)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: OauthConnectDecideResponse = IServerResponse<Resp_oauth_connect_decide>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/oauth/connect/decide?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'oauth/connect/decide', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_oauth_connect_decide>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/oauth/connect/get": {
      "get": {
        "operationId": "oauth_connect_get",
        "summary": "🔒 #26729 Экран подключения ИИ-приложения: приложение по шаблону адреса возврата, запрошенные права и компании с действующим доступом пользователя.",
        "description": "#26729 Экран подключения ИИ-приложения: приложение по шаблону адреса возврата, запрошенные права и компании с действующим доступом пользователя.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read` · **только веб-сессия**\n\n**Allows:** не требуются — own consent screen: lists only companies where the user has active access\n\n### TypeScript (copy-paste)\n\n**`GET /oauth/connect/get`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface OauthConnectGetParams {\n  request: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type OauthConnectGetResponse = IServerResponse<Resp_oauth_connect_get>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "request",
            "in": "query",
            "required": true,
            "description": "Можно передать header `request` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_oauth_connect_get>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_oauth_connect_get"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - connect_request_expired (no request or it expired, 15 minutes)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - connect_request_expired (no request or it expired, 15 minutes)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: OauthConnectGetResponse = IServerResponse<Resp_oauth_connect_get>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/oauth/connect/get?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'oauth/connect/get', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_oauth_connect_get>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/oauth/connect/info": {
      "get": {
        "operationId": "oauth_connect_info",
        "summary": "🔓 #26729 Приложение и запрошенные права запроса подключения ИИ-приложения - для экрана входа («Вход для подключения <приложение>»), до входа. Шаблон приложения - по адресу возврата.",
        "description": "#26729 Приложение и запрошенные права запроса подключения ИИ-приложения - для экрана входа («Вход для подключения <приложение>»), до входа. Шаблон приложения - по адресу возврата.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `read` · **только веб-сессия**\n\n### TypeScript (copy-paste)\n\n**`GET /oauth/connect/info`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface OauthConnectInfoParams {\n  request: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type OauthConnectInfoResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "request",
            "in": "query",
            "required": true,
            "description": "Можно передать header `request` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: params.code - connect_request_expired (no request or it expired, 15 minutes)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: params.code - connect_request_expired (no request or it expired, 15 minutes)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: OauthConnectInfoResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/oauth/connect/info?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/oauth/client/create": {
      "post": {
        "operationId": "oauth_client_create",
        "summary": "🔒 #26854 Выпуск OAuth-клиента с секретом для платформы без DCR (Gemini Enterprise): Client ID и Client Secret (один раз).",
        "description": "#26854 Выпуск OAuth-клиента с секретом для платформы без DCR (Gemini Enterprise): Client ID и Client Secret (один раз).\n\n**Access:** `authorized` (10 ) · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `company:llm` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /oauth/client/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface OauthClientCreateBody {\n  name: string\n  redirectUri: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type OauthClientCreateResponse = IServerResponse<Resp_oauth_client_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_oauth_client_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_oauth_client_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "client": null,
                    "clientSecret": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:llm required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:llm required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code - name_required, invalid_redirect_uri (https only, no credentials and fragment)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code - name_required, invalid_redirect_uri (https only, no credentials and fragment)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: OauthClientCreateResponse = IServerResponse<Resp_oauth_client_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/oauth/client/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'oauth/client/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_oauth_client_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OauthClientCreateBody"
              },
              "example": {
                "name": "string",
                "redirectUri": "string"
              }
            }
          }
        }
      }
    },
    "/oauth/client/delete": {
      "post": {
        "operationId": "oauth_client_delete",
        "summary": "🔒 #26854 Удаление OAuth-клиента с секретом своей компании: все подключения через него отзываются сразу.",
        "description": "#26854 Удаление OAuth-клиента с секретом своей компании: все подключения через него отзываются сразу.\n\n**Access:** `authorized` (10 ) · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `company:llm` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /oauth/client/delete`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface OauthClientDeleteBody {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type OauthClientDeleteResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:llm required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:llm required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: no such client in the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: no such client in the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: OauthClientDeleteResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/oauth/client/delete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'oauth/client/delete', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OauthClientDeleteBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/oauth/client/list": {
      "get": {
        "operationId": "oauth_client_list",
        "summary": "🔒 #26854 «AI агенты» → «Корпоративные платформы»: OAuth-клиенты с секретом, выпущенные в компании для платформ без DCR (Gemini Enterprise).",
        "description": "#26854 «AI агенты» → «Корпоративные платформы»: OAuth-клиенты с секретом, выпущенные в компании для платформ без DCR (Gemini Enterprise).\n\n**Access:** `authorized` (10 ) · **Scope:** `read` · **только веб-сессия**\n\n**Allows:** `company:llm` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /oauth/client/list`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type OauthClientListResponse = IServerResponse<Resp_oauth_client_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_oauth_client_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_oauth_client_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "clients": [
                      null
                    ],
                    "defaultRedirectUri": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:llm required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:llm required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: OauthClientListResponse = IServerResponse<Resp_oauth_client_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/oauth/client/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'oauth/client/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_oauth_client_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/notification/list": {
      "get": {
        "operationId": "notification_list",
        "summary": "🔒 Получение персонального журнала уведомлений пользователя за последние 30 дней",
        "description": "Получение персонального журнала уведомлений пользователя за последние 30 дней\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** не требуются — own notifications of the session user\n\n### TypeScript (copy-paste)\n\n**`GET /notification/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface NotificationListParams {\n  group?: notification_list_group | null\n  nextCursor?: string | null\n  limit?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type NotificationListResponse = IServerResponse<Resp_notification_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Notifications"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "group",
            "in": "query",
            "required": false,
            "description": "Можно передать header `group` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/notification_list_group"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "task"
          },
          {
            "name": "nextCursor",
            "in": "query",
            "required": false,
            "description": "Можно передать header `nextCursor` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Можно передать header `limit` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "example": 50
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_notification_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_notification_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      null
                    ],
                    "nextCursor": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "Validation: Invalid request parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "Validation: Invalid request parameters",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: NotificationListResponse = IServerResponse<Resp_notification_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/notification/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'notification/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_notification_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/participant/update": {
      "post": {
        "operationId": "meeting_participant_update",
        "summary": "🔒 Обновление статуса (принял/отклонил) или параметров участника совещания.",
        "description": "Обновление статуса (принял/отклонил) или параметров участника совещания.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `meeting:read`, `meeting:respond`, `meeting:rates`, `meeting:invite` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /meeting/participant/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingParticipantUpdateParams {\n  meetingID: string\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface MeetingParticipantUpdateBody {\n  isAccepted?: boolean | null\n  position?: string | null\n  hourCost?: number | null\n  comment?: string | null\n  isAdmin?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingParticipantUpdateResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "meetingID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `meetingID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:read / meeting:respond / meeting:rates / meeting:invite required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:read / meeting:respond / meeting:rates / meeting:invite required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Participant or meeting not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Participant or meeting not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingParticipantUpdateResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/participant/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/participant/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingParticipantUpdateBody"
              },
              "example": {
                "isAccepted": false,
                "position": "string",
                "hourCost": 0,
                "comment": "string",
                "isAdmin": false
              }
            }
          }
        }
      }
    },
    "/meeting/create": {
      "post": {
        "operationId": "meeting_create",
        "summary": "🔒 Создание нового совещания (встречи).",
        "description": "Создание нового совещания (встречи).\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `meeting:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /meeting/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingCreateParams {\n  createIntegration?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type MeetingCreateBody = Partial<Meeting>\n\nexport interface MeetingCreateBodyFields {\n  ID?: string\n  cID?: string | null\n  projectID?: string | null\n  productID?: string | null\n  versionID?: string | null\n  featureID?: string | null\n  entityType?: Meeting_entityType | null\n  entityID?: string | null\n  title?: string\n  agenda?: string\n  summary?: string | null\n  resolution?: string\n  startDtEstimated?: string | null\n  endDtEstimated?: string | null\n  startDtFact?: string | null\n  endDtFact?: string | null\n  location?: string | null\n  type?: Meeting_Type\n  link?: string | null\n  participants?: Record<string, any>\n  online?: {\n  integrationID: string\n  service: Meeting_online_service\n  roomID?: string | null\n  callID?: string | null\n  passcode?: string | null\n} | null\n  createdDT?: string\n  createdUID?: string\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingCreateResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "createIntegration",
            "in": "query",
            "required": false,
            "description": "Можно передать header `createIntegration` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:create required, entity *:read required, foreign company, or participants privileges (meeting:invite, meeting:rates)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:create required, entity *:read required, foreign company, or participants privileges (meeting:invite, meeting:rates)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Meeting with specified ID already exists, entityID/cID is missing for entityType, or both title and agenda are empty",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Meeting with specified ID already exists, entityID/cID is missing for entityType, or both title and agenda are empty",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingCreateResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "versionID": "00000000-0000-4000-8000-000000000001",
                "featureID": "00000000-0000-4000-8000-000000000001",
                "entityType": "product",
                "entityID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "agenda": "string",
                "summary": "string",
                "resolution": "string",
                "startDtEstimated": "2026-01-15T12:00:00.000Z",
                "endDtEstimated": "2026-01-15T12:00:00.000Z",
                "startDtFact": "2026-01-15T12:00:00.000Z",
                "endDtFact": "2026-01-15T12:00:00.000Z",
                "location": "string",
                "type": "vk",
                "link": "string",
                "participants": {},
                "online": {
                  "integrationID": "string",
                  "service": "zoom",
                  "roomID": "string",
                  "callID": "string",
                  "passcode": "string"
                },
                "createdDT": "2026-01-15T12:00:00.000Z",
                "createdUID": "00000000-0000-4000-8000-000000000001",
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/meeting/delete": {
      "get": {
        "operationId": "meeting_delete",
        "summary": "🔒 Удаление (архивация) совещания.",
        "description": "Удаление (архивация) совещания.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `meeting:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingDeleteResponse = IServerResponse<Resp_meeting_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_meeting_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_meeting_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified meeting ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified meeting ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingDeleteResponse = IServerResponse<Resp_meeting_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_meeting_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/entity-worklogs": {
      "get": {
        "operationId": "meeting_entity-worklogs",
        "summary": "🔒 Получение статистики потраченного времени и денег по всем ворклогам совещания.",
        "description": "Получение статистики потраченного времени и денег по всем ворклогам совещания.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read`, `version:read`, `feature:read`, `product:costs`, `version:costs`, `feature:costs`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/entity-worklogs`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingEntityWorklogsParams {\n  entityID: string\n  entityType: Meeting_entityType\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingEntityWorklogsResponse = IServerResponse<Resp_meeting_entity-worklogs>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "entityID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `entityID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "description": "Можно передать header `entityType` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/Meeting_entityType"
            },
            "example": "product"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_meeting_entity-worklogs>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_meeting_entity-worklogs"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "years": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:read / version:read / feature:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:read / version:read / feature:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid entity type",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid entity type",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingEntityWorklogsResponse = IServerResponse<Resp_meeting_entity-worklogs>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/entity-worklogs?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/entity-worklogs', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_meeting_entity-worklogs>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/finish": {
      "get": {
        "operationId": "meeting_finish",
        "summary": "🔒 Завершение совещания и остановка всех активных ворклогов участников.",
        "description": "Завершение совещания и остановка всех активных ворклогов участников.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `meeting:finish` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/finish`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingFinishParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingFinishResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:finish required (organizer)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:finish required (organizer)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Meeting or active worklogs for meeting not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Meeting or active worklogs for meeting not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingFinishResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/finish?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/finish', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/get": {
      "get": {
        "operationId": "meeting_get",
        "summary": "🔒 Получение подробной информации о совещании по ID.",
        "description": "Получение подробной информации о совещании по ID.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `meeting:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/get`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingGetParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingGetResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Meeting with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Meeting with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingGetResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/get?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/get', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/join": {
      "post": {
        "operationId": "meeting_join",
        "summary": "🔒 Присоединение участников к совещанию с запуском учёта рабочего времени (ворклогов).",
        "description": "Присоединение участников к совещанию с запуском учёта рабочего времени (ворклогов).\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `meeting:join`, `meeting:invite` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /meeting/join`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingJoinParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface MeetingJoinBody {\n  userIDs: Array<any>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingJoinResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:join required (for other participants - meeting:invite)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:join required (for other participants - meeting:invite)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Participant or meeting not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Participant or meeting not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: userIDs payload array is empty",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: userIDs payload array is empty",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingJoinResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/join?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/join', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingJoinBody"
              },
              "example": {
                "userIDs": [
                  {}
                ]
              }
            }
          }
        }
      }
    },
    "/meeting/leave": {
      "get": {
        "operationId": "meeting_leave",
        "summary": "🔒 Выход участника из совещания с остановкой активного ворклога.",
        "description": "Выход участника из совещания с остановкой активного ворклога.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `meeting:join`, `meeting:invite` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/leave`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingLeaveParams {\n  ID: string\n  userID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingLeaveResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:join required (for another participant - meeting:invite)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:join required (for another participant - meeting:invite)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Participant or meeting not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Participant or meeting not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingLeaveResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/leave?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/leave', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/participant-suggestions": {
      "get": {
        "operationId": "meeting_participant-suggestions",
        "summary": "🔒 Получение рекомендаций участников для совещания на основе проектной сущности (задачи, версии, фичи).",
        "description": "Получение рекомендаций участников для совещания на основе проектной сущности (задачи, версии, фичи).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `meeting:create`, `product:read`, `version:read`, `feature:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/participant-suggestions`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingParticipantSuggestionsParams {\n  entityID?: string | null\n  entityType?: Meeting_entityType | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingParticipantSuggestionsResponse = IServerResponse<Resp_meeting_participant-suggestions>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "entityID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `entityID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "entityType",
            "in": "query",
            "required": false,
            "description": "Можно передать header `entityType` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Meeting_entityType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "product"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_meeting_participant-suggestions>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_meeting_participant-suggestions"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "users": {},
                    "options": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Inconsistent entity parameters (both or neither of entityID and entityType must be provided)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Inconsistent entity parameters (both or neither of entityID and entityType must be provided)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:create required; by entity - product:read / version:read / feature:read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:create required; by entity - product:read / version:read / feature:read",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingParticipantSuggestionsResponse = IServerResponse<Resp_meeting_participant-suggestions>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/participant-suggestions?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/participant-suggestions', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_meeting_participant-suggestions>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/propose-reschedule": {
      "post": {
        "operationId": "meeting_propose-reschedule",
        "summary": "🔒 Предложение переноса даты/времени совещания участником.",
        "description": "Предложение переноса даты/времени совещания участником.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `meeting:respond` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /meeting/propose-reschedule`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingProposeRescheduleParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface MeetingProposeRescheduleBody {\n  dt: string\n  comment: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingProposeRescheduleResponse = IServerResponse<Resp_meeting_propose-reschedule>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_meeting_propose-reschedule>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_meeting_propose-reschedule"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Participant has already accepted or declined meeting and cannot propose rescheduling",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Participant has already accepted or declined meeting and cannot propose rescheduling",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Participant or meeting with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Participant or meeting with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingProposeRescheduleResponse = IServerResponse<Resp_meeting_propose-reschedule>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/propose-reschedule?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/propose-reschedule', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_meeting_propose-reschedule>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingProposeRescheduleBody"
              },
              "example": {
                "dt": "2026-01-15T12:00:00.000Z",
                "comment": "string"
              }
            }
          }
        }
      }
    },
    "/meeting/resolution": {
      "get": {
        "operationId": "meeting_resolution",
        "summary": "🔒 Генерация резолюции совещания на основе расшифровки (стенограммы) с помощью AI.",
        "description": "Генерация резолюции совещания на основе расшифровки (стенограммы) с помощью AI.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `meeting:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/resolution`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingResolutionParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingResolutionResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Meeting transcript is empty or unavailable for AI resolution generation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Meeting transcript is empty or unavailable for AI resolution generation",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:update required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:update required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Meeting with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Meeting with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingResolutionResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/resolution?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/resolution', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/meeting/update": {
      "post": {
        "operationId": "meeting_update",
        "summary": "🔒 Обновление параметров существующего совещания.",
        "description": "Обновление параметров существующего совещания.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `meeting:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /meeting/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type MeetingUpdateBody = Partial<Meeting>\n\nexport interface MeetingUpdateBodyFields {\n  ID?: string\n  cID?: string | null\n  projectID?: string | null\n  productID?: string | null\n  versionID?: string | null\n  featureID?: string | null\n  entityType?: Meeting_entityType | null\n  entityID?: string | null\n  title?: string\n  agenda?: string\n  summary?: string | null\n  resolution?: string\n  startDtEstimated?: string | null\n  endDtEstimated?: string | null\n  startDtFact?: string | null\n  endDtFact?: string | null\n  location?: string | null\n  type?: Meeting_Type\n  link?: string | null\n  participants?: Record<string, any>\n  online?: {\n  integrationID: string\n  service: Meeting_online_service\n  roomID?: string | null\n  callID?: string | null\n  passcode?: string | null\n} | null\n  createdDT?: string\n  createdUID?: string\n  isDeleted?: boolean | null\n  deletedTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingUpdateResponse = IServerResponse<Meeting>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Meeting>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Meeting"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "projectID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "versionID": "00000000-0000-4000-8000-000000000001",
                    "featureID": "00000000-0000-4000-8000-000000000001",
                    "entityType": "product",
                    "entityID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "agenda": "string",
                    "summary": "string",
                    "resolution": "string",
                    "startDtEstimated": "2026-01-15T12:00:00.000Z",
                    "endDtEstimated": "2026-01-15T12:00:00.000Z",
                    "startDtFact": "2026-01-15T12:00:00.000Z",
                    "endDtFact": "2026-01-15T12:00:00.000Z",
                    "location": "string",
                    "type": "vk",
                    "link": "string",
                    "participants": {},
                    "online": {
                      "integrationID": "string",
                      "service": "zoom",
                      "roomID": "string",
                      "callID": "string",
                      "passcode": "string"
                    },
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "isDeleted": false,
                    "deletedTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:update required (participants - meeting:invite, meeting:rates)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:update required (participants - meeting:invite, meeting:rates)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Meeting with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Meeting with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingUpdateResponse = IServerResponse<Meeting>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Meeting>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001",
                "versionID": "00000000-0000-4000-8000-000000000001",
                "featureID": "00000000-0000-4000-8000-000000000001",
                "entityType": "product",
                "entityID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "agenda": "string",
                "summary": "string",
                "resolution": "string",
                "startDtEstimated": "2026-01-15T12:00:00.000Z",
                "endDtEstimated": "2026-01-15T12:00:00.000Z",
                "startDtFact": "2026-01-15T12:00:00.000Z",
                "endDtFact": "2026-01-15T12:00:00.000Z",
                "location": "string",
                "type": "vk",
                "link": "string",
                "participants": {},
                "online": {
                  "integrationID": "string",
                  "service": "zoom",
                  "roomID": "string",
                  "callID": "string",
                  "passcode": "string"
                },
                "createdDT": "2026-01-15T12:00:00.000Z",
                "createdUID": "00000000-0000-4000-8000-000000000001",
                "isDeleted": false,
                "deletedTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/meeting/worklogs": {
      "get": {
        "operationId": "meeting_worklogs",
        "summary": "🔒 Получение статистики потраченного времени и денег по всем ворклогам совещания.",
        "description": "Получение статистики потраченного времени и денег по всем ворклогам совещания.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `meeting:read`, `meeting:costs`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /meeting/worklogs`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface MeetingWorklogsParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type MeetingWorklogsResponse = IServerResponse<Resp_meeting_worklogs>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_meeting_worklogs>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_meeting_worklogs"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "users": {},
                    "timeSpent": 0,
                    "moneySpent": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege meeting:read required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege meeting:read required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified meeting ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified meeting ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Meeting does not have estimated finish date",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Meeting does not have estimated finish date",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: MeetingWorklogsResponse = IServerResponse<Resp_meeting_worklogs>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/meeting/worklogs?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'meeting/worklogs', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_meeting_worklogs>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/logout/current": {
      "get": {
        "operationId": "logout_current",
        "summary": "🔒 Завершение текущей активной сессии пользователя (Выход).",
        "description": "Завершение текущей активной сессии пользователя (Выход).\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** не требуются — sign-out of the current session\n\n### TypeScript (copy-paste)\n\n**`GET /logout/current`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LogoutCurrentResponse = IServerResponse<Resp_logout_current>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_logout_current>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_logout_current"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "terminated": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LogoutCurrentResponse = IServerResponse<Resp_logout_current>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/logout/current?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'logout/current', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_logout_current>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/logout/terminate-all": {
      "get": {
        "operationId": "logout_terminate-all",
        "summary": "🔒 Завершение всех остальных активных сессий пользователя (Выйти на всех устройствах); с revokeAccess - ещё и отзыв всех его подключений ИИ-приложений и персональных токенов.",
        "description": "Завершение всех остальных активных сессий пользователя (Выйти на всех устройствах); с revokeAccess - ещё и отзыв всех его подключений ИИ-приложений и персональных токенов.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `user:sessions` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /logout/terminate-all`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface LogoutTerminateAllParams {\n  userID: string\n  revokeAccess?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LogoutTerminateAllResponse = IServerResponse<Resp_logout_terminate-all>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "revokeAccess",
            "in": "query",
            "required": false,
            "description": "Можно передать header `revokeAccess` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_logout_terminate-all>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_logout_terminate-all"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "terminated": false,
                    "revoked": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Non-admin user attempted to terminate sessions of another user; revokeAccess for another user requires user:ai-tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Non-admin user attempted to terminate sessions of another user; revokeAccess for another user requires user:ai-tokens",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LogoutTerminateAllResponse = IServerResponse<Resp_logout_terminate-all>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/logout/terminate-all?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'logout/terminate-all', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_logout_terminate-all>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/logout/terminate": {
      "get": {
        "operationId": "logout_terminate",
        "summary": "🔒 Завершение конкретной выбранной сессии пользователя по её ID.",
        "description": "Завершение конкретной выбранной сессии пользователя по её ID.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `user:sessions` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /logout/terminate`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface LogoutTerminateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LogoutTerminateResponse = IServerResponse<Resp_logout_terminate>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_logout_terminate>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_logout_terminate"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "terminated": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Non-admin user attempted to terminate session belonging to another user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Non-admin user attempted to terminate session belonging to another user",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Session with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Session with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Specified session has already expired",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Specified session has already expired",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LogoutTerminateResponse = IServerResponse<Resp_logout_terminate>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/logout/terminate?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'logout/terminate', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_logout_terminate>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/llm/version/notes": {
      "post": {
        "operationId": "llm_version_notes",
        "summary": "🔒 #26685 ИИ-функция «Сформировать «Что нового»»: заметки к выпуску по закрытым задачам и ошибкам версии - новое, улучшения, исправления. Не сохраняется.",
        "description": "#26685 ИИ-функция «Сформировать «Что нового»»: заметки к выпуску по закрытым задачам и ошибкам версии - новое, улучшения, исправления. Не сохраняется.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `version:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/version/notes`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmVersionNotesBody {\n  versionID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmVersionNotesResponse = IServerResponse<Resp_llm_version_notes>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_version_notes>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_version_notes"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "text": "string",
                    "truncated": {},
                    "runID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: the version does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: the version does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "502": {
            "description": "ExternalRequest: no model answered (reason: LLMError.Kind)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 502,
                  "data": {
                    "err": "ExternalRequest: no model answered (reason: LLMError.Kind)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmVersionNotesResponse = IServerResponse<Resp_llm_version_notes>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/version/notes?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/version/notes', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_version_notes>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmVersionNotesBody"
              },
              "example": {
                "versionID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/task/estimate": {
      "post": {
        "operationId": "llm_task_estimate",
        "summary": "🔒 #26681 ИИ-функция «Оценить время» из меню задачи: оценка в фоне, ответ сразу. Итог - плановое время (при высокой или средней уверенности), оценка в meta.timePlan и уведомление тому, кто запустил.",
        "description": "#26681 ИИ-функция «Оценить время» из меню задачи: оценка в фоне, ответ сразу. Итог - плановое время (при высокой или средней уверенности), оценка в meta.timePlan и уведомление тому, кто запустил.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/task/estimate`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmTaskEstimateBody {\n  taskID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmTaskEstimateResponse = IServerResponse<Resp_llm_task_estimate>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_task_estimate>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_task_estimate"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "started": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: no task:update, the function is not activated in the company (reason: notActivated) or no access to the product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: no task:update, the function is not activated in the company (reason: notActivated) or no access to the product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: the task does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: the task does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: planned time can no longer be changed - the task is past the work stage or closed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: planned time can no longer be changed - the task is past the work stage or closed",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "502": {
            "description": "ExternalRequest: no model is configured on the stand (reason: unavailable)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 502,
                  "data": {
                    "err": "ExternalRequest: no model is configured on the stand (reason: unavailable)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmTaskEstimateResponse = IServerResponse<Resp_llm_task_estimate>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/task/estimate?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/task/estimate', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_task_estimate>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmTaskEstimateBody"
              },
              "example": {
                "taskID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/task/evaluate-work": {
      "post": {
        "operationId": "llm_task_evaluate-work",
        "summary": "🔒 #26682 ИИ-функция «Оценка исполнения» из меню задачи: коэффициент 0-2, комментарий по флоу и рыночное время сделанного - в фоне, ответ сразу. Итог - meta.evaluations.work, workEvaluation и уведомление исполнителю и тому, кто запустил.",
        "description": "#26682 ИИ-функция «Оценка исполнения» из меню задачи: коэффициент 0-2, комментарий по флоу и рыночное время сделанного - в фоне, ответ сразу. Итог - meta.evaluations.work, workEvaluation и уведомление исполнителю и тому, кто запустил.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:evaluate` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/task/evaluate-work`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmTaskEvaluateWorkBody {\n  taskID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmTaskEvaluateWorkResponse = IServerResponse<Resp_llm_task_evaluate-work>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_task_evaluate-work>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_task_evaluate-work"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "started": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: privilegeRequired task:evaluate, or the function is not activated in the company (reason: notActivated)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: privilegeRequired task:evaluate, or the function is not activated in the company (reason: notActivated)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: the task does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: the task does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: work is not handed over yet (reason: status), education tasks are not evaluated (reason: education), no tracked time in the work stage (reason: noStageTime)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: work is not handed over yet (reason: status), education tasks are not evaluated (reason: education), no tracked time in the work stage (reason: noStageTime)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "500": {
            "description": "ExternalRequest: no model is configured on the stand (reason: unavailable)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 500,
                  "data": {
                    "err": "ExternalRequest: no model is configured on the stand (reason: unavailable)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmTaskEvaluateWorkResponse = IServerResponse<Resp_llm_task_evaluate-work>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/task/evaluate-work?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/task/evaluate-work', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_task_evaluate-work>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmTaskEvaluateWorkBody"
              },
              "example": {
                "taskID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/search/semantic": {
      "post": {
        "operationId": "llm_search_semantic",
        "summary": "🔒 #26680 ИИ-функция «Поиск по смыслу»: запрос в свободной форме против фич, задач и ошибок продукта по фильтрам - до 10 с пояснением. Сбой модели - лучшие кандидаты подбора без пояснений (`degraded`).",
        "description": "#26680 ИИ-функция «Поиск по смыслу»: запрос в свободной форме против фич, задач и ошибок продукта по фильтрам - до 10 с пояснением. Сбой модели - лучшие кандидаты подбора без пояснений (`degraded`).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/search/semantic`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmSearchSemanticBody {\n  productID: string\n  query: string\n  filters?: {\n  types?: Array<llm_search_semantic_Body_filters_types_item> | null\n  categories?: Array<llm_search_semantic_Body_filters_categories_item> | null\n  versionID?: string | null\n  featureID?: string | null\n  includeClosed?: boolean | null\n  closedWithinDays?: number | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmSearchSemanticResponse = IServerResponse<LLMSemanticSearch_Result>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<LLMSemanticSearch_Result>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/LLMSemanticSearch_Result"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the query is shorter than 3 characters (reason: tooShort, min)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the query is shorter than 3 characters (reason: tooShort, min)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmSearchSemanticResponse = IServerResponse<LLMSemanticSearch_Result>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/search/semantic?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/search/semantic', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<LLMSemanticSearch_Result>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmSearchSemanticBody"
              },
              "example": {
                "productID": "00000000-0000-4000-8000-000000000001",
                "query": "string",
                "filters": {
                  "types": [
                    "feature"
                  ],
                  "categories": [
                    "common"
                  ],
                  "versionID": "00000000-0000-4000-8000-000000000001",
                  "featureID": "00000000-0000-4000-8000-000000000001",
                  "includeClosed": false,
                  "closedWithinDays": 0
                }
              }
            }
          }
        }
      }
    },
    "/llm/meeting/result": {
      "post": {
        "operationId": "llm_meeting_result",
        "summary": "🔒 #26688 ИИ-функция «Сформировать итог» совещания: протокол по стенограмме - текст для предпросмотра, без сохранения.",
        "description": "#26688 ИИ-функция «Сформировать итог» совещания: протокол по стенограмме - текст для предпросмотра, без сохранения.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `meeting:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/meeting/result`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmMeetingResultBody {\n  meetingID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmMeetingResultResponse = IServerResponse<Resp_llm_meeting_result>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_meeting_result>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_meeting_result"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "text": "string",
                    "truncated": {},
                    "runID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: the meeting has no transcript",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: the meeting has no transcript",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the meeting",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the meeting",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: the meeting does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: the meeting does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "502": {
            "description": "ExternalRequest: no model answered (reason: LLMError.Kind)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 502,
                  "data": {
                    "err": "ExternalRequest: no model answered (reason: LLMError.Kind)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmMeetingResultResponse = IServerResponse<Resp_llm_meeting_result>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/meeting/result?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/meeting/result', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_meeting_result>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmMeetingResultBody"
              },
              "example": {
                "meetingID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/functions/list": {
      "get": {
        "operationId": "llm_functions_list",
        "summary": "🔒 #26668 Страница «ИИ-функции»: каталог функций с состоянием в компании, моделями и расходом за текущий месяц.",
        "description": "#26668 Страница «ИИ-функции»: каталог функций с состоянием в компании, моделями и расходом за текущий месяц.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:llm` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /llm/functions/list`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmFunctionsListResponse = IServerResponse<Resp_llm_functions_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_functions_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_functions_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "functions": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:llm required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:llm required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmFunctionsListResponse = IServerResponse<Resp_llm_functions_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/functions/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/functions/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_functions_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/llm/functions/update": {
      "post": {
        "operationId": "llm_functions_update",
        "summary": "🔒 #26668 Страница «ИИ-функции»: включить или выключить функцию в компании; #26682 режим запуска (auto - по событию и из меню, manual - только из меню).",
        "description": "#26668 Страница «ИИ-функции»: включить или выключить функцию в компании; #26682 режим запуска (auto - по событию и из меню, manual - только из меню).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:llm` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/functions/update`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmFunctionsUpdateBody {\n  key: string\n  enabled?: boolean | null\n  launch?: LLMFunctionConnection_launch | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmFunctionsUpdateResponse = IServerResponse<LLMFunctionConnection>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<LLMFunctionConnection>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/LLMFunctionConnection"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "key": "string",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "enabled": true,
                    "costFactor": 0,
                    "launch": "auto",
                    "lastUsedTs": 0,
                    "createdDT": "2026-01-15T12:00:00.000Z",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:llm required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:llm required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: unknown function key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: unknown function key",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the function has no launch mode (reason: launch)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the function has no launch mode (reason: launch)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmFunctionsUpdateResponse = IServerResponse<LLMFunctionConnection>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/functions/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/functions/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<LLMFunctionConnection>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmFunctionsUpdateBody"
              },
              "example": {
                "key": "string",
                "enabled": false,
                "launch": "auto"
              }
            }
          }
        }
      }
    },
    "/llm/entity/gist": {
      "post": {
        "operationId": "llm_entity_gist",
        "summary": "🔒 #26928 ИИ-функция «Суть»: одно-два предложения о проблеме и решении задачи, ошибки или фичи по текущему описанию и итогу - формирует и записывает в `gist` поверх прежней.",
        "description": "#26928 ИИ-функция «Суть»: одно-два предложения о проблеме и решении задачи, ошибки или фичи по текущему описанию и итогу - формирует и записывает в `gist` поверх прежней.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:update`, `feature:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/entity/gist`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmEntityGistBody {\n  entity: llm_search_semantic_Body_filters_types_item\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmEntityGistResponse = IServerResponse<Resp_llm_entity_gist>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_entity_gist>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_entity_gist"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "gist": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no right to update the entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no right to update the entity",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: the entity does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: the entity does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the title, description and result have nothing to summarize (reason: noContent), the previous gist stays",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the title, description and result have nothing to summarize (reason: noContent), the previous gist stays",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "502": {
            "description": "ExternalRequest: no model answered (reason: LLMError.Kind)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 502,
                  "data": {
                    "err": "ExternalRequest: no model answered (reason: LLMError.Kind)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmEntityGistResponse = IServerResponse<Resp_llm_entity_gist>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/entity/gist?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/entity/gist', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_entity_gist>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmEntityGistBody"
              },
              "example": {
                "entity": "feature",
                "ID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/edit/spellcheck": {
      "post": {
        "operationId": "llm_edit_spellcheck",
        "summary": "🔒 #26677 ИИ-функция «Орфография и пунктуация»: текст Markdown с исправленными ошибками и список правок; код, ссылки, адреса, токены, разделы и маркеры заголовков модель не видит и не меняет.",
        "description": "#26677 ИИ-функция «Орфография и пунктуация»: текст Markdown с исправленными ошибками и список правок; код, ссылки, адреса, токены, разделы и маркеры заголовков модель не видит и не меняет.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:update`, `feature:update`, `meeting:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/edit/spellcheck`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmEditSpellcheckBody {\n  text: string\n  entityType?: string | null\n  entityID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmEditSpellcheckResponse = IServerResponse<Resp_llm_edit_spellcheck>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_edit_spellcheck>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_edit_spellcheck"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the function is not activated in the company (reason: notActivated)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the function is not activated in the company (reason: notActivated)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the text is larger than the function limit (reason: tooLarge, max) or has fewer than 10 characters without markup, code, links and tokens (reason: tooShort, min)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the text is larger than the function limit (reason: tooLarge, max) or has fewer than 10 characters without markup, code, links and tokens (reason: tooShort, min)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "502": {
            "description": "ExternalRequest: no model answered or the edits changed a protected part (reason: LLMError.Kind); the check text is only in the log",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 502,
                  "data": {
                    "err": "ExternalRequest: no model answered or the edits changed a protected part (reason: LLMError.Kind); the check text is only in the log",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmEditSpellcheckResponse = IServerResponse<Resp_llm_edit_spellcheck>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/edit/spellcheck?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/edit/spellcheck', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_edit_spellcheck>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmEditSpellcheckBody"
              },
              "example": {
                "text": "string",
                "entityType": "string",
                "entityID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/create/title": {
      "post": {
        "operationId": "llm_create_title",
        "summary": "🔒 #26667 ИИ-функция «Названия»: название задачи, ошибки, фичи или совещания по описанию и контексту фичи или продукта.",
        "description": "#26667 ИИ-функция «Названия»: название задачи, ошибки, фичи или совещания по описанию и контексту фичи или продукта.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:create`, `feature:create`, `meeting:create` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/create/title`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmCreateTitleBody {\n  kind?: llm_create_title_Body_kind\n  spec: string\n  featureID?: string | null\n  productID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmCreateTitleResponse = IServerResponse<Resp_llm_create_title>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_llm_create_title>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_llm_create_title"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "title": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the function is not activated in the company (reason: notActivated) or no access to the product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "502": {
            "description": "ExternalRequest: no model answered (reason: LLMError.Kind)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 502,
                  "data": {
                    "err": "ExternalRequest: no model answered (reason: LLMError.Kind)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmCreateTitleResponse = IServerResponse<Resp_llm_create_title>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/create/title?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/create/title', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_llm_create_title>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmCreateTitleBody"
              },
              "example": {
                "kind": "task",
                "spec": "string",
                "featureID": "00000000-0000-4000-8000-000000000001",
                "productID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/llm/bug/duplicates": {
      "post": {
        "operationId": "llm_bug_duplicates",
        "summary": "🔒 #26690 ИИ-функция «Проверка на дубли»: кандидаты - ошибки продукта по сути (подбор поиска по смыслу), модель отбирает дубли с пояснением. Сбой модели - `skipped`, ошибку заводят как обычно.",
        "description": "#26690 ИИ-функция «Проверка на дубли»: кандидаты - ошибки продукта по сути (подбор поиска по смыслу), модель отбирает дубли с пояснением. Сбой модели - `skipped`, ошибку заводят как обычно.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:create` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /llm/bug/duplicates`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmBugDuplicatesBody {\n  productID: string\n  title?: string\n  spec?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmBugDuplicatesResponse = IServerResponse<LLMBugDuplicates_Result>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<LLMBugDuplicates_Result>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/LLMBugDuplicates_Result"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: no access to the product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: no access to the product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmBugDuplicatesResponse = IServerResponse<LLMBugDuplicates_Result>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/bug/duplicates?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/bug/duplicates', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<LLMBugDuplicates_Result>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmBugDuplicatesBody"
              },
              "example": {
                "productID": "00000000-0000-4000-8000-000000000001",
                "title": "",
                "spec": ""
              }
            }
          }
        }
      }
    },
    "/llm/outcome": {
      "post": {
        "operationId": "llm_outcome",
        "summary": "🔒 #26967 Итог запуска ИИ-функции от пользователя: результат применён (`applied`) или закрыт без применения (`dismissed`). Пишется в журнал расхода; доля применённых видна на странице «ИИ-функции».",
        "description": "#26967 Итог запуска ИИ-функции от пользователя: результат применён (`applied`) или закрыт без применения (`dismissed`). Пишется в журнал расхода; доля применённых видна на странице «ИИ-функции».\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** не требуются — outcome of the session user's own LLM function run\n\n### TypeScript (copy-paste)\n\n**`POST /llm/outcome`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface LlmOutcomeBody {\n  runID: string\n  outcome: llm_outcome_Body_outcome\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type LlmOutcomeResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "LLM Functions"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: the run belongs to another user (reason: notOwner)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: the run belongs to another user (reason: notOwner)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: no successful run with this runID in the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: no successful run with this runID in the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: LlmOutcomeResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/llm/outcome?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'llm/outcome', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LlmOutcomeBody"
              },
              "example": {
                "runID": "00000000-0000-4000-8000-000000000001",
                "outcome": "applied"
              }
            }
          }
        }
      }
    },
    "/iterations/list": {
      "get": {
        "operationId": "iterations_list",
        "summary": "🔒 Получение списка итераций с агрегированными затратами времени и денег. #26673 Деньги - с маржой или без маржи на весь отчёт (параметр margin, применённый режим - поле margin).",
        "description": "Получение списка итераций с агрегированными затратами времени и денег. #26673 Деньги - с маржой или без маржи на весь отчёт (параметр margin, применённый режим - поле margin).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:allowed-products`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /iterations/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IterationsListParams {\n  userID?: string | null\n  margin?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IterationsListResponse = IServerResponse<Resp_iterations_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Iterations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "margin",
            "in": "query",
            "required": false,
            "description": "Можно передать header `margin` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_iterations_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_iterations_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "margin": false,
                    "list": [
                      {
                        "key": {}
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:allowed-products required to view another user iterations stats (own, department, common or a shared accessible product - then only worklogs of the viewer products); margin=false requires privilege worklog:no-margin to the report (privilegeRequired)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:allowed-products required to view another user iterations stats (own, department, common or a shared accessible product - then only worklogs of the viewer products); margin=false requires privilege worklog:no-margin to the report (privilegeRequired)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IterationsListResponse = IServerResponse<Resp_iterations_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/iterations/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'iterations/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_iterations_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/iterations/state": {
      "get": {
        "operationId": "iterations_state",
        "summary": "🔒 Получение полного состояния итерации (ворклоги, отпуска, задачи и встречи) для пользователя или всей компании. #26673 Деньги ворклогов - с маржой или без маржи на весь отчёт (параметр margin, применённый режим - поле margin).",
        "description": "Получение полного состояния итерации (ворклоги, отпуска, задачи и встречи) для пользователя или всей компании. #26673 Деньги ворклогов - с маржой или без маржи на весь отчёт (параметр margin, применённый режим - поле margin).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:allowed-products`, `user:timeoff`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /iterations/state`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IterationsStateParams {\n  iterationKey?: number | null\n  userID?: string | null\n  margin?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IterationsStateResponse = IServerResponse<Resp_iterations_state>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Iterations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "iterationKey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `iterationKey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "margin",
            "in": "query",
            "required": false,
            "description": "Можно передать header `margin` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_iterations_state>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_iterations_state"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "margin": false,
                    "worklogs": [
                      {
                        "ID": null,
                        "cID": null,
                        "productID": null,
                        "versionID": null,
                        "featureID": null,
                        "taskID": null,
                        "meetingID": null,
                        "category": null,
                        "status": null,
                        "sessID": null,
                        "userID": null,
                        "roleID": null,
                        "roleType": null,
                        "iterationKey": null,
                        "isActive": null,
                        "daykey": null,
                        "startDt": null,
                        "endDt": null,
                        "time": null,
                        "money": null,
                        "moneySalary": null,
                        "moneyAward": null,
                        "note": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "timeoffs": [
                      {
                        "ID": null,
                        "cID": null,
                        "userID": null,
                        "roleID": null,
                        "type": null,
                        "paid": null,
                        "sickLeaveID": null,
                        "statementFID": null,
                        "statementOrgID": null,
                        "statementSentTS": null,
                        "year": null,
                        "startDayKey": null,
                        "endDayKey": null,
                        "daysCount": null,
                        "startWorkDayKey": null,
                        "userNote": null,
                        "userAvailable": null,
                        "status": null,
                        "adminNote": null,
                        "adminUID": null,
                        "payment": null,
                        "statement": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "tasks": {},
                    "meetings": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:allowed-products required to view another user iteration state (own, department, common or a shared accessible product - then only worklogs of the viewer products); margin=false requires privilege worklog:no-margin to the report (privilegeRequired)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:allowed-products required to view another user iteration state (own, department, common or a shared accessible product - then only worklogs of the viewer products); margin=false requires privilege worklog:no-margin to the report (privilegeRequired)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified iterationKey or target userID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified iterationKey or target userID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IterationsStateResponse = IServerResponse<Resp_iterations_state>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/iterations/state?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'iterations/state', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_iterations_state>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/iteration/generate": {
      "get": {
        "operationId": "iteration_generate",
        "summary": "🔒🛡️ Генерация рабочей календарной итерации на год.",
        "description": "Генерация рабочей календарной итерации на год.\n\n**Access:** `administrator` (100 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** не требуются — global iteration calendar service command (administrator access type)\n\n### TypeScript (copy-paste)\n\n**`GET /iteration/generate`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IterationGenerateParams {\n  year?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IterationGenerateResponse = IServerResponse<Resp_iteration_generate>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Iterations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "description": "Можно передать header `year` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_iteration_generate>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_iteration_generate"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Administrator permissions required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Administrator permissions required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IterationGenerateResponse = IServerResponse<Resp_iteration_generate>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/iteration/generate?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'iteration/generate', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_iteration_generate>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/meeting/zoom/availability": {
      "get": {
        "operationId": "integration_meeting_zoom_availability",
        "summary": "🔒 Проверка доступности текущей интеграции с Zoom.",
        "description": "Проверка доступности текущей интеграции с Zoom.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:read` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/meeting/zoom/availability`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationMeetingZoomAvailabilityResponse = IServerResponse<Resp_integration_meeting_zoom_availability>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_meeting_zoom_availability>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_meeting_zoom_availability"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "enabled": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationMeetingZoomAvailabilityResponse = IServerResponse<Resp_integration_meeting_zoom_availability>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/meeting/zoom/availability?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/meeting/zoom/availability', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_meeting_zoom_availability>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/meeting/zoom/current": {
      "get": {
        "operationId": "integration_meeting_zoom_current",
        "summary": "🔒 Получение текущей интеграции с Zoom.",
        "description": "Получение текущей интеграции с Zoom.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `integration:meetings` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/meeting/zoom/current`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationMeetingZoomCurrentResponse = IServerResponse<Resp_integration_meeting_zoom_current>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_meeting_zoom_current>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_meeting_zoom_current"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "integration": {},
                    "usersWithoutZoomEmail": [
                      "string"
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:meetings required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:meetings required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationMeetingZoomCurrentResponse = IServerResponse<Resp_integration_meeting_zoom_current>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/meeting/zoom/current?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/meeting/zoom/current', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_meeting_zoom_current>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/meeting/zoom/install-url": {
      "get": {
        "operationId": "integration_meeting_zoom_install-url",
        "summary": "🔒 Получение URL для установки OAuth-интеграции с Zoom.",
        "description": "Получение URL для установки OAuth-интеграции с Zoom.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:meetings` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/meeting/zoom/install-url`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationMeetingZoomInstallUrlResponse = IServerResponse<Resp_integration_meeting_zoom_install-url>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_meeting_zoom_install-url>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_meeting_zoom_install-url"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "url": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:meetings required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:meetings required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationMeetingZoomInstallUrlResponse = IServerResponse<Resp_integration_meeting_zoom_install-url>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/meeting/zoom/install-url?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/meeting/zoom/install-url', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_meeting_zoom_install-url>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/meeting/zoom/webhook": {
      "post": {
        "operationId": "integration_meeting_zoom_webhook",
        "summary": "🔓 Zoom app webhook",
        "description": "Zoom app webhook\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write`\n\n### TypeScript (copy-paste)\n\n**`POST /integration/meeting/zoom/webhook`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationMeetingZoomWebhookResponse = IServerResponse<Resp_integration_meeting_zoom_webhook>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_meeting_zoom_webhook>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_meeting_zoom_webhook"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "success": false,
                    "plainToken": "string",
                    "encryptedToken": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Request is empty or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Request is empty or invalid",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Missing signature or invalid timestamp",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Missing signature or invalid timestamp",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationMeetingZoomWebhookResponse = IServerResponse<Resp_integration_meeting_zoom_webhook>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/meeting/zoom/webhook?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_meeting_zoom_webhook>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Raw body (binary / text)",
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/integration/meeting/create": {
      "post": {
        "operationId": "integration_meeting_create",
        "summary": "🔒 Create meeting integration",
        "description": "Create meeting integration\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:meetings` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/meeting/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationMeetingCreateParams {\n  code: string\n  state: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type IntegrationMeetingCreateBody = Partial<Resp_integration_meeting_create>\n\nexport interface IntegrationMeetingCreateBodyFields {\n  ID?: string\n  cID?: string\n  status?: MeetingIntegration_Status\n  type?: MeetingIntegration_type\n  account?: {\n  id: string\n  accountId?: string | null\n  email: string\n  name?: string | null\n  planType?: string | null\n} | null\n  credentials?: {\n  accessToken: string\n  refreshToken: string\n  expirationTimeIso: string\n  scopes: Array<string>\n  syncTimeout?: number | null\n} | null\n  errorCode?: MeetingIntegration_ErrorCode | null\n  createdDT?: string\n  createdUID?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationMeetingCreateResponse = IServerResponse<Resp_integration_meeting_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "Можно передать header `code` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "description": "Можно передать header `state` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_meeting_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_meeting_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid parameters or state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid parameters or state",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:meetings required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:meetings required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Meeting integration with same ID already exist or Zoom integration already connected",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Meeting integration with same ID already exist or Zoom integration already connected",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationMeetingCreateResponse = IServerResponse<Resp_integration_meeting_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/meeting/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/meeting/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_meeting_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationMeetingCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "status": 1,
                "type": "zoom",
                "account": {
                  "id": "string",
                  "accountId": "string",
                  "email": "string",
                  "name": "string",
                  "planType": "string"
                },
                "credentials": {
                  "accessToken": "string",
                  "refreshToken": "string",
                  "expirationTimeIso": "string",
                  "scopes": [
                    "string"
                  ],
                  "syncTimeout": 0
                },
                "errorCode": 1,
                "createdDT": "2026-01-15T12:00:00.000Z",
                "createdUID": "00000000-0000-4000-8000-000000000001",
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/integration/meeting/delete": {
      "get": {
        "operationId": "integration_meeting_delete",
        "summary": "🔒 Удаление интеграции с видеоконференциями.",
        "description": "Удаление интеграции с видеоконференциями.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:meetings` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/meeting/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationMeetingDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationMeetingDeleteResponse = IServerResponse<Resp_integration_meeting_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Meetings"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_meeting_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_meeting_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:meetings required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:meetings required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Meeting integration with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Meeting integration with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationMeetingDeleteResponse = IServerResponse<Resp_integration_meeting_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/meeting/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/meeting/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_meeting_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/webhook/gitlab/system-webhook": {
      "post": {
        "operationId": "integration_git_webhook_gitlab_system-webhook",
        "summary": "🔓 Обработка системных вебхуков от GitLab (события создания/удаления проектов).",
        "description": "Обработка системных вебхуков от GitLab (события создания/удаления проектов).\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write`\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/webhook/gitlab/system-webhook`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitWebhookGitlabSystemWebhookParams {\n  cID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitWebhookGitlabSystemWebhookResponse = IServerResponse<Resp_integration_git_webhook_gitlab_system-webhook>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "cID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `cID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_webhook_gitlab_system-webhook>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_webhook_gitlab_system-webhook"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "success": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Missing secret token header or invalid payload format",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Missing secret token header or invalid payload format",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company or GitLab integration with specified cID not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company or GitLab integration with specified cID not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitWebhookGitlabSystemWebhookResponse = IServerResponse<Resp_integration_git_webhook_gitlab_system-webhook>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/webhook/gitlab/system-webhook?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_webhook_gitlab_system-webhook>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Raw body (binary / text)",
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/integration/git/webhook/gitlab/webhook": {
      "post": {
        "operationId": "integration_git_webhook_gitlab_webhook",
        "summary": "🔓 Обработка входящих проектных вебхуков от GitLab (коммиты, комментарии к коммитам).",
        "description": "Обработка входящих проектных вебхуков от GitLab (коммиты, комментарии к коммитам).\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write`\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/webhook/gitlab/webhook`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitWebhookGitlabWebhookParams {\n  cID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitWebhookGitlabWebhookResponse = IServerResponse<Resp_integration_git_webhook_gitlab_webhook>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "cID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `cID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_webhook_gitlab_webhook>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_webhook_gitlab_webhook"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Missing secret token header or invalid payload format",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Missing secret token header or invalid payload format",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company or GitLab integration with specified cID not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company or GitLab integration with specified cID not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitWebhookGitlabWebhookResponse = IServerResponse<Resp_integration_git_webhook_gitlab_webhook>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/webhook/gitlab/webhook?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_webhook_gitlab_webhook>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Raw body (binary / text)",
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/integration/git/webhook/github/webhook": {
      "post": {
        "operationId": "integration_git_webhook_github_webhook",
        "summary": "🔓 Обработка входящих вебхуков от GitHub App: установка, репозитории, коммиты. События pull request обрабатываются с #26390.",
        "description": "Обработка входящих вебхуков от GitHub App: установка, репозитории, коммиты. События pull request обрабатываются с #26390.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write`\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/webhook/github/webhook`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitWebhookGithubWebhookResponse = IServerResponse<Resp_integration_git_webhook_github_webhook>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_webhook_github_webhook>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_webhook_github_webhook"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "success": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Missing required X-GitHub-Delivery header or invalid JSON payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Missing required X-GitHub-Delivery header or invalid JSON payload",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Missing or invalid X-Hub-Signature-256 signature",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Missing or invalid X-Hub-Signature-256 signature",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target GitHub integration or installation record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target GitHub integration or installation record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitWebhookGithubWebhookResponse = IServerResponse<Resp_integration_git_webhook_github_webhook>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/webhook/github/webhook?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_webhook_github_webhook>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Raw body (binary / text)",
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/integration/git/passport/draft": {
      "post": {
        "operationId": "integration_git_passport_draft",
        "summary": "🔒 #26676 Решение по черновику технического паспорта: accept - черновик (с правкой или без) становится паспортом, отметка устаревания снимается; reject - черновик удаляется.",
        "description": "#26676 Решение по черновику технического паспорта: accept - черновик (с правкой или без) становится паспортом, отметка устаревания снимается; reject - черновик удаляется.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/passport/draft`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface IntegrationGitPassportDraftBody {\n  repositoryID: string\n  action: integration_git_passport_draft_Body_action\n  text?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitPassportDraftResponse = IServerResponse<Resp_integration_git_passport_draft>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_passport_draft>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_passport_draft"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "passport": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: the text is longer than 40000 characters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: the text is longer than 40000 characters",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the passport has no draft",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the passport has no draft",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitPassportDraftResponse = IServerResponse<Resp_integration_git_passport_draft>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/passport/draft?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/passport/draft', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_passport_draft>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationGitPassportDraftBody"
              },
              "example": {
                "repositoryID": "00000000-0000-4000-8000-000000000001",
                "action": "accept",
                "text": "string"
              }
            }
          }
        }
      }
    },
    "/integration/git/passport/generate": {
      "post": {
        "operationId": "integration_git_passport_generate",
        "summary": "🔒 #26676 Сформировать или обновить технический паспорт репозитория: сборка в фоне, ответ сразу. Паспорта нет - сохраняется; есть - новый вариант ложится черновиком до решения администратора.",
        "description": "#26676 Сформировать или обновить технический паспорт репозитория: сборка в фоне, ответ сразу. Паспорта нет - сохраняется; есть - новый вариант ложится черновиком до решения администратора.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/passport/generate`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface IntegrationGitPassportGenerateBody {\n  repositoryID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitPassportGenerateResponse = IServerResponse<Resp_integration_git_passport_generate>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_passport_generate>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_passport_generate"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "started": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required, the function is not activated in the company (reason: notActivated), the integration is disabled or the repository is not linked to a project",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required, the function is not activated in the company (reason: notActivated), the integration is disabled or the repository is not linked to a project",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the passport is already being generated (reason: building)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the passport is already being generated (reason: building)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "500": {
            "description": "ExternalRequest: no model is configured on the stand (reason: unavailable)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 500,
                  "data": {
                    "err": "ExternalRequest: no model is configured on the stand (reason: unavailable)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitPassportGenerateResponse = IServerResponse<Resp_integration_git_passport_generate>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/passport/generate?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/passport/generate', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_passport_generate>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationGitPassportGenerateBody"
              },
              "example": {
                "repositoryID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/integration/git/passport/get": {
      "get": {
        "operationId": "integration_git_passport_get",
        "summary": "🔒 #26676 Технический паспорт репозитория: текст, отметка устаревания, черновик обновления, доступность сборки. Читают администратор Git-интеграции и все, кому доступен продукт с этим репозиторием (#26883).",
        "description": "#26676 Технический паспорт репозитория: текст, отметка устаревания, черновик обновления, доступность сборки. Читают администратор Git-интеграции и все, кому доступен продукт с этим репозиторием (#26883).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `integration:git` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/passport/get`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitPassportGetParams {\n  repositoryID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitPassportGetResponse = IServerResponse<Resp_integration_git_passport_get>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "repositoryID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `repositoryID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_passport_get>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_passport_get"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "enabled": false,
                    "building": false,
                    "passport": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required - no access to a product with this repository",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required - no access to a product with this repository",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitPassportGetResponse = IServerResponse<Resp_integration_git_passport_get>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/passport/get?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/passport/get', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_passport_get>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/passport/save": {
      "post": {
        "operationId": "integration_git_passport_save",
        "summary": "🔒 #26676 Ручная правка технического паспорта репозитория. Паспорт помечается правкой: сборка при привязке к проекту его не перезапишет, а положит черновиком.",
        "description": "#26676 Ручная правка технического паспорта репозитория. Паспорт помечается правкой: сборка при привязке к проекту его не перезапишет, а положит черновиком.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/passport/save`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface IntegrationGitPassportSaveBody {\n  repositoryID: string\n  text: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitPassportSaveResponse = IServerResponse<Resp_integration_git_passport_save>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_passport_save>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_passport_save"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "passport": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: the text is empty or longer than 40000 characters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: the text is empty or longer than 40000 characters",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: the repository has no passport yet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: the repository has no passport yet",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitPassportSaveResponse = IServerResponse<Resp_integration_git_passport_save>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/passport/save?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/passport/save', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_passport_save>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationGitPassportSaveBody"
              },
              "example": {
                "repositoryID": "00000000-0000-4000-8000-000000000001",
                "text": "string"
              }
            }
          }
        }
      }
    },
    "/integration/git/github/install": {
      "get": {
        "operationId": "integration_git_github_install",
        "summary": "🔒 Получение URL установки приложения GitHub App. state подписан и привязан к компании и пользователю сессии: завершить установку (integration/git/create) можно только с ним.",
        "description": "Получение URL установки приложения GitHub App. state подписан и привязан к компании и пользователю сессии: завершить установку (integration/git/create) можно только с ним.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/github/install`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitGithubInstallResponse = IServerResponse<Resp_integration_git_github_install>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_github_install>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_github_install"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "url": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitGithubInstallResponse = IServerResponse<Resp_integration_git_github_install>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/github/install?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/github/install', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_github_install>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/commit/comment-list": {
      "get": {
        "operationId": "integration_git_commit_comment-list",
        "summary": "🔒 Получение списка комментариев к коммиту.",
        "description": "Получение списка комментариев к коммиту.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/commit/comment-list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitCommitCommentListParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitCommitCommentListResponse = IServerResponse<Resp_integration_git_commit_comment-list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_commit_comment-list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_commit_comment-list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege task:read of a commit task or product:read of the repository project required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege task:read of a commit task or product:read of the repository project required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Commit with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Commit with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitCommitCommentListResponse = IServerResponse<Resp_integration_git_commit_comment-list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/commit/comment-list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/commit/comment-list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_commit_comment-list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/commit/lines-backfill": {
      "post": {
        "operationId": "integration_git_commit_lines-backfill",
        "summary": "🔒 Дозаполнение изменённых диапазонов строк у синхронизированных коммитов репозитория (#26590): коммиты без диапазонов ставятся в очередь воркера синхронизации коммитов, он перечитывает их у провайдера по одному.",
        "description": "Дозаполнение изменённых диапазонов строк у синхронизированных коммитов репозитория (#26590): коммиты без диапазонов ставятся в очередь воркера синхронизации коммитов, он перечитывает их у провайдера по одному.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/commit/lines-backfill`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitCommitLinesBackfillParams {\n  repositoryID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitCommitLinesBackfillResponse = IServerResponse<Resp_integration_git_commit_lines-backfill>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "repositoryID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `repositoryID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_commit_lines-backfill>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_commit_lines-backfill"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "queued": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Repository is not synchronized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Repository is not synchronized",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitCommitLinesBackfillResponse = IServerResponse<Resp_integration_git_commit_lines-backfill>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/commit/lines-backfill?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/commit/lines-backfill', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_commit_lines-backfill>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/branch/create": {
      "post": {
        "operationId": "integration_git_branch_create",
        "summary": "🔒 Создание ветки задачи в репозитории проекта от ветки по умолчанию (#26575): вкладка «Git». Только исполнитель стадии «Исполнение» задачи разработки или ошибки (`task:work`).",
        "description": "Создание ветки задачи в репозитории проекта от ветки по умолчанию (#26575): вкладка «Git». Только исполнитель стадии «Исполнение» задачи разработки или ошибки (`task:work`).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:work` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/branch/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitBranchCreateParams {\n  taskID: string\n  repositoryID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitBranchCreateResponse = IServerResponse<Resp_integration_git_branch_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "taskID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `taskID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "repositoryID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `repositoryID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_branch_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_branch_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "git": null,
                    "name": "string",
                    "url": "string",
                    "created": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Not the current assignee of the work stage, repository is not linked to the project, integration is disabled or the provider refused",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Not the current assignee of the work stage, repository is not linked to the project, integration is disabled or the provider refused",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Task, repository or default branch at provider not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Task, repository or default branch at provider not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Repository has no known default branch yet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Repository has no known default branch yet",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitBranchCreateResponse = IServerResponse<Resp_integration_git_branch_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/branch/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/branch/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_branch_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/agent-access": {
      "get": {
        "operationId": "integration_git_agent-access",
        "summary": "🔒 Действуют ли Git-разрешения API-токенов в компании: открыл ли администратор доступ агентов хотя бы у одного репозитория проекта (#26391). Для подсказки при выдаче токена.",
        "description": "Действуют ли Git-разрешения API-токенов в компании: открыл ли администратор доступ агентов хотя бы у одного репозитория проекта (#26391). Для подсказки при выдаче токена.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:ai-tokens` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/agent-access`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitAgentAccessResponse = IServerResponse<Resp_integration_git_agent-access>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_agent-access>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_agent-access"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "read": false,
                    "write": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitAgentAccessResponse = IServerResponse<Resp_integration_git_agent-access>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/agent-access?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/agent-access', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_agent-access>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/commit-list": {
      "get": {
        "operationId": "integration_git_commit-list",
        "summary": "🔒 Получение списка коммитов, привязанных к сущности (продукту, версии, фиче или задаче).",
        "description": "Получение списка коммитов, привязанных к сущности (продукту, версии, фиче или задаче).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `feature:read`, `version:read`, `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/commit-list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitCommitListParams {\n  type: EntityType\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitCommitListResponse = IServerResponse<Resp_integration_git_commit-list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Можно передать header `type` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/EntityType"
            },
            "example": "project"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_commit-list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_commit-list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "tasks": {},
                    "repositories": [
                      null
                    ],
                    "groups": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid entity type provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid entity type provided",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege task:read, feature:read, version:read or product:read (by type) required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege task:read, feature:read, version:read or product:read (by type) required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target entity with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target entity with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitCommitListResponse = IServerResponse<Resp_integration_git_commit-list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/commit-list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/commit-list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_commit-list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/create": {
      "post": {
        "operationId": "integration_git_create",
        "summary": "🔒 Создание новой интеграции с Git-сервисом (GitLab, GitHub). Для GitHub App требуется installationId и подписанный state из github/install; компания берётся из сессии.",
        "description": "Создание новой интеграции с Git-сервисом (GitLab, GitHub). Для GitHub App требуется installationId и подписанный state из github/install; компания берётся из сессии.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface IntegrationGitCreateBody {\n  ID?: string | null\n  type: GitIntegration_Type\n  title?: string | null\n  params?: {\n  host?: string | null\n  port?: number | null\n  requestTimeout?: number | null\n  token?: string | null\n} | null\n  installationId?: number | null\n  state?: string | null\n  autoProvisionUsers?: boolean | null\n  adminActions?: {\n  blockUsers?: boolean | null\n  systemHook?: boolean | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitCreateResponse = IServerResponse<Resp_integration_git_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Required parameters missing (type, params.host, GitHub installationId) or invalid state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Required parameters missing (type, params.host, GitHub installationId) or invalid state",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Integration with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Integration with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitCreateResponse = IServerResponse<Resp_integration_git_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationGitCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "type": "GitLab",
                "title": "string",
                "params": {
                  "host": "string",
                  "port": 0,
                  "requestTimeout": 0,
                  "token": "string"
                },
                "installationId": 0,
                "state": "string",
                "autoProvisionUsers": false,
                "adminActions": {
                  "blockUsers": false,
                  "systemHook": false
                }
              }
            }
          }
        }
      }
    },
    "/integration/git/delete": {
      "get": {
        "operationId": "integration_git_delete",
        "summary": "🔒 Удаление Git-интеграции и связанных репозиториев и вебхуков.",
        "description": "Удаление Git-интеграции и связанных репозиториев и вебхуков.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitDeleteResponse = IServerResponse<Resp_integration_git_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git integration with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git integration with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitDeleteResponse = IServerResponse<Resp_integration_git_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/list": {
      "get": {
        "operationId": "integration_git_list",
        "summary": "🔒 Получение списка всех Git-интеграций компании (активных и неактивных).",
        "description": "Получение списка всех Git-интеграций компании (активных и неактивных).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/list`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitListResponse = IServerResponse<Resp_integration_git_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "active": [
                      null
                    ],
                    "inactive": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitListResponse = IServerResponse<Resp_integration_git_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/update": {
      "post": {
        "operationId": "integration_git_update",
        "summary": "🔒 Обновление настроек интеграции с Git (название, параметры подключения, сопоставление пользователей).",
        "description": "Обновление настроек интеграции с Git (название, параметры подключения, сопоставление пользователей).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface IntegrationGitUpdateBody {\n  title?: string | null\n  params?: {\n  host?: string | null\n  port?: number | null\n  requestTimeout?: number | null\n  token?: string | null\n} | null\n  users?: Record<string, any> | null\n  autoProvisionUsers?: boolean | null\n  adminActions?: {\n  blockUsers?: boolean | null\n  systemHook?: boolean | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitUpdateResponse = IServerResponse<Resp_integration_git_update>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_update>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_update"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid body",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git integration with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git integration with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitUpdateResponse = IServerResponse<Resp_integration_git_update>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_update>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationGitUpdateBody"
              },
              "example": {
                "title": "string",
                "params": {
                  "host": "string",
                  "port": 0,
                  "requestTimeout": 0,
                  "token": "string"
                },
                "users": {},
                "autoProvisionUsers": false,
                "adminActions": {
                  "blockUsers": false,
                  "systemHook": false
                }
              }
            }
          }
        }
      }
    },
    "/integration/git/updateRepoStatus": {
      "post": {
        "operationId": "integration_git_updateRepoStatus",
        "summary": "🔒 Включение или отключение отслеживания конкретного Git-репозитория.",
        "description": "Включение или отключение отслеживания конкретного Git-репозитория.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/git/updateRepoStatus`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitUpdateRepoStatusParams {\n  ID?: string | null\n  status?: GitIntegration_Status | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitUpdateRepoStatusResponse = IServerResponse<Resp_integration_git_updateRepoStatus>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Можно передать header `status` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/GitIntegration_Status"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": 10
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_updateRepoStatus>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_updateRepoStatus"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git repository with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git repository with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitUpdateRepoStatusResponse = IServerResponse<Resp_integration_git_updateRepoStatus>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/updateRepoStatus?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/updateRepoStatus', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_updateRepoStatus>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/git/updateStatus": {
      "get": {
        "operationId": "integration_git_updateStatus",
        "summary": "🔒 Включение или отключение всей Git-интеграции.",
        "description": "Включение или отключение всей Git-интеграции.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:git` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/git/updateStatus`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationGitUpdateStatusParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationGitUpdateStatusResponse = IServerResponse<Resp_integration_git_updateStatus>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Git"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_git_updateStatus>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_git_updateStatus"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:git required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:git required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Git integration with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Git integration with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationGitUpdateStatusResponse = IServerResponse<Resp_integration_git_updateStatus>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/git/updateStatus?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/git/updateStatus', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_git_updateStatus>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/figma/availability": {
      "get": {
        "operationId": "integration_figma_availability",
        "summary": "🔒 Проверка доступности текущей интеграции с Figma.",
        "description": "Проверка доступности текущей интеграции с Figma.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:read` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/figma/availability`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationFigmaAvailabilityResponse = IServerResponse<Resp_integration_figma_availability>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Figma"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_figma_availability>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_figma_availability"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "enabled": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationFigmaAvailabilityResponse = IServerResponse<Resp_integration_figma_availability>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/figma/availability?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/figma/availability', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_figma_availability>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/figma/create": {
      "post": {
        "operationId": "integration_figma_create",
        "summary": "🔒 Create Figma integration from OAuth callback.",
        "description": "Create Figma integration from OAuth callback.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:design` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /integration/figma/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationFigmaCreateParams {\n  code: string\n  state: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type IntegrationFigmaCreateBody = Partial<Resp_integration_figma_create>\n\nexport interface IntegrationFigmaCreateBodyFields {\n  ID?: string\n  cID?: string\n  status?: MeetingIntegration_Status\n  account?: {\n  id: string\n  email?: string | null\n  name?: string | null\n  handle?: string | null\n} | null\n  credentials?: {\n  accessToken: string\n  refreshToken: string\n  expirationTimeIso: string\n  scopes: Array<string>\n} | null\n  errorCode?: FigmaIntegration_ErrorCode | null\n  createdDT?: string\n  createdUID?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationFigmaCreateResponse = IServerResponse<Resp_integration_figma_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Figma"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "Можно передать header `code` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "description": "Можно передать header `state` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_figma_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_figma_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid parameters or state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid parameters or state",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:design required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:design required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Figma integration already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Figma integration already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationFigmaCreateResponse = IServerResponse<Resp_integration_figma_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/figma/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/figma/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_figma_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationFigmaCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "status": 1,
                "account": {
                  "id": "string",
                  "email": "string",
                  "name": "string",
                  "handle": "string"
                },
                "credentials": {
                  "accessToken": "string",
                  "refreshToken": "string",
                  "expirationTimeIso": "string",
                  "scopes": [
                    "string"
                  ]
                },
                "errorCode": 1,
                "createdDT": "2026-01-15T12:00:00.000Z",
                "createdUID": "00000000-0000-4000-8000-000000000001",
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/integration/figma/current": {
      "get": {
        "operationId": "integration_figma_current",
        "summary": "🔒 Получение текущей интеграции с Figma.",
        "description": "Получение текущей интеграции с Figma.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `integration:design` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/figma/current`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationFigmaCurrentResponse = IServerResponse<Resp_integration_figma_current>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Figma"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_figma_current>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_figma_current"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "integration": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:design required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:design required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationFigmaCurrentResponse = IServerResponse<Resp_integration_figma_current>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/figma/current?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/figma/current', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_figma_current>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/figma/delete": {
      "get": {
        "operationId": "integration_figma_delete",
        "summary": "🔒 Удаление интеграции с Figma.",
        "description": "Удаление интеграции с Figma.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:design` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/figma/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface IntegrationFigmaDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationFigmaDeleteResponse = IServerResponse<Resp_integration_figma_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Figma"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_figma_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_figma_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:design required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:design required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Figma integration with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Figma integration with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationFigmaDeleteResponse = IServerResponse<Resp_integration_figma_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/figma/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/figma/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_figma_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/integration/figma/install-url": {
      "get": {
        "operationId": "integration_figma_install-url",
        "summary": "🔒 Получение URL для установки OAuth-интеграции с Figma.",
        "description": "Получение URL для установки OAuth-интеграции с Figma.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `integration:design` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /integration/figma/install-url`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type IntegrationFigmaInstallUrlResponse = IServerResponse<Resp_integration_figma_install-url>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Integrations: Figma"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_integration_figma_install-url>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_integration_figma_install-url"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "url": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege integration:design required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege integration:design required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: IntegrationFigmaInstallUrlResponse = IServerResponse<Resp_integration_figma_install-url>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/integration/figma/install-url?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'integration/figma/install-url', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_integration_figma_install-url>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/file/proxy-download": {
      "get": {
        "operationId": "file_proxy-download",
        "summary": "🔒 Проксирование скачивания внешнего файла по URL.",
        "description": "Проксирование скачивания внешнего файла по URL.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** не требуются — download utility limited to the storage allow-list, no resource\n\n### TypeScript (copy-paste)\n\n**`GET /file/proxy-download`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface FileProxyDownloadParams {\n  url: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type FileProxyDownloadResponse = IServerResponse<Resp_file_proxy-download>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Files"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Можно передать header `url` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_file_proxy-download>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_file_proxy-download"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid or unsupported URL format, URL host is not allowed, or upstream error/timeout",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid or unsupported URL format, URL host is not allowed, or upstream error/timeout",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: File/image not found at upstream URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: File/image not found at upstream URL",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: FileProxyDownloadResponse = IServerResponse<Resp_file_proxy-download>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/file/proxy-download?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'file/proxy-download', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_file_proxy-download>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/design/file/check": {
      "post": {
        "operationId": "design_file_check",
        "summary": "🔒 #26638 Проверить ссылку на файл дизайна Figma для продукта или версии: файл дизайна и доступен интеграции компании. Возвращает название файла в Figma.",
        "description": "#26638 Проверить ссылку на файл дизайна Figma для продукта или версии: файл дизайна и доступен интеграции компании. Возвращает название файла в Figma.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:update`, `version:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /design/file/check`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface DesignFileCheckBody {\n  url: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignFileCheckResponse = IServerResponse<DesignFileCheck>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<DesignFileCheck>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/DesignFileCheck"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege product:update or version:update required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege product:update or version:update required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: not a Figma link (figma-not-figma-url), not a design file (figma-not-design-file), the company Figma account cannot access the file (figma-file-inaccessible) or Figma is not connected (figma-not-connected)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: not a Figma link (figma-not-figma-url), not a design file (figma-not-design-file), the company Figma account cannot access the file (figma-file-inaccessible) or Figma is not connected (figma-not-connected)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignFileCheckResponse = IServerResponse<DesignFileCheck>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/file/check?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/file/check', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<DesignFileCheck>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DesignFileCheckBody"
              },
              "example": {
                "url": "string"
              }
            }
          }
        }
      }
    },
    "/design/create": {
      "post": {
        "operationId": "design_create",
        "summary": "🔒 Создать снимок Design из ссылки Figma и привязать к сущности. Если снимок этой ноды уже есть — только связь, без повторной загрузки.",
        "description": "Создать снимок Design из ссылки Figma и привязать к сущности. Если снимок этой ноды уже есть — только связь, без повторной загрузки.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:update`, `feature:update`, `version:update`, `product:update`, `product:structure`, `task:create`, `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /design/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface DesignCreateBody {\n  entityID: string\n  src: string\n  title?: string | null\n  runID?: string | null\n  mainFrame?: boolean | null\n  productID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignCreateResponse = IServerResponse<Resp_design_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_design_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_design_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "type": null,
                    "title": "string",
                    "version": "string",
                    "lastModified": "string",
                    "status": null,
                    "snapshotFID": "00000000-0000-4000-8000-000000000001",
                    "contextFID": "00000000-0000-4000-8000-000000000001",
                    "assetsFID": "00000000-0000-4000-8000-000000000001",
                    "snapshotSize": 0,
                    "contextSize": 0,
                    "assetsSize": 0,
                    "width": 0,
                    "height": 0,
                    "integrationID": "00000000-0000-4000-8000-000000000001",
                    "fileKey": "string",
                    "pageID": "string",
                    "pageName": "string",
                    "nodeID": "string",
                    "nodeType": "string",
                    "nodeUrl": "string",
                    "nodeName": "string",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "createdTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid Figma URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid Figma URL",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege *:update of the entity (main frame - product:structure), task:create for an unsaved entity, product:read for a snapshot of another product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege *:update of the entity (main frame - product:structure), task:create for an unsaved entity, product:read for a snapshot of another product",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Figma node was not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Figma node was not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Figma integration is not connected, node-id is missing, or the company Figma account cannot access the file",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Figma integration is not connected, node-id is missing, or the company Figma account cannot access the file",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignCreateResponse = IServerResponse<Resp_design_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_design_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DesignCreateBody"
              },
              "example": {
                "entityID": "00000000-0000-4000-8000-000000000001",
                "src": "string",
                "title": "string",
                "runID": "string",
                "mainFrame": false,
                "productID": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/design/delete": {
      "delete": {
        "operationId": "design_delete",
        "summary": "🔒 Снять связи DesignRef несохранённой сущности (отмена create без save) и удалить сиротские снимки. Для сохранённой сущности — 422: связи снимает синхрон markdown.",
        "description": "Снять связи DesignRef несохранённой сущности (отмена create без save) и удалить сиротские снимки. Для сохранённой сущности — 422: связи снимает синхрон markdown.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `version:update`, `product:update`, `product:structure` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`DELETE /design/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface DesignDeleteParams {\n  entityID: string\n  designID?: string | null\n  mainFrame?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignDeleteResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "entityID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `entityID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "designID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `designID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "mainFrame",
            "in": "query",
            "required": false,
            "description": "Можно передать header `mainFrame` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege to update the entity or the design product required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege to update the entity or the design product required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Entity is already saved; drop markers via spec/result instead",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Entity is already saved; drop markers via spec/result instead",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignDeleteResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/delete?…', {\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/design/entity": {
      "get": {
        "operationId": "design_entity",
        "summary": "🔒 Словарь снимков Design для открытой сущности (модалка / страница).",
        "description": "Словарь снимков Design для открытой сущности (модалка / страница).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:read`, `feature:read`, `version:read`, `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /design/entity`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface DesignEntityParams {\n  entityID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignEntityResponse = IServerResponse<DesignMap>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "entityID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `entityID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<DesignMap>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/DesignMap"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege *:read of the entity required (unsaved entity - product:read of the snapshots)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege *:read of the entity required (unsaved entity - product:read of the snapshots)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignEntityResponse = IServerResponse<DesignMap>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/entity?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/entity', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<DesignMap>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/design/list": {
      "post": {
        "operationId": "design_list",
        "summary": "🔒 #26638 Снимки Design по ID - главные кадры модулей и компонентов для окон и тултипов. Снимки недоступных продуктов пропускаются.",
        "description": "#26638 Снимки Design по ID - главные кадры модулей и компонентов для окон и тултипов. Снимки недоступных продуктов пропускаются.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `product:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /design/list`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface DesignListBody {\n  IDs: Array<string>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignListResponse = IServerResponse<DesignMap>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<DesignMap>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/DesignMap"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignListResponse = IServerResponse<DesignMap>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/list?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/list', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<DesignMap>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DesignListBody"
              },
              "example": {
                "IDs": [
                  "00000000-0000-4000-8000-000000000001"
                ]
              }
            }
          }
        }
      }
    },
    "/design/preview": {
      "post": {
        "operationId": "design_preview",
        "summary": "🔒 Отрендерить превью ноды Figma и сохранить его файлом для вложения в сообщение чата. Строку Design не создаёт.",
        "description": "Отрендерить превью ноды Figma и сохранить его файлом для вложения в сообщение чата. Строку Design не создаёт.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `chat:message` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /design/preview`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface DesignPreviewBody {\n  src: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignPreviewResponse = IServerResponse<Resp_design_preview>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_design_preview>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_design_preview"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "FID": "string",
                    "name": "string",
                    "type": "string",
                    "size": 0,
                    "width": 0,
                    "height": 0,
                    "nodeUrl": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:message required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:message required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Figma node was not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Figma node was not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Figma integration is not connected, node-id is missing, the layer is hidden, or the company Figma account cannot access the file",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Figma integration is not connected, node-id is missing, the layer is hidden, or the company Figma account cannot access the file",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignPreviewResponse = IServerResponse<Resp_design_preview>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/preview?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/preview', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_design_preview>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DesignPreviewBody"
              },
              "example": {
                "src": "string"
              }
            }
          }
        }
      }
    },
    "/design/reload": {
      "post": {
        "operationId": "design_reload",
        "summary": "🔒 Обновить снимок Design из источника. Для type=figma качает заново, если файл на стороне Figma изменился с прошлого импорта.",
        "description": "Обновить снимок Design из источника. Для type=figma качает заново, если файл на стороне Figma изменился с прошлого импорта.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `task:update`, `feature:update`, `version:update`, `product:update`, `product:structure` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /design/reload`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface DesignReloadBody {\n  designID: string\n  runID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type DesignReloadResponse = IServerResponse<Resp_design_reload>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Design"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_design_reload>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_design_reload"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "productID": "00000000-0000-4000-8000-000000000001",
                    "type": null,
                    "title": "string",
                    "version": "string",
                    "lastModified": "string",
                    "status": null,
                    "snapshotFID": "00000000-0000-4000-8000-000000000001",
                    "contextFID": "00000000-0000-4000-8000-000000000001",
                    "assetsFID": "00000000-0000-4000-8000-000000000001",
                    "snapshotSize": 0,
                    "contextSize": 0,
                    "assetsSize": 0,
                    "width": 0,
                    "height": 0,
                    "integrationID": "00000000-0000-4000-8000-000000000001",
                    "fileKey": "string",
                    "pageID": "string",
                    "pageName": "string",
                    "nodeID": "string",
                    "nodeType": "string",
                    "nodeUrl": "string",
                    "nodeName": "string",
                    "createdUID": "00000000-0000-4000-8000-000000000001",
                    "createdTS": 0,
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege to update an entity of the design required (task:update, feature:update, version:update, product:update, product:structure)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege to update an entity of the design required (task:update, feature:update, version:update, product:update, product:structure)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Design was not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Design was not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Design is not a Figma snapshot or Figma integration cannot access the file",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Design is not a Figma snapshot or Figma integration cannot access the file",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: DesignReloadResponse = IServerResponse<Resp_design_reload>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/design/reload?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'design/reload', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_design_reload>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DesignReloadBody"
              },
              "example": {
                "designID": "00000000-0000-4000-8000-000000000001",
                "runID": "string"
              }
            }
          }
        }
      }
    },
    "/currency/convert": {
      "get": {
        "operationId": "currency_convert",
        "summary": "🔒 #26723 Конвертация суммы между RUB, USD, EUR и CNY по курсу ЦБ РФ на дату (по умолчанию - сегодня по часовому поясу компании). Курсы дня хранятся у нас; дня нет - загружается из ЦБ. На выходной и праздник - курс последнего рабочего дня.",
        "description": "#26723 Конвертация суммы между RUB, USD, EUR и CNY по курсу ЦБ РФ на дату (по умолчанию - сегодня по часовому поясу компании). Курсы дня хранятся у нас; дня нет - загружается из ЦБ. На выходной и праздник - курс последнего рабочего дня.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** не требуются — shared reference data: CBR exchange rates are the same for all companies\n\n### TypeScript (copy-paste)\n\n**`GET /currency/convert`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CurrencyConvertParams {\n  amount: number\n  from: Currency_Code\n  to: Currency_Code\n  date?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CurrencyConvertResponse = IServerResponse<CurrencyService_ConvertResult>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Currency"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "description": "Можно передать header `amount` (сервер мержит headers+query)",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Можно передать header `from` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/Currency_Code"
            },
            "example": "RUB"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Можно передать header `to` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/Currency_Code"
            },
            "example": "RUB"
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Можно передать header `date` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<CurrencyService_ConvertResult>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/CurrencyService_ConvertResult"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: CBR has no rates for the date (reason noRates)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: CBR has no rates for the date (reason noRates)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Date is not YYYY-MM-DD or later than tomorrow - CBR has not set the rate yet (reason future)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Date is not YYYY-MM-DD or later than tomorrow - CBR has not set the rate yet (reason future)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "500": {
            "description": "ExternalRequest: CBR is unavailable or did not answer in 5 s (reason cbrUnavailable)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 500,
                  "data": {
                    "err": "ExternalRequest: CBR is unavailable or did not answer in 5 s (reason cbrUnavailable)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CurrencyConvertResponse = IServerResponse<CurrencyService_ConvertResult>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/currency/convert?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'currency/convert', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<CurrencyService_ConvertResult>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/costs/entity": {
      "get": {
        "operationId": "costs_entity",
        "summary": "🔒 #26564 Затраты по сущности для вкладки «Затраты»: время, оклад и премия по сотрудникам, ролям, задачам и итерациям, коррекции. #26659 По привилегии *:costs сущности; оклад и премия строки раздельно - при user:employment к её сотруднику, коррекции - при user:employment «вся компания». #26673 Оклад и премия ворклогов - с маржой (свои тоже) или без маржи на весь отчёт: margin не передан - без маржи, если сущность покрыта привилегией worklog:no-margin, true - с маржой, false - без маржи (не покрыта - 403); применённый режим - поле margin. Коррекции - без маржи. #26808 Коррекции с процентом входят в стоимость (correction строк, ворклогов и итога, с маржой суммы) - тоже только при user:employment «вся компания»: без неё стоимость - оклад и премия; автокоррекции правки ворклога (без автора и процента) - только в списке.",
        "description": "#26564 Затраты по сущности для вкладки «Затраты»: время, оклад и премия по сотрудникам, ролям, задачам и итерациям, коррекции. #26659 По привилегии *:costs сущности; оклад и премия строки раздельно - при user:employment к её сотруднику, коррекции - при user:employment «вся компания». #26673 Оклад и премия ворклогов - с маржой (свои тоже) или без маржи на весь отчёт: margin не передан - без маржи, если сущность покрыта привилегией worklog:no-margin, true - с маржой, false - без маржи (не покрыта - 403); применённый режим - поле margin. Коррекции - без маржи. #26808 Коррекции с процентом входят в стоимость (correction строк, ворклогов и итога, с маржой суммы) - тоже только при user:employment «вся компания»: без неё стоимость - оклад и премия; автокоррекции правки ворклога (без автора и процента) - только в списке.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `task:costs`, `feature:costs`, `version:costs`, `product:costs`, `meeting:costs`, `user:employment`, `worklog:no-margin` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /costs/entity`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CostsEntityParams {\n  entityType: costs_entity_entityType\n  entityID: string\n  iterationKey?: number | null\n  margin?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CostsEntityResponse = IServerResponse<Resp_costs_entity>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Costs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "entityType",
            "in": "query",
            "required": true,
            "description": "Можно передать header `entityType` (сервер мержит headers+query)",
            "schema": {
              "$ref": "#/components/schemas/costs_entity_entityType"
            },
            "example": "task"
          },
          {
            "name": "entityID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `entityID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "iterationKey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `iterationKey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          },
          {
            "name": "margin",
            "in": "query",
            "required": false,
            "description": "Можно передать header `margin` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_costs_entity>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_costs_entity"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "margin": false,
                    "iterations": [
                      0
                    ],
                    "totals": {
                      "time": 0,
                      "salary": 0,
                      "award": 0,
                      "correction": 0,
                      "cost": 0
                    },
                    "rows": [
                      null
                    ],
                    "corrections": [
                      {
                        "cID": null,
                        "ID": null,
                        "userID": null,
                        "monthDK": null,
                        "type": null,
                        "amount": null,
                        "title": null,
                        "note": null,
                        "paymentID": null,
                        "percent": null,
                        "base": null,
                        "resource": null,
                        "createdDT": null,
                        "createdUID": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "worklogs": [
                      null
                    ],
                    "titles": {}
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege *:costs of the entity required; margin=false requires privilege worklog:no-margin to the entity (privilegeRequired)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege *:costs of the entity required; margin=false requires privilege worklog:no-margin to the entity (privilegeRequired)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Entity not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CostsEntityResponse = IServerResponse<Resp_costs_entity>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/costs/entity?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'costs/entity', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_costs_entity>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/costs/user-corrections": {
      "get": {
        "operationId": "costs_user-corrections",
        "summary": "🔒 #26564 Коррекции премии сотрудника за диапазон дней (итерацию): по дням, диапазонам и ворклогам диапазона. Для списка в персональной выработке.",
        "description": "#26564 Коррекции премии сотрудника за диапазон дней (итерацию): по дням, диапазонам и ворклогам диапазона. Для списка в персональной выработке.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:payments`, `user:bonus` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /costs/user-corrections`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CostsUserCorrectionsParams {\n  userID: string\n  /** Day key (YYYYMMDD or internal day index) */\n  startDk: number\n  /** Day key (YYYYMMDD or internal day index) */\n  endDk: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CostsUserCorrectionsResponse = IServerResponse<Resp_costs_user-corrections>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Costs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "startDk",
            "in": "query",
            "required": true,
            "description": "Можно передать header `startDk` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          },
          {
            "name": "endDk",
            "in": "query",
            "required": true,
            "description": "Можно передать header `endDk` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Day key (YYYYMMDD or internal day index)"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_costs_user-corrections>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_costs_user-corrections"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "corrections": [
                      {
                        "cID": null,
                        "ID": null,
                        "userID": null,
                        "monthDK": null,
                        "type": null,
                        "amount": null,
                        "title": null,
                        "note": null,
                        "paymentID": null,
                        "percent": null,
                        "base": null,
                        "resource": null,
                        "createdDT": null,
                        "createdUID": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Only administrator or the employee sees corrections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Only administrator or the employee sees corrections",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CostsUserCorrectionsResponse = IServerResponse<Resp_costs_user-corrections>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/costs/user-corrections?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'costs/user-corrections', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_costs_user-corrections>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/organization/create": {
      "post": {
        "operationId": "company_organization_create",
        "summary": "🔒 #26565 Создание юр. лица компании. Первое юр. лицо забирает документы компании.",
        "description": "#26565 Создание юр. лица компании. Первое юр. лицо забирает документы компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:organizations` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/organization/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CompanyOrganizationCreateBody {\n  ID?: string | null\n  type: Company_OrganizationType\n  title: string\n  fullTitle: string\n  inn: string\n  kpp?: string | null\n  ogrn: string\n  urAddress: string\n  factAddress?: string | null\n  nds?: number | null\n  head: {\n  fullName: string\n  position?: string | null\n}\n  bank?: {\n  bic: string\n  title: string\n  corrAccount: string\n  account: string\n} | null\n  accountantEmails: Array<string>\n  docs?: {\n  INN?: string | null\n  requisites?: string | null\n  other1?: string | null\n  other2?: string | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyOrganizationCreateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid requisites",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid requisites",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:organizations required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:organizations required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Organization with same ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Organization with same ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyOrganizationCreateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/organization/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/organization/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyOrganizationCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "type": "ooo",
                "title": "string",
                "fullTitle": "string",
                "inn": "string",
                "kpp": "string",
                "ogrn": "string",
                "urAddress": "string",
                "factAddress": "string",
                "nds": 0,
                "head": {
                  "fullName": "string",
                  "position": "string"
                },
                "bank": {
                  "bic": "string",
                  "title": "string",
                  "corrAccount": "string",
                  "account": "string"
                },
                "accountantEmails": [
                  "user@example.com"
                ],
                "docs": {
                  "INN": "00000000-0000-4000-8000-000000000001",
                  "requisites": "00000000-0000-4000-8000-000000000001",
                  "other1": "00000000-0000-4000-8000-000000000001",
                  "other2": "00000000-0000-4000-8000-000000000001"
                }
              }
            }
          }
        }
      }
    },
    "/company/organization/delete": {
      "post": {
        "operationId": "company_organization_delete",
        "summary": "🔒 #26565 Удаление юр. лица компании. Одно из нескольких юр. лиц, к которому привязаны сотрудники, удалить нельзя. #26950 Единственное юр. лицо удаляется всегда: все сотрудники «ТК РФ» переходят в «Без оформления», у всех сотрудников юр. лицо снимается.",
        "description": "#26565 Удаление юр. лица компании. Одно из нескольких юр. лиц, к которому привязаны сотрудники, удалить нельзя. #26950 Единственное юр. лицо удаляется всегда: все сотрудники «ТК РФ» переходят в «Без оформления», у всех сотрудников юр. лицо снимается.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:organizations` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/organization/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyOrganizationDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyOrganizationDeleteResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:organizations required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:organizations required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Organization not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Organization not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Organization has employees (one of several organizations)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Organization has employees (one of several organizations)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyOrganizationDeleteResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/organization/delete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/organization/delete', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/organization/update": {
      "post": {
        "operationId": "company_organization_update",
        "summary": "🔒 #26565 Изменение юр. лица компании.",
        "description": "#26565 Изменение юр. лица компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:organizations` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/organization/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyOrganizationUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\nexport interface CompanyOrganizationUpdateBody {\n  type?: Company_OrganizationType\n  title?: string\n  fullTitle?: string\n  inn?: string\n  kpp?: string | null\n  ogrn?: string\n  urAddress?: string\n  factAddress?: string | null\n  nds?: number | null\n  head?: {\n  fullName: string\n  position?: string | null\n}\n  bank?: {\n  bic: string\n  title: string\n  corrAccount: string\n  account: string\n} | null\n  accountantEmails?: Array<string>\n  docs?: {\n  INN?: string | null\n  requisites?: string | null\n  other1?: string | null\n  other2?: string | null\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyOrganizationUpdateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid requisites",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid requisites",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:organizations required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:organizations required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Organization not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Organization not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyOrganizationUpdateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/organization/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/organization/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyOrganizationUpdateBody"
              },
              "example": {
                "type": "ooo",
                "title": "string",
                "fullTitle": "string",
                "inn": "string",
                "kpp": "string",
                "ogrn": "string",
                "urAddress": "string",
                "factAddress": "string",
                "nds": 0,
                "head": {
                  "fullName": "string",
                  "position": "string"
                },
                "bank": {
                  "bic": "string",
                  "title": "string",
                  "corrAccount": "string",
                  "account": "string"
                },
                "accountantEmails": [
                  "user@example.com"
                ],
                "docs": {
                  "INN": "00000000-0000-4000-8000-000000000001",
                  "requisites": "00000000-0000-4000-8000-000000000001",
                  "other1": "00000000-0000-4000-8000-000000000001",
                  "other2": "00000000-0000-4000-8000-000000000001"
                }
              }
            }
          }
        }
      }
    },
    "/company/control/update": {
      "post": {
        "operationId": "company_control_update",
        "summary": "🔒 Обновление настроек контроля и условий найма сотрудника в компании.",
        "description": "Обновление настроек контроля и условий найма сотрудника в компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:employment` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/control/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyControlUpdateParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type CompanyControlUpdateBody = Partial<UserDto>\n\nexport interface CompanyControlUpdateBodyFields {\n  ID?: string\n  cID?: string\n  userID?: string\n  accessType?: AccessType\n  status?: string\n  statusDT?: string\n  statusUID?: string\n  hasActiveRole?: boolean | null\n  allProductAccess?: boolean | null\n  /** Day key (YYYYMMDD or internal day index) */\n  rolesStartDK?: number | null\n  employment?: Record<string, any> | null\n  isOwner?: boolean\n  note?: Record<string, any> | null\n  params?: Record<string, any> | null\n  productAccess?: Record<string, any> | null\n  marginPercent?: number | null\n  roles?: Array<any> | null\n  department?: Record<string, any> | null\n  allowsSchemes?: Record<string, any> | null\n  allows?: Record<string, any> | null\n  /** Unix timestamp in milliseconds */\n  allowsTS?: number | null\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyControlUpdateResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:employment (common) required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:employment (common) required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user does not have access record for current company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user does not have access record for current company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyControlUpdateResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/control/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/control/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyControlUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "userID": "00000000-0000-4000-8000-000000000001",
                "accessType": 0,
                "status": "string",
                "statusDT": "2026-01-15T12:00:00.000Z",
                "statusUID": "string",
                "hasActiveRole": false,
                "allProductAccess": false,
                "rolesStartDK": 0,
                "employment": {},
                "isOwner": false,
                "note": {},
                "params": {},
                "productAccess": {},
                "marginPercent": 0,
                "roles": [
                  {}
                ],
                "department": {},
                "allowsSchemes": {},
                "allows": {},
                "allowsTS": 0,
                "updTS": 0,
                "updUID": "string"
              }
            }
          }
        }
      }
    },
    "/company/allows/catalog": {
      "get": {
        "operationId": "company_allows_catalog",
        "summary": "🔒 Каталог привилегий, системные наборы и стандартные схемы привилегий.",
        "description": "Каталог привилегий, системные наборы и стандартные схемы привилегий.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** не требуются — privileges catalog is needed by every signed-in user, including one without a company\n\n### TypeScript (copy-paste)\n\n**`GET /company/allows/catalog`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAllowsCatalogResponse = IServerResponse<Resp_company_allows_catalog>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_allows_catalog>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_allows_catalog"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "relations": {},
                    "catalog": {},
                    "adminOnly": [
                      {}
                    ],
                    "sets": {},
                    "schemes": [
                      {
                        "key": null,
                        "allows": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAllowsCatalogResponse = IServerResponse<Resp_company_allows_catalog>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/allows/catalog?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/allows/catalog', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_allows_catalog>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/allows/scheme-create": {
      "post": {
        "operationId": "company_allows_scheme-create",
        "summary": "🔒🛡️ Создание пользовательской схемы привилегий.",
        "description": "Создание пользовательской схемы привилегий.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /company/allows/scheme-create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CompanyAllowsSchemeCreateBody {\n  title: string\n  desc?: string | null\n  allows?: Record<string, any> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAllowsSchemeCreateResponse = IServerResponse<Privileges_Scheme>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Privileges_Scheme>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Privileges_Scheme"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Title is empty or too long, description is too long, unknown privilege or relation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Title is empty or too long, description is too long, unknown privilege or relation",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Title is taken in the company or privilege is available only to administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Title is taken in the company or privilege is available only to administrator",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAllowsSchemeCreateResponse = IServerResponse<Privileges_Scheme>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/allows/scheme-create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/allows/scheme-create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Privileges_Scheme>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyAllowsSchemeCreateBody"
              },
              "example": {
                "title": "string",
                "desc": "string",
                "allows": {}
              }
            }
          }
        }
      }
    },
    "/company/allows/scheme-delete": {
      "post": {
        "operationId": "company_allows_scheme-delete",
        "summary": "🔒🛡️ Удаление пользовательской схемы привилегий.",
        "description": "Удаление пользовательской схемы привилегий.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /company/allows/scheme-delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAllowsSchemeDeleteParams {\n  ID: string\n  replaceKey?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAllowsSchemeDeleteResponse = IServerResponse<Resp_company_allows_scheme-delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "replaceKey",
            "in": "query",
            "required": false,
            "description": "Можно передать header `replaceKey` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_allows_scheme-delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_allows_scheme-delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "userIDs": [
                      "string"
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Scheme not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Scheme not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Unknown replacement scheme or scheme replaces itself",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Unknown replacement scheme or scheme replaces itself",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAllowsSchemeDeleteResponse = IServerResponse<Resp_company_allows_scheme-delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/allows/scheme-delete?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/allows/scheme-delete', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_allows_scheme-delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/allows/scheme-update": {
      "post": {
        "operationId": "company_allows_scheme-update",
        "summary": "🔒🛡️ Изменение пользовательской схемы привилегий.",
        "description": "Изменение пользовательской схемы привилегий.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /company/allows/scheme-update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAllowsSchemeUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CompanyAllowsSchemeUpdateBody {\n  title?: string | null\n  desc?: string | null\n  allows?: Record<string, any> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAllowsSchemeUpdateResponse = IServerResponse<Privileges_Scheme>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Privileges_Scheme>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Privileges_Scheme"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Title is empty or too long, description is too long, unknown privilege or relation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Title is empty or too long, description is too long, unknown privilege or relation",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Scheme not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Scheme not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Title is taken in the company or privilege is available only to administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Title is taken in the company or privilege is available only to administrator",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAllowsSchemeUpdateResponse = IServerResponse<Privileges_Scheme>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/allows/scheme-update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/allows/scheme-update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Privileges_Scheme>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyAllowsSchemeUpdateBody"
              },
              "example": {
                "title": "string",
                "desc": "string",
                "allows": {}
              }
            }
          }
        }
      }
    },
    "/company/allows/user": {
      "get": {
        "operationId": "company_allows_user",
        "summary": "🔒🛡️ Действующие наборы и схемы привилегий пользователя с источниками.",
        "description": "Действующие наборы и схемы привилегий пользователя с источниками.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:privileges` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /company/allows/user`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAllowsUserParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAllowsUserResponse = IServerResponse<Privileges_UserSources>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Privileges_UserSources>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Privileges_UserSources"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Only own privileges are available to a non-administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Only own privileges are available to a non-administrator",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User has no access to the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User has no access to the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAllowsUserResponse = IServerResponse<Privileges_UserSources>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/allows/user?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/allows/user', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Privileges_UserSources>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/block": {
      "get": {
        "operationId": "company_access_block",
        "summary": "🔒 Заблокировать (исключить из команды) пользователя в компании.",
        "description": "Заблокировать (исключить из команды) пользователя в компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:block` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/block`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessBlockParams {\n  userID: string\n  reason?: company_access_block_reason | null\n  note?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessBlockResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "description": "Можно передать header `reason` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/company_access_block_reason"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "self"
          },
          {
            "name": "note",
            "in": "query",
            "required": false,
            "description": "Можно передать header `note` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:block required; administrator target - user:privileges (administrator only, #26969)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:block required; administrator target - user:privileges (administrator only, #26969)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user profile not found in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user profile not found in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: The last company administrator cannot be blocked or removed (params.code: lastAdministrator)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: The last company administrator cannot be blocked or removed (params.code: lastAdministrator)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessBlockResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/block?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/block', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/check-user": {
      "get": {
        "operationId": "company_access_check-user",
        "summary": "🔒 Проверка наличия пользователя и его доступа/ролей в текущей компании по телефону или email (#26890).",
        "description": "Проверка наличия пользователя и его доступа/ролей в текущей компании по телефону или email (#26890).\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:create`, `user:invite` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/check-user`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessCheckUserParams {\n  /** Phone number */\n  phone?: string | null\n  email?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessCheckUserResponse = IServerResponse<Resp_company_access_check-user>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "Можно передать header `phone` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "description": "Phone number"
            },
            "example": "string"
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Можно передать header `email` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_access_check-user>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_access_check-user"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "user": {},
                    "hasAccess": false,
                    "hasRoles": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: exactly one of phone or email is required, or the contact is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: exactly one of phone or email is required, or the contact is invalid",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:create or user:invite required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:create or user:invite required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessCheckUserResponse = IServerResponse<Resp_company_access_check-user>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/check-user?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/check-user', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_access_check-user>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/create": {
      "post": {
        "operationId": "company_access_create",
        "summary": "🔒🛡️ Добавление пользователя в компанию с созданием аккаунта, установкой ролей и условий найма.",
        "description": "Добавление пользователя в компанию с созданием аккаунта, установкой ролей и условий найма.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:create`, `user:invite`, `user:privileges`, `user:products`, `user:employment`, `user:timeoff`, `user:payments` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/access/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CompanyAccessCreateBody {\n  /** Phone number */\n  phone?: string | null\n  email?: string | null\n  user?: Record<string, any> | null\n  isAdmin?: boolean | null\n  employmentType?: Payment_employmentType | null\n  orgID?: string | null\n  marginPercent?: number | null\n  schemes?: Array<string> | null\n  roles?: Array<any> | null\n  timeOffs?: Array<any> | null\n  createPayments?: boolean | null\n  productAccess?: string | null\n  products?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessCreateResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Neither phone nor email, invalid or missing required user data (email is required for a new user) or invalid productAccess",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Neither phone nor email, invalid or missing required user data (email is required for a new user) or invalid productAccess",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege required by body fields (user:create / user:invite, user:privileges, user:products, user:employment, user:timeoff)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege required by body fields (user:create / user:invite, user:privileges, user:products, user:employment, user:timeoff)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User with specified phone number or email not found during second step, product or organization (orgID) not found in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User with specified phone number or email not found during second step, product or organization (orgID) not found in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: params.code contact_taken - email or phone of a new user belongs to another user; employment ru_tk without an organization",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: params.code contact_taken - email or phone of a new user belongs to another user; employment ru_tk without an organization",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessCreateResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyAccessCreateBody"
              },
              "example": {
                "phone": "string",
                "email": "string",
                "user": {},
                "isAdmin": false,
                "employmentType": "none",
                "orgID": "00000000-0000-4000-8000-000000000001",
                "marginPercent": 0,
                "schemes": [
                  "string"
                ],
                "roles": [
                  {}
                ],
                "timeOffs": [
                  {}
                ],
                "createPayments": true,
                "productAccess": "string",
                "products": "string"
              }
            }
          }
        }
      }
    },
    "/company/access/delete": {
      "get": {
        "operationId": "company_access_delete",
        "summary": "🔒 Полное удаление доступа пользователя к компании.",
        "description": "Полное удаление доступа пользователя к компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:block` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessDeleteParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessDeleteResponse = IServerResponse<Resp_company_access_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_access_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_access_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:block required; administrator target - user:privileges (administrator only, #26969)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:block required; administrator target - user:privileges (administrator only, #26969)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified user access record not found in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified user access record not found in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: The last company administrator cannot be blocked or removed (params.code: lastAdministrator)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: The last company administrator cannot be blocked or removed (params.code: lastAdministrator)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessDeleteResponse = IServerResponse<Resp_company_access_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_access_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/grant-admin": {
      "get": {
        "operationId": "company_access_grant-admin",
        "summary": "🔒🛡️ Предоставление прав администратора компании пользователю.",
        "description": "Предоставление прав администратора компании пользователю.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/grant-admin`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessGrantAdminParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessGrantAdminResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company access record for specified user not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company access record for specified user not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: User is already an administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: User is already an administrator",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessGrantAdminResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/grant-admin?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/grant-admin', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/grant-product": {
      "get": {
        "operationId": "company_access_grant-product",
        "summary": "🔒 Установка доступа сотрудника к продуктам: полный набор products, либо режимы all / none.",
        "description": "Установка доступа сотрудника к продуктам: полный набор products, либо режимы all / none.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:products` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/grant-product`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessGrantProductResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: products must be an array of uuid, \"none\" or \"all\"",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: products must be an array of uuid, \"none\" or \"all\"",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:products required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:products required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User access or product not found in company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User access or product not found in company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessGrantProductResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/grant-product?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/grant-product', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/revoke-admin": {
      "get": {
        "operationId": "company_access_revoke-admin",
        "summary": "🔒🛡️ Отзыв прав администратора компании у пользователя.",
        "description": "Отзыв прав администратора компании у пользователя.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/revoke-admin`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessRevokeAdminParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessRevokeAdminResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required; own administrator rights cannot be revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required; own administrator rights cannot be revoked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company access record for specified user not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company access record for specified user not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: User is already non-admin",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: User is already non-admin",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessRevokeAdminResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/revoke-admin?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/revoke-admin', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/set-margin": {
      "post": {
        "operationId": "company_access_set-margin",
        "summary": "🔒🛡️ Изменение персональной маржи пользователя.",
        "description": "Изменение персональной маржи пользователя.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /company/access/set-margin`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessSetMarginParams {\n  userID: string\n  marginPercent?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessSetMarginResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "marginPercent",
            "in": "query",
            "required": false,
            "description": "Можно передать header `marginPercent` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0,
              "maximum": 1000
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: marginPercent out of range",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: marginPercent out of range",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User has no access to the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User has no access to the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessSetMarginResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/set-margin?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/set-margin', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/access/set-privileges": {
      "post": {
        "operationId": "company_access_set-privileges",
        "summary": "🔒🛡️ Назначение схем привилегий и флага администратора пользователю.",
        "description": "Назначение схем привилегий и флага администратора пользователю.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:privileges` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /company/access/set-privileges`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessSetPrivilegesParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CompanyAccessSetPrivilegesBody {\n  isAdmin?: boolean | null\n  schemes?: Array<string> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessSetPrivilegesResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:privileges required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:privileges required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User has no access to the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User has no access to the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Unknown scheme or own administrator rights cannot be revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Unknown scheme or own administrator rights cannot be revoked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessSetPrivilegesResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/set-privileges?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/set-privileges', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyAccessSetPrivilegesBody"
              },
              "example": {
                "isAdmin": false,
                "schemes": [
                  "string"
                ]
              }
            }
          }
        }
      }
    },
    "/company/access/unblock": {
      "get": {
        "operationId": "company_access_unblock",
        "summary": "🔒 Разблокировка пользователя в компании и восстановление доступа к чатам и сервисам.",
        "description": "Разблокировка пользователя в компании и восстановление доступа к чатам и сервисам.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `user:block` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/access/unblock`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyAccessUnblockParams {\n  userID: string\n  note?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyAccessUnblockResponse = IServerResponse<UserDto>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company: Access"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "note",
            "in": "query",
            "required": false,
            "description": "Можно передать header `note` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<UserDto>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/UserDto"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:block required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:block required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company access record for user not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company access record for user not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Specified user is not currently blocked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Specified user is not currently blocked",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyAccessUnblockResponse = IServerResponse<UserDto>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/access/unblock?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/access/unblock', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<UserDto>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/archive-file": {
      "get": {
        "operationId": "company_archive-file",
        "summary": "🔒 Скачивание ZIP-архива с юридическими документами организации.",
        "description": "Скачивание ZIP-архива с юридическими документами организации.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `company:organizations` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /company/archive-file`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyArchiveFileParams {\n  ID: string\n  orgID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyArchiveFileResponse = IServerResponse<Resp_company_archive-file>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "orgID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `orgID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_archive-file>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_archive-file"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:organizations required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:organizations required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified company or organization ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified company or organization ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyArchiveFileResponse = IServerResponse<Resp_company_archive-file>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/archive-file?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/archive-file', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_archive-file>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/check-requisites": {
      "get": {
        "operationId": "company_check-requisites",
        "summary": "🔒 #26565 Реквизиты юр. лица по ИНН или банка по БИК из DaData. data = null - не найдено. Доступно и без компании - для регистрации.",
        "description": "#26565 Реквизиты юр. лица по ИНН или банка по БИК из DaData. data = null - не найдено. Доступно и без компании - для регистрации.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `company:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /company/check-requisites`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyCheckRequisitesParams {\n  inn?: string | null\n  bic?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyCheckRequisitesResponse = IServerResponse<Resp_company_check-requisites>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "inn",
            "in": "query",
            "required": false,
            "description": "Можно передать header `inn` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "minLength": 10,
              "maxLength": 12,
              "pattern": "^\\d+$"
            },
            "example": "string"
          },
          {
            "name": "bic",
            "in": "query",
            "required": false,
            "description": "Можно передать header `bic` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "minLength": 9,
              "maxLength": 9,
              "pattern": "^\\d+$"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_check-requisites>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_check-requisites"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "type": "company",
                    "data": null
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Neither INN nor BIC is passed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Neither INN nor BIC is passed",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "500": {
            "description": "Service: DaData API key is not configured: set SERVICES_DADATA_API_KEY in the stage env (app-env); ExternalRequest: DaData request failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 500,
                  "data": {
                    "err": "Service: DaData API key is not configured: set SERVICES_DADATA_API_KEY in the stage env (app-env); ExternalRequest: DaData request failed",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyCheckRequisitesResponse = IServerResponse<Resp_company_check-requisites>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/check-requisites?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/check-requisites', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_check-requisites>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/check": {
      "get": {
        "operationId": "company_check",
        "summary": "🔒 Проверка занятости наименования организации.",
        "description": "Проверка занятости наименования организации.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `company:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`GET /company/check`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyCheckParams {\n  title: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyCheckResponse = IServerResponse<Resp_company_check>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "title",
            "in": "query",
            "required": true,
            "description": "Можно передать header `title` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_check>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_check"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "title": false
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Company title parameter is missing or has invalid format",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Company title parameter is missing or has invalid format",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyCheckResponse = IServerResponse<Resp_company_check>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/check?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/check', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_check>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/control": {
      "get": {
        "operationId": "company_control",
        "summary": "🔒 Получение настроек контроля пользователя в компании.",
        "description": "Получение настроек контроля пользователя в компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:employment` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /company/control`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyControlParams {\n  userID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyControlResponse = IServerResponse<Resp_company_control>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_control>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_control"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "controlUser": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "userID": "00000000-0000-4000-8000-000000000001",
                      "accessType": null,
                      "status": "string",
                      "statusDT": "2026-01-15T12:00:00.000Z",
                      "statusUID": "string",
                      "hasActiveRole": false,
                      "allProductAccess": false,
                      "rolesStartDK": 0,
                      "employment": {},
                      "isOwner": false,
                      "note": {},
                      "params": {},
                      "productAccess": {},
                      "marginPercent": 0,
                      "roles": [
                        null
                      ],
                      "department": {},
                      "allowsSchemes": {},
                      "allows": {},
                      "allowsTS": 0,
                      "updTS": 0,
                      "updUID": "string"
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege user:employment required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege user:employment required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target user profile not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target user profile not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyControlResponse = IServerResponse<Resp_company_control>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/control?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/control', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_control>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/create": {
      "post": {
        "operationId": "company_create",
        "summary": "🔒 Создание новой организации компании.",
        "description": "Создание новой организации компании.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write` · **только веб-сессия**\n\n**Allows:** `company:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyCreateParams {\n  skipCreateContent?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type CompanyCreateBody = Partial<Resp_company_create>\n\nexport interface CompanyCreateBodyFields {\n  ID?: string\n  title?: string\n  logoFID?: string | null\n  phone?: string\n  email?: string\n  url?: string\n  description?: string\n  address?: string\n  foundationDT?: string | null\n  country?: string | null\n  defaultMarginPercent?: number | null\n  demoSet?: string | null\n  testSlot?: number | null\n  agentPrices?: Record<string, any> | null\n  docs?: {\n  INN?: string | null\n  other1?: string | null\n  other2?: string | null\n  requisites?: string | null\n} | null\n  timeZone?: string\n  language?: string | null\n  activityType?: Array<any> | null\n  activityDescription?: string | null\n  titleHash?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n  createDT?: string\n  createUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyCreateResponse = IServerResponse<Resp_company_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "skipCreateContent",
            "in": "query",
            "required": false,
            "description": "Можно передать header `skipCreateContent` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "session": null,
                    "currentUser": {},
                    "lastUpdTS": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid company title format",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid company title format",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Web session required (Bearer token)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Web session required (Bearer token)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Company title is empty, or company with same ID or title already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Company title is empty, or company with same ID or title already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyCreateResponse = IServerResponse<Resp_company_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "phone": "string",
                "email": "string",
                "url": "string",
                "description": "string",
                "address": "string",
                "foundationDT": "2026-01-15T12:00:00.000Z",
                "country": "string",
                "defaultMarginPercent": 0,
                "demoSet": "string",
                "testSlot": 0,
                "agentPrices": {},
                "docs": {
                  "INN": "00000000-0000-4000-8000-000000000001",
                  "other1": "00000000-0000-4000-8000-000000000001",
                  "other2": "00000000-0000-4000-8000-000000000001",
                  "requisites": "00000000-0000-4000-8000-000000000001"
                },
                "timeZone": "Europe/Moscow",
                "language": "string",
                "activityType": [
                  {}
                ],
                "activityDescription": "string",
                "titleHash": "string",
                "updTS": 0,
                "updUID": "string",
                "createDT": "2026-01-15T12:00:00.000Z",
                "createUID": "string"
              }
            }
          }
        }
      }
    },
    "/company/dictionary": {
      "post": {
        "operationId": "company_dictionary",
        "summary": "🔒 Обновление элементов справочника компании.",
        "description": "Обновление элементов справочника компании.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:salaries`, `company:qa-devices` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/dictionary`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyDictionaryParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CompanyDictionaryBody {\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyDictionaryResponse = IServerResponse<CompanyDictionary>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<CompanyDictionary>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/CompanyDictionary"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "accessType": 0,
                    "key": "string",
                    "items": {},
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege of the dictionary area required (rolesTemplate - company:salaries, qaDevices - company:qa-devices); other dictionaries are managed by their own commands",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege of the dictionary area required (rolesTemplate - company:salaries, qaDevices - company:qa-devices); other dictionaries are managed by their own commands",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified company dictionary with ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified company dictionary with ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Items dictionary payload is empty or invalid; QA device fields are invalid (#27002)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Items dictionary payload is empty or invalid; QA device fields are invalid (#27002)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyDictionaryResponse = IServerResponse<CompanyDictionary>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/dictionary?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/dictionary', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<CompanyDictionary>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyDictionaryBody"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/company/info": {
      "get": {
        "operationId": "company_info",
        "summary": "🔒 Получение публичной информации об организации.",
        "description": "Получение публичной информации об организации.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** не требуются — company title and logo for any signed-in user, including one without a company\n\n### TypeScript (copy-paste)\n\n**`GET /company/info`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyInfoParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyInfoResponse = IServerResponse<Company>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Company>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Company"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "phone": "string",
                    "email": "string",
                    "url": "string",
                    "description": "string",
                    "address": "string",
                    "foundationDT": "2026-01-15T12:00:00.000Z",
                    "country": "string",
                    "defaultMarginPercent": 0,
                    "demoSet": "string",
                    "testSlot": 0,
                    "agentPrices": {},
                    "docs": {
                      "INN": "00000000-0000-4000-8000-000000000001",
                      "other1": "00000000-0000-4000-8000-000000000001",
                      "other2": "00000000-0000-4000-8000-000000000001",
                      "requisites": "00000000-0000-4000-8000-000000000001"
                    },
                    "timeZone": "Europe/Moscow",
                    "language": "string",
                    "activityType": [
                      {}
                    ],
                    "activityDescription": "string",
                    "titleHash": "string",
                    "updTS": 0,
                    "updUID": "string",
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "createUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — недостаточно прав или неверная подпись",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — недостаточно прав или неверная подпись",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyInfoResponse = IServerResponse<Company>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/info?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/info', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Company>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/company/update": {
      "post": {
        "operationId": "company_update",
        "summary": "🔒🛡️ Обновление данных и настроек организации.",
        "description": "Обновление данных и настроек организации.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `company:info` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /company/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CompanyUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type CompanyUpdateBody = Partial<Company>\n\nexport interface CompanyUpdateBodyFields {\n  ID?: string\n  title?: string\n  logoFID?: string | null\n  phone?: string\n  email?: string\n  url?: string\n  description?: string\n  address?: string\n  foundationDT?: string | null\n  country?: string | null\n  defaultMarginPercent?: number | null\n  demoSet?: string | null\n  testSlot?: number | null\n  agentPrices?: Record<string, any> | null\n  docs?: {\n  INN?: string | null\n  other1?: string | null\n  other2?: string | null\n  requisites?: string | null\n} | null\n  timeZone?: string\n  language?: string | null\n  activityType?: Array<any> | null\n  activityDescription?: string | null\n  titleHash?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n  createDT?: string\n  createUID?: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyUpdateResponse = IServerResponse<Company>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Company>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Company"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "phone": "string",
                    "email": "string",
                    "url": "string",
                    "description": "string",
                    "address": "string",
                    "foundationDT": "2026-01-15T12:00:00.000Z",
                    "country": "string",
                    "defaultMarginPercent": 0,
                    "demoSet": "string",
                    "testSlot": 0,
                    "agentPrices": {},
                    "docs": {
                      "INN": "00000000-0000-4000-8000-000000000001",
                      "other1": "00000000-0000-4000-8000-000000000001",
                      "other2": "00000000-0000-4000-8000-000000000001",
                      "requisites": "00000000-0000-4000-8000-000000000001"
                    },
                    "timeZone": "Europe/Moscow",
                    "language": "string",
                    "activityType": [
                      {}
                    ],
                    "activityDescription": "string",
                    "titleHash": "string",
                    "updTS": 0,
                    "updUID": "string",
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "createUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest: Invalid company title format",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest: Invalid company title format",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege company:info required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege company:info required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Company with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Company with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Company with specified title already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Company with specified title already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyUpdateResponse = IServerResponse<Company>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Company>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "phone": "string",
                "email": "string",
                "url": "string",
                "description": "string",
                "address": "string",
                "foundationDT": "2026-01-15T12:00:00.000Z",
                "country": "string",
                "defaultMarginPercent": 0,
                "demoSet": "string",
                "testSlot": 0,
                "agentPrices": {},
                "docs": {
                  "INN": "00000000-0000-4000-8000-000000000001",
                  "other1": "00000000-0000-4000-8000-000000000001",
                  "other2": "00000000-0000-4000-8000-000000000001",
                  "requisites": "00000000-0000-4000-8000-000000000001"
                },
                "timeZone": "Europe/Moscow",
                "language": "string",
                "activityType": [
                  {}
                ],
                "activityDescription": "string",
                "titleHash": "string",
                "updTS": 0,
                "updUID": "string",
                "createDT": "2026-01-15T12:00:00.000Z",
                "createUID": "string"
              }
            }
          }
        }
      }
    },
    "/company/users-management": {
      "get": {
        "operationId": "company_users-management",
        "summary": "🔒🛡️ Получение списка сотрудников компании для управления доступом и ролями.",
        "description": "Получение списка сотрудников компании для управления доступом и ролями.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `user:privileges`, `user:create`, `user:invite`, `user:block`, `user:products`, `user:sessions` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /company/users-management`**\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CompanyUsersManagementResponse = IServerResponse<Resp_company_users-management>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Company"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_company_users-management>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_company_users-management"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {
                        "ID": null
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege of the section required (user:privileges, user:create, user:invite, user:block, user:products)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege of the section required (user:privileges, user:create, user:invite, user:block, user:products)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CompanyUsersManagementResponse = IServerResponse<Resp_company_users-management>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/company/users-management?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'company/users-management', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_company_users-management>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/ci/current-task": {
      "get": {
        "operationId": "ci_current-task",
        "summary": "🔓 Получение текущей активной задачи пользователя по его email (для интеграции с утилитами CI/CD).",
        "description": "Получение текущей активной задачи пользователя по его email (для интеграции с утилитами CI/CD).\n\n**Access:** `unauthorized` (0 ) · **Scope:** `read`\n\n### TypeScript (copy-paste)\n\n**`GET /ci/current-task`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CiCurrentTaskParams {\n  email: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CiCurrentTaskResponse = IServerResponse<Resp_ci_current-task>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "CI/CD Utilities"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "email",
            "in": "query",
            "required": true,
            "description": "Можно передать header `email` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "email"
            },
            "example": "user@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_ci_current-task>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_ci_current-task"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "type": 0,
                    "category": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize: CI token required - header X-CI-Token missing or wrong, or CI_TOKEN is not set on the stage (params are validated first: invalid params - 400)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize: CI token required - header X-CI-Token missing or wrong, or CI_TOKEN is not set on the stage (params are validated first: invalid params - 400)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CiCurrentTaskResponse = IServerResponse<Resp_ci_current-task>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/ci/current-task?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_ci_current-task>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ]
      }
    },
    "/ci/deployed": {
      "post": {
        "operationId": "ci_deployed",
        "summary": "🔓 Системный эндпоинт CI/CD для перевода статуса задач после деплоя.",
        "description": "Системный эндпоинт CI/CD для перевода статуса задач после деплоя.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `write`\n\n### TypeScript (copy-paste)\n\n**`POST /ci/deployed`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CiDeployedParams {\n  cID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CiDeployedBody {\n  issues: Array<any>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CiDeployedResponse = IServerResponse<Resp_ci_deployed>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "CI/CD Utilities"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "cID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `cID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_ci_deployed>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_ci_deployed"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deployed": [
                      {
                        "ID": "00000000-0000-4000-8000-000000000001",
                        "key": {},
                        "title": "string",
                        "type": 0,
                        "category": 0
                      }
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize: CI token required - header X-CI-Token missing or wrong, or CI_TOKEN is not set on the stage (params are validated first: invalid params - 400)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize: CI token required - header X-CI-Token missing or wrong, or CI_TOKEN is not set on the stage (params are validated first: invalid params - 400)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target company with specified cID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target company with specified cID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CiDeployedResponse = IServerResponse<Resp_ci_deployed>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/ci/deployed?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_ci_deployed>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CiDeployedBody"
              },
              "example": {
                "issues": [
                  {}
                ]
              }
            }
          }
        }
      }
    },
    "/ci/resolve": {
      "post": {
        "operationId": "ci_resolve",
        "summary": "🔓 Системный эндпоинт CI/CD для получения информации по решаемым задачам, багам и модулям.",
        "description": "Системный эндпоинт CI/CD для получения информации по решаемым задачам, багам и модулям.\n\n**Access:** `unauthorized` (0 ) · **Scope:** `read`\n\n### TypeScript (copy-paste)\n\n**`POST /ci/resolve`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface CiResolveParams {\n  cID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface CiResolveBody {\n  issues: Array<any>\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type CiResolveResponse = IServerResponse<Resp_ci_resolve>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "CI/CD Utilities"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "cID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `cID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_ci_resolve>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_ci_resolve"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "bugs": [
                      null
                    ],
                    "tasks": [
                      null
                    ],
                    "components": [
                      "string"
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize: CI token required - header X-CI-Token missing or wrong, or CI_TOKEN is not set on the stage (params are validated first: invalid params - 400)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize: CI token required - header X-CI-Token missing or wrong, or CI_TOKEN is not set on the stage (params are validated first: invalid params - 400)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: CiResolveResponse = IServerResponse<Resp_ci_resolve>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/ci/resolve?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_ci_resolve>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// unauthorized — sid/rts/sig не нужны"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CiResolveBody"
              },
              "example": {
                "issues": [
                  {}
                ]
              }
            }
          }
        }
      }
    },
    "/chat/message/create": {
      "post": {
        "operationId": "chat_message_create",
        "summary": "🔒 Отправка нового сообщения в чат.",
        "description": "Отправка нового сообщения в чат.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:message` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /chat/message/create`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatMessageCreateParams {\n  chatID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ChatMessageCreateBody = Partial<ChatMessage>\n\nexport interface ChatMessageCreateBodyFields {\n  ID?: string\n  dt?: string\n  text?: string\n  attachments?: Array<any> | null\n  replied?: {\n  ID: string\n  text: string\n  authorUID: string\n  attachmentFID?: string | null\n  attachmentCount?: number | null\n} | null\n  mentioned?: Record<string, any> | null\n  forwarded?: {\n  chatID: string\n  messageID: string\n} | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatMessageCreateResponse = IServerResponse<ChatMessage>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat: Messages"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<ChatMessage>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChatMessage"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "chatID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "authorUID": "00000000-0000-4000-8000-000000000001",
                    "authorType": "user",
                    "type": "regular",
                    "text": "string",
                    "attachments": [
                      {}
                    ],
                    "dayKey": 0,
                    "dt": "2026-01-15T12:00:00.000Z",
                    "editedDT": "2026-01-15T12:00:00.000Z",
                    "replied": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "text": "string",
                      "authorUID": "00000000-0000-4000-8000-000000000001",
                      "attachmentFID": "00000000-0000-4000-8000-000000000001",
                      "attachmentCount": 0
                    },
                    "mentioned": {},
                    "reactions": {},
                    "viewed": {},
                    "meta": {
                      "apiTokenID": "00000000-0000-4000-8000-000000000001",
                      "event": {
                        "type": null,
                        "newTitle": "string",
                        "targetUID": "00000000-0000-4000-8000-000000000001"
                      },
                      "forwarded": {
                        "chatID": "00000000-0000-4000-8000-000000000001",
                        "messageID": "00000000-0000-4000-8000-000000000001",
                        "chatTitle": "string",
                        "chatLogoUrl": "string",
                        "authorUID": "00000000-0000-4000-8000-000000000001",
                        "dt": "2026-01-15T12:00:00.000Z",
                        "entType": null,
                        "productID": "00000000-0000-4000-8000-000000000001"
                      }
                    },
                    "isDeleted": false,
                    "deletedTS": 0,
                    "deletedUID": "00000000-0000-4000-8000-000000000001",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:message required (chat:read for the forwarded source)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:message required (chat:read for the forwarded source)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Specified chat ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Specified chat ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Chat message with specified ID already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Chat message with specified ID already exists",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatMessageCreateResponse = IServerResponse<ChatMessage>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/message/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/message/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<ChatMessage>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatMessageCreateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "dt": "2026-01-15T12:00:00.000Z",
                "text": "string",
                "attachments": [
                  {}
                ],
                "replied": {
                  "ID": "00000000-0000-4000-8000-000000000001",
                  "text": "string",
                  "authorUID": "00000000-0000-4000-8000-000000000001",
                  "attachmentFID": "00000000-0000-4000-8000-000000000001",
                  "attachmentCount": 0
                },
                "mentioned": {},
                "forwarded": {
                  "chatID": "00000000-0000-4000-8000-000000000001",
                  "messageID": "00000000-0000-4000-8000-000000000001"
                }
              }
            }
          }
        }
      }
    },
    "/chat/message/delete": {
      "get": {
        "operationId": "chat_message_delete",
        "summary": "🔒 Удаление сообщения из чата автором или администратором.",
        "description": "Удаление сообщения из чата автором или администратором.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:message-delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/message/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatMessageDeleteParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatMessageDeleteResponse = IServerResponse<ChatMessage>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat: Messages"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<ChatMessage>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChatMessage"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "chatID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "authorUID": "00000000-0000-4000-8000-000000000001",
                    "authorType": "user",
                    "type": "regular",
                    "text": "string",
                    "attachments": [
                      {}
                    ],
                    "dayKey": 0,
                    "dt": "2026-01-15T12:00:00.000Z",
                    "editedDT": "2026-01-15T12:00:00.000Z",
                    "replied": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "text": "string",
                      "authorUID": "00000000-0000-4000-8000-000000000001",
                      "attachmentFID": "00000000-0000-4000-8000-000000000001",
                      "attachmentCount": 0
                    },
                    "mentioned": {},
                    "reactions": {},
                    "viewed": {},
                    "meta": {
                      "apiTokenID": "00000000-0000-4000-8000-000000000001",
                      "event": {
                        "type": null,
                        "newTitle": "string",
                        "targetUID": "00000000-0000-4000-8000-000000000001"
                      },
                      "forwarded": {
                        "chatID": "00000000-0000-4000-8000-000000000001",
                        "messageID": "00000000-0000-4000-8000-000000000001",
                        "chatTitle": "string",
                        "chatLogoUrl": "string",
                        "authorUID": "00000000-0000-4000-8000-000000000001",
                        "dt": "2026-01-15T12:00:00.000Z",
                        "entType": null,
                        "productID": "00000000-0000-4000-8000-000000000001"
                      }
                    },
                    "isDeleted": false,
                    "deletedTS": 0,
                    "deletedUID": "00000000-0000-4000-8000-000000000001",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:message-delete required (author or chat administrator)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:message-delete required (author or chat administrator)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Chat message with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Chat message with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Non-admin user cannot delete messages older than 60 minutes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Non-admin user cannot delete messages older than 60 minutes",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatMessageDeleteResponse = IServerResponse<ChatMessage>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/message/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/message/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<ChatMessage>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/message/reaction": {
      "get": {
        "operationId": "chat_message_reaction",
        "summary": "🔒 Добавление, удаление или замена эмодзи-реакции на сообщении в чате.",
        "description": "Добавление, удаление или замена эмодзи-реакции на сообщении в чате.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:reaction` (все обязательны; ресурс — `ID (message)`)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/message/reaction`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatMessageReactionParams {\n  ID: string\n  reaction: string\n  dt?: string | null\n  replace?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatMessageReactionResponse = IServerResponse<ChatMessage>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat: Messages"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "reaction",
            "in": "query",
            "required": true,
            "description": "Можно передать header `reaction` (сервер мержит headers+query)",
            "schema": {
              "type": "string"
            },
            "example": "string"
          },
          {
            "name": "dt",
            "in": "query",
            "required": false,
            "description": "Можно передать header `dt` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "replace",
            "in": "query",
            "required": false,
            "description": "Можно передать header `replace` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<ChatMessage>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChatMessage"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "chatID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "authorUID": "00000000-0000-4000-8000-000000000001",
                    "authorType": "user",
                    "type": "regular",
                    "text": "string",
                    "attachments": [
                      {}
                    ],
                    "dayKey": 0,
                    "dt": "2026-01-15T12:00:00.000Z",
                    "editedDT": "2026-01-15T12:00:00.000Z",
                    "replied": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "text": "string",
                      "authorUID": "00000000-0000-4000-8000-000000000001",
                      "attachmentFID": "00000000-0000-4000-8000-000000000001",
                      "attachmentCount": 0
                    },
                    "mentioned": {},
                    "reactions": {},
                    "viewed": {},
                    "meta": {
                      "apiTokenID": "00000000-0000-4000-8000-000000000001",
                      "event": {
                        "type": null,
                        "newTitle": "string",
                        "targetUID": "00000000-0000-4000-8000-000000000001"
                      },
                      "forwarded": {
                        "chatID": "00000000-0000-4000-8000-000000000001",
                        "messageID": "00000000-0000-4000-8000-000000000001",
                        "chatTitle": "string",
                        "chatLogoUrl": "string",
                        "authorUID": "00000000-0000-4000-8000-000000000001",
                        "dt": "2026-01-15T12:00:00.000Z",
                        "entType": null,
                        "productID": "00000000-0000-4000-8000-000000000001"
                      }
                    },
                    "isDeleted": false,
                    "deletedTS": 0,
                    "deletedUID": "00000000-0000-4000-8000-000000000001",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:reaction required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:reaction required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Chat message with specified ID does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Chat message with specified ID does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatMessageReactionResponse = IServerResponse<ChatMessage>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/message/reaction?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/message/reaction', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<ChatMessage>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/message/update": {
      "post": {
        "operationId": "chat_message_update",
        "summary": "🔒 Редактирование текста или вложений сообщения в чате.",
        "description": "Редактирование текста или вложений сообщения в чате.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:message-update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /chat/message/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatMessageUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ChatMessageUpdateBody = Partial<ChatMessage>\n\nexport interface ChatMessageUpdateBodyFields {\n  text?: string\n  attachments?: Array<any> | null\n  mentioned?: Record<string, any> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatMessageUpdateResponse = IServerResponse<ChatMessage>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat: Messages"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<ChatMessage>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChatMessage"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "chatID": "00000000-0000-4000-8000-000000000001",
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "authorUID": "00000000-0000-4000-8000-000000000001",
                    "authorType": "user",
                    "type": "regular",
                    "text": "string",
                    "attachments": [
                      {}
                    ],
                    "dayKey": 0,
                    "dt": "2026-01-15T12:00:00.000Z",
                    "editedDT": "2026-01-15T12:00:00.000Z",
                    "replied": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "text": "string",
                      "authorUID": "00000000-0000-4000-8000-000000000001",
                      "attachmentFID": "00000000-0000-4000-8000-000000000001",
                      "attachmentCount": 0
                    },
                    "mentioned": {},
                    "reactions": {},
                    "viewed": {},
                    "meta": {
                      "apiTokenID": "00000000-0000-4000-8000-000000000001",
                      "event": {
                        "type": null,
                        "newTitle": "string",
                        "targetUID": "00000000-0000-4000-8000-000000000001"
                      },
                      "forwarded": {
                        "chatID": "00000000-0000-4000-8000-000000000001",
                        "messageID": "00000000-0000-4000-8000-000000000001",
                        "chatTitle": "string",
                        "chatLogoUrl": "string",
                        "authorUID": "00000000-0000-4000-8000-000000000001",
                        "dt": "2026-01-15T12:00:00.000Z",
                        "entType": null,
                        "productID": "00000000-0000-4000-8000-000000000001"
                      }
                    },
                    "isDeleted": false,
                    "deletedTS": 0,
                    "deletedUID": "00000000-0000-4000-8000-000000000001",
                    "updTS": 0,
                    "updUID": "string"
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:message-update required (author), or deleted message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:message-update required (author), or deleted message",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Chat message or parent chat does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Chat message or parent chat does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: System, template or forwarded message, editing expired (after 60 minutes) or empty patch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: System, template or forwarded message, editing expired (after 60 minutes) or empty patch",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatMessageUpdateResponse = IServerResponse<ChatMessage>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/message/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/message/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<ChatMessage>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatMessageUpdateBody"
              },
              "example": {
                "text": "string",
                "attachments": [
                  {}
                ],
                "mentioned": {}
              }
            }
          }
        }
      }
    },
    "/chat/message/viewed": {
      "post": {
        "operationId": "chat_message_viewed",
        "summary": "🔒 Пакетная отметка сообщений чата как просмотренных текущим пользователем.",
        "description": "Пакетная отметка сообщений чата как просмотренных текущим пользователем.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /chat/message/viewed`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ChatMessageViewedBody {\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatMessageViewedResponse = IServerResponse<Resp_chat_message_viewed>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat: Messages"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_message_viewed>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_message_viewed"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: User is not a member of the chat",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: User is not a member of the chat",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Empty body, missing datetime, or unknown message IDs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Empty body, missing datetime, or unknown message IDs",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatMessageViewedResponse = IServerResponse<Resp_chat_message_viewed>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/message/viewed?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/message/viewed', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_message_viewed>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatMessageViewedBody"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/chat/admin": {
      "get": {
        "operationId": "chat_admin",
        "summary": "🔒 Назначение или отзыв прав администратора чата у участника.",
        "description": "Назначение или отзыв прав администратора чата у участника.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:admin` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/admin`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatAdminParams {\n  chatID: string\n  userID: string\n  isAdmin: boolean\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatAdminResponse = IServerResponse<Resp_chat_admin>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "userID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "isAdmin",
            "in": "query",
            "required": true,
            "description": "Можно передать header `isAdmin` (сервер мержит headers+query)",
            "schema": {
              "type": "boolean"
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_admin>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_admin"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": 0,
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:admin required (chat administrator)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:admin required (chat administrator)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target chat or user membership record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target chat or user membership record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatAdminResponse = IServerResponse<Resp_chat_admin>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/admin?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/admin', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_admin>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/create": {
      "post": {
        "operationId": "chat_create",
        "summary": "🔒 Создание нового диалога или группы чата.",
        "description": "Создание нового диалога или группы чата.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:create` (все обязательны; без ресурса)\n\n### TypeScript (copy-paste)\n\n**`POST /chat/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface ChatCreateBody {\n  chatFields: {\n  type: Chat_Type\n  logoFID?: string | null\n  title?: string | null\n}\n  memberUserIDs?: Array<string> | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatCreateResponse = IServerResponse<Resp_chat_create>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_create>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_create"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "chat": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "type": null,
                      "logoFID": "00000000-0000-4000-8000-000000000001",
                      "title": "string",
                      "meta": {},
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "updTS": 0,
                      "updUID": "string",
                      "isDeleted": false,
                      "deletedTS": 0
                    },
                    "member": {
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "chatID": "00000000-0000-4000-8000-000000000001",
                      "userID": "00000000-0000-4000-8000-000000000001",
                      "isMute": false,
                      "isAdmin": false,
                      "openedTS": 0,
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "updTS": 0,
                      "updUID": "string",
                      "isDeleted": false,
                      "deletedTS": 0
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:create required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:create required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid chat properties or members payload, or chat type other than direct and private",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid chat properties or members payload, or chat type other than direct and private",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatCreateResponse = IServerResponse<Resp_chat_create>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_create>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCreateBody"
              },
              "example": {
                "chatFields": {
                  "type": "public",
                  "logoFID": "00000000-0000-4000-8000-000000000001",
                  "title": "string"
                },
                "memberUserIDs": [
                  "00000000-0000-4000-8000-000000000001"
                ]
              }
            }
          }
        }
      }
    },
    "/chat/delete": {
      "get": {
        "operationId": "chat_delete",
        "summary": "🔒 Полное удаление чата для всех участников.",
        "description": "Полное удаление чата для всех участников.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:delete` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatDeleteParams {\n  chatID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatDeleteResponse = IServerResponse<Resp_chat_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": 0,
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Company/department system chats cannot be deleted, or privilege chat:delete required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Company/department system chats cannot be deleted, or privilege chat:delete required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Chat with specified ID does not exist or user is not a participant",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Chat with specified ID does not exist or user is not a participant",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatDeleteResponse = IServerResponse<Resp_chat_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/join": {
      "get": {
        "operationId": "chat_join",
        "summary": "🔒 Добавление пользователя в существующий чат.",
        "description": "Добавление пользователя в существующий чат.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:join`, `chat:read`, `chat:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/join`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatJoinParams {\n  chatID: string\n  userID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatJoinResponse = IServerResponse<Resp_chat_join>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_join>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_join"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": 0,
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:join / chat:read / chat:update required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:join / chat:read / chat:update required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target chat or user does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target chat or user does not exist",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatJoinResponse = IServerResponse<Resp_chat_join>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/join?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/join', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_join>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/leave": {
      "get": {
        "operationId": "chat_leave",
        "summary": "🔒 Выход пользователя из чата или удаление участника администратором.",
        "description": "Выход пользователя из чата или удаление участника администратором.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:leave`, `chat:update` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/leave`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatLeaveParams {\n  chatID: string\n  userID?: string | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatLeaveResponse = IServerResponse<Resp_chat_leave>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "userID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `userID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_leave>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_leave"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": 0,
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Cannot remove other participants from direct chat, or privilege chat:leave / chat:update required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Cannot remove other participants from direct chat, or privilege chat:leave / chat:update required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Target chat or user membership record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Target chat or user membership record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatLeaveResponse = IServerResponse<Resp_chat_leave>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/leave?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/leave', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_leave>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/notifications": {
      "get": {
        "operationId": "chat_notifications",
        "summary": "🔒 Update mute status in chat",
        "description": "Update mute status in chat\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:read` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/notifications`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatNotificationsParams {\n  chatID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatNotificationsResponse = IServerResponse<Resp_chat_notifications>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_notifications>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_notifications"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": 0,
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatNotificationsResponse = IServerResponse<Resp_chat_notifications>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/notifications?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/notifications', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_notifications>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/open": {
      "get": {
        "operationId": "chat_open",
        "summary": "🔒 Открытие чата: участники и сообщения; двигает openedTS открывшего.",
        "description": "Открытие чата: участники и сообщения; двигает openedTS открывшего.\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `read`\n\n**Allows:** `chat:read` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /chat/open`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatOpenParams {\n  chatID: string\n  fromTS?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatOpenResponse = IServerResponse<Resp_chat_open>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "fromTS",
            "in": "query",
            "required": false,
            "description": "Можно передать header `fromTS` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_chat_open>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_chat_open"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "members": [
                      {
                        "ID": null,
                        "chatID": null,
                        "userID": null,
                        "isMute": null,
                        "isAdmin": null,
                        "openedTS": null,
                        "createDT": null,
                        "updTS": null,
                        "updUID": null,
                        "isDeleted": null,
                        "deletedTS": null
                      }
                    ],
                    "messages": [
                      {
                        "chatID": null,
                        "ID": null,
                        "authorUID": null,
                        "authorType": null,
                        "type": null,
                        "text": null,
                        "attachments": null,
                        "dayKey": null,
                        "dt": null,
                        "editedDT": null,
                        "replied": null,
                        "mentioned": null,
                        "reactions": null,
                        "viewed": null,
                        "meta": null,
                        "isDeleted": null,
                        "deletedTS": null,
                        "deletedUID": null,
                        "updTS": null,
                        "updUID": null
                      }
                    ],
                    "task": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "featureID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "status": null,
                      "state": null,
                      "category": null,
                      "type": null,
                      "priority": null,
                      "urgently": 0,
                      "title": "string",
                      "searchTitle": "string",
                      "key": 0,
                      "currentAssignee": "string",
                      "ord": 0,
                      "spec": "string",
                      "gist": "string",
                      "modules": {},
                      "components": {},
                      "approvalAssignee": "string",
                      "workAssignee": "string",
                      "workIterationKey": 0,
                      "workTimePlan": 0,
                      "workEvaluation": 0,
                      "reviewAssignee": "string",
                      "testAssignee": "string",
                      "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                      "resolutionType": null,
                      "resolutionNote": "string",
                      "result": "string",
                      "meta": {},
                      "git": {},
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "creatorUID": "00000000-0000-4000-8000-000000000001",
                      "stage": null,
                      "browser": null,
                      "bugType": null,
                      "build": "string",
                      "devices": [
                        null
                      ],
                      "labels": [
                        null
                      ],
                      "fuzzy": false,
                      "updTS": 0,
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updUID": "string",
                      "rejectUID": "string",
                      "rejectTS": 0
                    },
                    "bug": {
                      "cID": "00000000-0000-4000-8000-000000000001",
                      "projectID": "00000000-0000-4000-8000-000000000001",
                      "productID": "00000000-0000-4000-8000-000000000001",
                      "versionID": "00000000-0000-4000-8000-000000000001",
                      "featureID": "00000000-0000-4000-8000-000000000001",
                      "ID": "00000000-0000-4000-8000-000000000001",
                      "status": null,
                      "state": null,
                      "category": null,
                      "type": null,
                      "priority": null,
                      "urgently": 0,
                      "title": "string",
                      "searchTitle": "string",
                      "key": 0,
                      "currentAssignee": "string",
                      "ord": 0,
                      "spec": "string",
                      "gist": "string",
                      "modules": {},
                      "components": {},
                      "approvalAssignee": "string",
                      "workAssignee": "string",
                      "workIterationKey": 0,
                      "workTimePlan": 0,
                      "workEvaluation": 0,
                      "reviewAssignee": "string",
                      "testAssignee": "string",
                      "resolutionVersionID": "00000000-0000-4000-8000-000000000001",
                      "resolutionType": null,
                      "resolutionNote": "string",
                      "result": "string",
                      "meta": {},
                      "git": {},
                      "createDT": "2026-01-15T12:00:00.000Z",
                      "creatorUID": "00000000-0000-4000-8000-000000000001",
                      "stage": null,
                      "browser": null,
                      "bugType": null,
                      "build": "string",
                      "devices": [
                        null
                      ],
                      "labels": [
                        null
                      ],
                      "fuzzy": false,
                      "updTS": 0,
                      "isDeleted": false,
                      "deletedTS": 0,
                      "updUID": "string",
                      "rejectUID": "string",
                      "rejectTS": 0
                    }
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege chat:read required (member; entity chat - product access; company and department chats - employee)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege chat:read required (member; entity chat - product access; company and department chats - employee)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Neither the chat nor an entity with this ID exists in the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Neither the chat nor an entity with this ID exists in the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatOpenResponse = IServerResponse<Resp_chat_open>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/open?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/open', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_chat_open>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/chat/update": {
      "post": {
        "operationId": "chat_update",
        "summary": "🔒 Update chat",
        "description": "Update chat\n\n**Access:** `authorized` (10 ) · **allowNullCompany:** true · **Scope:** `write`\n\n**Allows:** `chat:update` (все обязательны; ресурс — `<тип>ID` / `ID` из запроса, `user:*` — `userID` или сам пользователь)\n\n### TypeScript (copy-paste)\n\n**`POST /chat/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface ChatUpdateParams {\n  chatID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body (Partial)</b></summary>\n\n```typescript\n// Patch-body: все поля опциональны (Valid.Patch)\nexport type ChatUpdateBody = Partial<Chat>\n\nexport interface ChatUpdateBodyFields {\n  ID?: string\n  cID?: string | null\n  type?: Chat_Type\n  logoFID?: string | null\n  title?: string | null\n  meta?: Record<string, any> | null\n  createDT?: string\n  /** Unix timestamp in milliseconds */\n  updTS?: number\n  updUID?: string\n  isDeleted?: boolean\n  /** Unix timestamp in milliseconds */\n  deletedTS?: number | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type ChatUpdateResponse = IServerResponse<Chat>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "Chat"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "chatID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `chatID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Chat>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Chat"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "ID": "00000000-0000-4000-8000-000000000001",
                    "cID": "00000000-0000-4000-8000-000000000001",
                    "type": "public",
                    "logoFID": "00000000-0000-4000-8000-000000000001",
                    "title": "string",
                    "meta": {},
                    "createDT": "2026-01-15T12:00:00.000Z",
                    "updTS": 0,
                    "updUID": "string",
                    "isDeleted": false,
                    "deletedTS": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Authorize — сессия отсутствует, истекла или невалидна",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Authorize — сессия отсутствует, истекла или невалидна",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: ChatUpdateResponse = IServerResponse<Chat>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/chat/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'chat/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Chat>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatUpdateBody"
              },
              "example": {
                "ID": "00000000-0000-4000-8000-000000000001",
                "cID": "00000000-0000-4000-8000-000000000001",
                "type": "public",
                "logoFID": "00000000-0000-4000-8000-000000000001",
                "title": "string",
                "meta": {},
                "createDT": "2026-01-15T12:00:00.000Z",
                "updTS": 0,
                "updUID": "string",
                "isDeleted": false,
                "deletedTS": 0
              }
            }
          }
        }
      }
    },
    "/agent-memory/create": {
      "post": {
        "operationId": "agent-memory_create",
        "summary": "🔒 #25987 Новая запись памяти агентов из веба: создаётся личной и непроверенной, как запись агента; модераторы памяти получают уведомление (#26725).",
        "description": "#25987 Новая запись памяти агентов из веба: создаётся личной и непроверенной, как запись агента; модераторы памяти получают уведомление (#26725).\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `memory:write` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /agent-memory/create`**\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface AgentMemoryCreateBody {\n  level: AgentMemory_Level\n  projectID?: string | null\n  repositoryID?: string | null\n  load: AgentMemory_Load\n  jobs?: Array<AgentMemory_Job> | null\n  title: string\n  text: string\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type AgentMemoryCreateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "AgentMemory"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege memory:write required (project and repository levels - product access)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege memory:write required (project and repository levels - product access)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Project or repository is not in the company",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Project or repository is not in the company",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid fields (no jobs for job/request, jobs for always, empty title or text)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid fields (no jobs for job/request, jobs for always, empty title or text)",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: AgentMemoryCreateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/agent-memory/create?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'agent-memory/create', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentMemoryCreateBody"
              },
              "example": {
                "level": "company",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "repositoryID": "00000000-0000-4000-8000-000000000001",
                "load": "always",
                "jobs": [
                  "analysis"
                ],
                "title": "string",
                "text": "string"
              }
            }
          }
        }
      }
    },
    "/agent-memory/delete": {
      "get": {
        "operationId": "agent-memory_delete",
        "summary": "🔒 #25987 Удаление записи памяти агентов (мягкое): автор - свои записи, администратор - любые, кроме чужой памяти уровня пользователя.",
        "description": "#25987 Удаление записи памяти агентов (мягкое): автор - свои записи, администратор - любые, кроме чужой памяти уровня пользователя.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `memory:write`, `memory:moderate` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /agent-memory/delete`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface AgentMemoryDeleteParams {\n  ID: string\n  /** Unix timestamp in milliseconds */\n  version: number\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type AgentMemoryDeleteResponse = IServerResponse<Resp_agent-memory_delete>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "AgentMemory"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "version",
            "in": "query",
            "required": true,
            "description": "Можно передать header `version` (сервер мержит headers+query)",
            "schema": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_agent-memory_delete>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_agent-memory_delete"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "deleted": false,
                    "version": 0
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege memory:write required (own record), memory:moderate - foreign record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege memory:write required (own record), memory:moderate - foreign record",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Memory record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Memory record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: The record changed since it was read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: The record changed since it was read",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: AgentMemoryDeleteResponse = IServerResponse<Resp_agent-memory_delete>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/agent-memory/delete?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'agent-memory/delete', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_agent-memory_delete>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/agent-memory/list": {
      "get": {
        "operationId": "agent-memory_list",
        "summary": "🔒 #25987 Список записей памяти агентов с фильтрами и статистикой использования. Администратору - все записи компании, кроме чужой памяти уровня пользователя; сотруднику - свои записи и общие проверенные в пределах доступных проектов.",
        "description": "#25987 Список записей памяти агентов с фильтрами и статистикой использования. Администратору - все записи компании, кроме чужой памяти уровня пользователя; сотруднику - свои записи и общие проверенные в пределах доступных проектов.\n\n**Access:** `authorized` (10 ) · **Scope:** `read`\n\n**Allows:** `memory:write`, `memory:moderate` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`GET /agent-memory/list`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface AgentMemoryListParams {\n  IDs?: Array<string> | null\n  level?: AgentMemory_Level | null\n  projectID?: string | null\n  repositoryID?: string | null\n  load?: AgentMemory_Load | null\n  jobs?: Array<AgentMemory_Job> | null\n  verified?: boolean | null\n  shared?: boolean | null\n  authorUID?: string | null\n  query?: string | null\n  unusedDays?: number | null\n  sort?: agent_memory_list_sort | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type AgentMemoryListResponse = IServerResponse<Resp_agent-memory_list>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "AgentMemory"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "IDs",
            "in": "query",
            "required": false,
            "description": "Можно передать header `IDs` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "example": [
              "00000000-0000-4000-8000-000000000001"
            ]
          },
          {
            "name": "level",
            "in": "query",
            "required": false,
            "description": "Можно передать header `level` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/AgentMemory_Level"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "company"
          },
          {
            "name": "projectID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `projectID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "repositoryID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `repositoryID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "load",
            "in": "query",
            "required": false,
            "description": "Можно передать header `load` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/AgentMemory_Load"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "always"
          },
          {
            "name": "jobs",
            "in": "query",
            "required": false,
            "description": "Можно передать header `jobs` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "$ref": "#/components/schemas/AgentMemory_Job"
              }
            },
            "example": [
              "analysis"
            ]
          },
          {
            "name": "verified",
            "in": "query",
            "required": false,
            "description": "Можно передать header `verified` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          },
          {
            "name": "shared",
            "in": "query",
            "required": false,
            "description": "Можно передать header `shared` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "example": false
          },
          {
            "name": "authorUID",
            "in": "query",
            "required": false,
            "description": "Можно передать header `authorUID` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Можно передать header `query` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "example": "string"
          },
          {
            "name": "unusedDays",
            "in": "query",
            "required": false,
            "description": "Можно передать header `unusedDays` (сервер мержит headers+query)",
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "example": 0
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Можно передать header `sort` (сервер мержит headers+query)",
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/agent_memory_list_sort"
                },
                {
                  "type": "null"
                }
              ]
            },
            "example": "usage"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Resp_agent-memory_list>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Resp_agent-memory_list"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "list": [
                      {
                        "cID": null,
                        "ID": null,
                        "level": null,
                        "userID": null,
                        "projectID": null,
                        "repositoryID": null,
                        "load": null,
                        "jobs": null,
                        "title": null,
                        "text": null,
                        "shared": null,
                        "verified": null,
                        "deliveredCount": null,
                        "readCount": null,
                        "lastUsedDT": null,
                        "authorUID": null,
                        "apiTokenID": null,
                        "verifiedUID": null,
                        "verifiedDT": null,
                        "isDeleted": null,
                        "createDT": null,
                        "updUID": null,
                        "version": null
                      }
                    ],
                    "repositories": [
                      null
                    ]
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed — privilegeRequired: нет привилегии; data.params = { code: 'privilegeRequired', allow, relation? }",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: AgentMemoryListResponse = IServerResponse<Resp_agent-memory_list>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/agent-memory/list?…', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'agent-memory/list', rts, session.ID),\n  },\n  \n})\nconst text = await res.text()\nlet json: IServerResponse<Resp_agent-memory_list>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ]
      }
    },
    "/agent-memory/update": {
      "post": {
        "operationId": "agent-memory_update",
        "summary": "🔒 #25987 Изменение записи памяти агентов: поля, уровень и область, модерация (verified, shared - только администратор). version - версия, которую видел пользователь; запись изменилась после чтения - отказ.",
        "description": "#25987 Изменение записи памяти агентов: поля, уровень и область, модерация (verified, shared - только администратор). version - версия, которую видел пользователь; запись изменилась после чтения - отказ.\n\n**Access:** `authorized` (10 ) · **Scope:** `write`\n\n**Allows:** `memory:write`, `memory:moderate` (все обязательны; проверка в команде по ресурсу из запроса)\n\n### TypeScript (copy-paste)\n\n**`POST /agent-memory/update`**\n\n<details open><summary><b>Params</b></summary>\n\n```typescript\nexport interface AgentMemoryUpdateParams {\n  ID: string\n}\n```\n\n</details>\n\n<details open><summary><b>Body</b></summary>\n\n```typescript\nexport interface AgentMemoryUpdateBody {\n  /** Unix timestamp in milliseconds */\n  version: number\n  level?: AgentMemory_Level | null\n  projectID?: string | null\n  repositoryID?: string | null\n  load?: AgentMemory_Load | null\n  jobs?: Array<AgentMemory_Job> | null\n  title?: string | null\n  text?: string | null\n  verified?: boolean | null\n  shared?: boolean | null\n}\n```\n\n</details>\n\n<details open><summary><b>Response</b></summary>\n\n```typescript\nexport type AgentMemoryUpdateResponse = IServerResponse<Record<string, any>>\n\nexport interface IServerResponse<T = any> {\n  code: number\n  data: T\n  srvTS: number\n  rkey: string\n}\n```\n\n</details>\n\n> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)",
        "tags": [
          "AgentMemory"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "ID",
            "in": "query",
            "required": true,
            "description": "Можно передать header `ID` (сервер мержит headers+query)",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "00000000-0000-4000-8000-000000000001"
          }
        ],
        "responses": {
          "200": {
            "description": "OK — `IServerResponse<Record<string, any>>`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Response payload (нет ResponseData / doc.schema)"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "400": {
            "description": "BadRequest / Validation — неверные params/body/headers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 400,
                  "data": {
                    "err": "BadRequest / Validation — неверные params/body/headers",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: Active user session required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 401,
                  "data": {
                    "err": "Unauthorized: Active user session required",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "403": {
            "description": "AccessNotAllowed: Privilege memory:write required (own record), memory:moderate - foreign record and moderation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 403,
                  "data": {
                    "err": "AccessNotAllowed: Privilege memory:write required (own record), memory:moderate - foreign record and moderation",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "404": {
            "description": "NotFound: Memory record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 404,
                  "data": {
                    "err": "NotFound: Memory record not found",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "406": {
            "description": "TimeResync — расхождение rts с сервером",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 406,
                  "data": {
                    "err": "TimeResync — расхождение rts с сервером",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          },
          "422": {
            "description": "UnprocessableContent: Invalid fields (no jobs for job/request) or the record changed since it was read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/IServerErrorData"
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 422,
                  "data": {
                    "err": "UnprocessableContent: Invalid fields (no jobs for job/request) or the record changed since it was read",
                    "params": {},
                    "stack": "..."
                  },
                  "srvTS": 1700000000000,
                  "rkey": "example-rkey"
                }
              }
            }
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "BearerToken": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "// Types: AgentMemoryUpdateResponse = IServerResponse<Record<string, any>>\n// Auth helper: /docs/auth\n\nconst rts = Date.now() // + serverDelta if needed\nconst res = await fetch('/agent-memory/update?…', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'devID': deviceId,\n    'tz': Intl.DateTimeFormat().resolvedOptions().timeZone,\n    'app': 'kosmodrom-web',\n    'appVer': '1.0.0',\n  'sid': session.ID,\n  'rts': String(rts),\n  'sig': await makeSessionSignature(session.secretToken, 'agent-memory/update', rts, session.ID),\n  },\n  body: JSON.stringify(body),\n})\nconst text = await res.text()\nlet json: IServerResponse<Record<string, any>>\ntry { json = JSON.parse(text) } catch {\n  throw Object.assign(new Error('Non-JSON response HTTP ' + res.status), { status: res.status, raw: text })\n}"
          },
          {
            "lang": "TypeScript",
            "label": "signature",
            "source": "// Схема hmac-sha256-v2. Тест-векторы: protocol/vectors/signature.json\nasync function makeSessionSignature(secretToken: string, location: string, reqSrvTs: number, sessID: string) {\n  const salt = secretToken.substring(19, 23) + sessID.substring(9, 17)\n  const payload = [salt, sessID, String(reqSrvTs), location].join('\\n')\n\n  const enc = new TextEncoder()\n  const key = await crypto.subtle.importKey('raw', enc.encode(secretToken), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n  const mac = await crypto.subtle.sign('HMAC', key, enc.encode(payload))\n\n  return [...new Uint8Array(mac)].map( b => b.toString(16).padStart(2, '0') ).join('')\n}"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentMemoryUpdateBody"
              },
              "example": {
                "version": 0,
                "level": "company",
                "projectID": "00000000-0000-4000-8000-000000000001",
                "repositoryID": "00000000-0000-4000-8000-000000000001",
                "load": "always",
                "jobs": [
                  "analysis"
                ],
                "title": "string",
                "text": "string",
                "verified": false,
                "shared": false
              }
            }
          }
        }
      }
    },
    "/file": {
      "get": {
        "operationId": "file_download",
        "summary": "📥 Download file / preview",
        "description": "Скачивание файла или превью. Сессия - с доказательством владения ею, один ID сессии доступа не даёт:\nподпись (`sid` + `rts` + `sig`), `sid` + `fileToken` или кука `fsid`. `sid` без доказательства принимается,\nтолько если совпадает с кукой. Нет доказательства или неверный ключ - 401, неверная подпись - 403.\n\nLocation config: `api.commonLocations.baseFilesAccess` = `file`.\n\nОтвет: binary stream / redirect на signed URL (S3).",
        "tags": [
          "Files"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "name": "sid",
            "in": "query",
            "required": false,
            "description": "ID сессии - вместе с доказательством: подписью (rts, sig) или fileToken. Без sid сессия берётся из куки fsid",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fileToken",
            "in": "query",
            "required": false,
            "description": "Ключ отдачи файлов сессии (см. схему FileToken) - клиентам вне сайта API, куда кука fsid не доходит",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fid",
            "in": "query",
            "required": true,
            "description": "File ID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "icon | preview | data (default: original)",
            "schema": {
              "type": "string",
              "enum": [
                "icon",
                "preview",
                "data"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File bytes",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "302": {
            "description": "Redirect to storage signed URL"
          },
          "401": {
            "description": "Session invalid"
          },
          "404": {
            "description": "File not found"
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "SessionId": [],
            "FileToken": []
          },
          {
            "FileCookie": []
          }
        ]
      },
      "post": {
        "operationId": "file_upload",
        "summary": "📤 Upload file",
        "description": "Загрузка файла (multipart или raw body + name).\n\nQuery: `fid`, опционально `name`; сессия - как у скачивания (подпись, `fileToken` или кука `fsid`).",
        "tags": [
          "Files"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "name": "sid",
            "in": "query",
            "required": false,
            "description": "ID сессии - вместе с доказательством: подписью (rts, sig) или fileToken. Без sid сессия берётся из куки fsid",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fileToken",
            "in": "query",
            "required": false,
            "description": "Ключ отдачи файлов сессии (см. схему FileToken) - клиентам вне сайта API, куда кука fsid не доходит",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fid",
            "in": "query",
            "required": true,
            "description": "File ID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "icon | preview | data (default: original)",
            "schema": {
              "type": "string",
              "enum": [
                "icon",
                "preview",
                "data"
              ]
            }
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Имя файла (обязательно для raw body)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "IServerResponse with file meta",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "description": "IFileStorageFile meta",
                      "additionalProperties": true
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Session invalid"
          },
          "404": {
            "description": "File slot not found"
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          },
          {
            "SessionId": [],
            "FileToken": []
          },
          {
            "FileCookie": []
          }
        ]
      }
    },
    "/ping": {
      "get": {
        "operationId": "system_ping",
        "summary": "🏓 Ping",
        "description": "Лёгкий health-check (без БД). Unauthorized.",
        "tags": [
          "System"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {},
                  "srvTS": 1700000000000,
                  "rkey": "…"
                }
              }
            }
          }
        }
      }
    },
    "/_healthz": {
      "get": {
        "operationId": "system_healthz",
        "summary": "❤️ Healthz",
        "description": "Проверка зависимостей (БД и т.д.). Ответ содержит stats ошибок.",
        "tags": [
          "System"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data",
                    "srvTS",
                    "rkey"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "errors": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "srvTS": {
                      "type": "integer",
                      "description": "Server timestamp (ms)"
                    },
                    "rkey": {
                      "type": "string",
                      "description": "Request key"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sse/app-state": {
      "get": {
        "operationId": "sse_app_state",
        "summary": "📡 SSE app-state stream",
        "description": "Server-Sent Events: синхронизация состояния приложения и уведомления.\n\n**Access:** authorized. Подпись session как у обычных endpoint.\n\n### Events (`SSEMessageEvent`)\n\n| event | payload (data) |\n|-------|----------------|\n| `onConnect` | handshake |\n| `session-user` | current user / session |\n| `company-state` | company + dictionaries |\n| `work-state` | work/kanban patches |\n| `notification` | Notification |\n| `team` | team updates |\n| `chat-state` | Chat |\n| `chat-message` | ChatMessage |\n| `chat-member` | ChatMember |\n\nСм. schema **SSEAppStateEvent** + enum **SSEMessageEvent**.\n\nParams: `lastUpdTs` — timestamp для дельты.",
        "tags": [
          "SSE"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DevID"
          },
          {
            "$ref": "#/components/parameters/Tz"
          },
          {
            "$ref": "#/components/parameters/App"
          },
          {
            "$ref": "#/components/parameters/AppVer"
          },
          {
            "$ref": "#/components/parameters/RKey"
          },
          {
            "name": "lastUpdTs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Unix ms"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/event-stream of SSEAppStateEvent JSON lines",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/SSEAppStateEvent"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Access denied"
          }
        },
        "security": [
          {
            "SessionId": [],
            "RequestTs": [],
            "RequestSignature": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SessionId": {
        "type": "apiKey",
        "in": "header",
        "name": "sid",
        "description": "ID сессии (uuid), выдаётся на signin/auth"
      },
      "RequestTs": {
        "type": "apiKey",
        "in": "header",
        "name": "rts",
        "description": "Время сервера по мнению клиента (unix ms)"
      },
      "RequestSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "sig",
        "description": "Подпись запроса, схема hmac-sha256-v2: HMAC-SHA256( key = secretToken, message = [salt, sid, rts, location].join(\"\\n\") ), hex. Тест-векторы: protocol/vectors/signature.json"
      },
      "FileToken": {
        "type": "apiKey",
        "in": "query",
        "name": "fileToken",
        "description": "Ключ отдачи файлов (только /file, вместе с sid): HMAC-SHA256( key = secretToken, message = \"file-key\\n\" + sid ), hex. Тест-векторы: protocol/vectors/file-key.json"
      },
      "FileCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "fsid",
        "description": "HttpOnly-кука отдачи файлов `<sid>.<ключ файлов>` (только /file): ставится на каждом авторизованном ответе"
      },
      "BearerToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Персональный токен `kmt_…` или токен OAuth-подключения: компания - из токена, scope `read` - только команды чтения, `read write` - все, кроме команд только для веб-сессии"
      }
    },
    "parameters": {
      "DevID": {
        "name": "devID",
        "in": "header",
        "required": true,
        "description": "UUID устройства клиента",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "Tz": {
        "name": "tz",
        "in": "header",
        "required": true,
        "description": "Таймзона клиента (IANA или offset)",
        "schema": {
          "type": "string",
          "example": "Europe/Moscow"
        }
      },
      "App": {
        "name": "app",
        "in": "header",
        "required": true,
        "description": "Имя клиентского приложения",
        "schema": {
          "type": "string",
          "example": "kosmodrom-web"
        }
      },
      "AppVer": {
        "name": "appVer",
        "in": "header",
        "required": true,
        "description": "Версия клиента",
        "schema": {
          "type": "string",
          "example": "1.0.0"
        }
      },
      "RKey": {
        "name": "rKey",
        "in": "header",
        "required": false,
        "description": "Уникальный ключ запроса для логов/саппорта",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "core_user_devices": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "lastActiveTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "type": {
            "$ref": "#/components/schemas/UserDeviceType"
          },
          "isPushEnabled": {
            "type": "boolean"
          },
          "webpushSubscription": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "endpoint": {
                "type": "string"
              },
              "expirationTime": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Unix timestamp in milliseconds"
              },
              "keys": {
                "type": "object",
                "properties": {
                  "p256dh": {
                    "type": "string"
                  },
                  "auth": {
                    "type": "string"
                  }
                },
                "required": [
                  "p256dh",
                  "auth"
                ]
              }
            },
            "required": [
              "endpoint",
              "keys"
            ]
          },
          "vendor": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "os": {
            "type": "string"
          },
          "osVer": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "agentVer": {
            "type": "string"
          },
          "app": {
            "type": "string"
          },
          "appVer": {
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "acceptLanguage": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "createDT": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "userID",
          "lastActiveTs",
          "type",
          "isPushEnabled",
          "vendor",
          "model",
          "title",
          "os",
          "osVer",
          "agent",
          "agentVer",
          "app",
          "appVer",
          "locale",
          "acceptLanguage",
          "timezone",
          "createDT",
          "updTS",
          "updUID"
        ],
        "title": "core_user_devices",
        "description": "Entity `core_user_devices` (table: core_user_devices )"
      },
      "Icore_user_devices": {
        "$ref": "#/components/schemas/core_user_devices"
      },
      "core_sessions": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "parentID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "devID": {
            "type": "string",
            "format": "uuid"
          },
          "device": {
            "type": "object",
            "additionalProperties": true
          },
          "expTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "createTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "lastActiveTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "secretToken": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "accessType": {
            "type": "integer"
          },
          "ip": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "needResyncState": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds",
            "default": 0
          },
          "hasActiveRole": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "allowedProduct": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allowedProductAll": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "meta": {
            "type": "object",
            "additionalProperties": true
          },
          "errorMessage": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ID",
          "userID",
          "devID",
          "device",
          "expTs",
          "createTs",
          "lastActiveTs",
          "secretToken",
          "location",
          "accessType",
          "ip",
          "country",
          "city",
          "timezone",
          "meta"
        ],
        "title": "core_sessions",
        "description": "Entity `core_sessions` (table: core_sessions )"
      },
      "Icore_sessions": {
        "$ref": "#/components/schemas/core_sessions"
      },
      "User": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "auth": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "avatarFID": {
            "type": "string",
            "format": "uuid"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "patronymic": {
            "type": [
              "string",
              "null"
            ]
          },
          "gender": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/User_gender"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactInfo": {
            "type": [
              "string",
              "null"
            ]
          },
          "dateOfBirth": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "address": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "streetAddress": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ]
          },
          "meetingInfo": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "zoomEmail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "position": {
            "type": [
              "string",
              "null"
            ]
          },
          "hourCost": {
            "type": "number"
          },
          "docsEmployment": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "docsLibrary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isDraft": {
            "type": "boolean"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "avatarFID",
          "firstName",
          "lastName",
          "hourCost",
          "isDraft",
          "createDT",
          "createdUID",
          "updTS",
          "updUID"
        ],
        "title": "User",
        "description": "Entity `User` (table: User )"
      },
      "IUser": {
        "$ref": "#/components/schemas/User"
      },
      "Meeting": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "entityType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Meeting_entityType"
              },
              {
                "type": "null"
              }
            ]
          },
          "entityID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "agenda": {
            "type": "string"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolution": {
            "type": "string"
          },
          "startDtEstimated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDtEstimated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "startDtFact": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDtFact": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/Meeting_Type"
          },
          "link": {
            "type": [
              "string",
              "null"
            ]
          },
          "participants": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "userID": {
                  "type": "string"
                },
                "userUpdTS": {
                  "type": "integer",
                  "description": "Unix timestamp in milliseconds"
                },
                "position": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hourCost": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "comment": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "isAdmin": {
                  "type": "boolean"
                },
                "isExternal": {
                  "type": "boolean"
                },
                "isAccepted": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "acceptedDT": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "acceptedUID": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "isActive": {
                  "type": "boolean"
                },
                "activeDT": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "activeUID": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "createdDT": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdUID": {
                  "type": "string",
                  "format": "uuid"
                },
                "inviteDT": {
                  "type": "string",
                  "format": "date-time"
                },
                "inviteUID": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updTS": {
                  "type": "integer",
                  "description": "Unix timestamp in milliseconds"
                },
                "updUID": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "userID",
                "userUpdTS",
                "isAdmin",
                "isExternal",
                "isActive",
                "createdDT",
                "createdUID",
                "inviteDT",
                "updTS",
                "updUID"
              ]
            }
          },
          "online": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "integrationID": {
                "type": "string"
              },
              "service": {
                "$ref": "#/components/schemas/Meeting_online_service"
              },
              "roomID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "callID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "passcode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "integrationID",
              "service"
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "title",
          "agenda",
          "resolution",
          "type",
          "participants",
          "createdDT",
          "createdUID",
          "updTS",
          "updUID"
        ],
        "title": "Meeting",
        "description": "Entity `Meeting` (table: Meeting )"
      },
      "IMeeting": {
        "$ref": "#/components/schemas/Meeting"
      },
      "AuthSignInCode": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userPhone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "userEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "purpose": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AuthSignInCode_Purpose"
              },
              {
                "type": "null"
              }
            ]
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/AuthSignInCode_Status",
            "default": 0
          },
          "code": {
            "type": "integer"
          },
          "expTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "code",
          "expTs",
          "note"
        ],
        "title": "AuthSignInCode",
        "description": "Entity `AuthSignInCode` (table: AuthSignInCode )"
      },
      "IAuthSignInCode": {
        "$ref": "#/components/schemas/AuthSignInCode"
      },
      "ApiToken": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/ApiToken_type",
            "default": "agent"
          },
          "kind": {
            "$ref": "#/components/schemas/ApiToken_kind",
            "default": "pat"
          },
          "clientID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "sessionID": {
            "type": [
              "string",
              "null"
            ]
          },
          "refreshHash": {
            "type": [
              "string",
              "null"
            ]
          },
          "refreshExpTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "prevRefreshHashes": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "tokenHash": {
            "type": "string"
          },
          "tokenPrefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {}
          },
          "expTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "lastUsedTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isRevoked": {
            "type": "boolean",
            "default": false
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "userID",
          "cID",
          "title",
          "tokenHash",
          "tokenPrefix",
          "scopes",
          "createdDT",
          "updTS",
          "updUID"
        ],
        "title": "ApiToken",
        "description": "Entity `ApiToken` (table: ApiToken )"
      },
      "IApiToken": {
        "$ref": "#/components/schemas/ApiToken"
      },
      "OAuthClient": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "clientName": {
            "type": "string"
          },
          "redirectUris": {
            "type": "array",
            "items": {}
          },
          "tokenEndpointAuthMethod": {
            "type": "string",
            "default": "none"
          },
          "createdTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "metadataUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadataFetchedTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "secretHash": {
            "type": [
              "string",
              "null"
            ]
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "ID",
          "clientName",
          "redirectUris",
          "createdTs"
        ],
        "title": "OAuthClient",
        "description": "Entity `OAuthClient` (table: OAuthClient )"
      },
      "IOAuthClient": {
        "$ref": "#/components/schemas/OAuthClient"
      },
      "OAuthAuthCode": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "clientID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "redirectUri": {
            "type": "string"
          },
          "codeChallenge": {
            "type": "string"
          },
          "codeChallengeMethod": {
            "type": "string"
          },
          "resource": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "type": "string"
          },
          "sessionID": {
            "type": [
              "string",
              "null"
            ]
          },
          "expTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "usedTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "createdTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "clientID",
          "userID",
          "cID",
          "redirectUri",
          "codeChallenge",
          "codeChallengeMethod",
          "scope",
          "expTs",
          "createdTs"
        ],
        "title": "OAuthAuthCode",
        "description": "Entity `OAuthAuthCode` (table: OAuthAuthCode )"
      },
      "IOAuthAuthCode": {
        "$ref": "#/components/schemas/OAuthAuthCode"
      },
      "OAuthLoginSession": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "clientID": {
            "type": "string",
            "format": "uuid"
          },
          "redirectUri": {
            "type": "string"
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          },
          "codeChallenge": {
            "type": "string"
          },
          "codeChallengeMethod": {
            "type": "string"
          },
          "resource": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "type": "string"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "decision": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OauthLoginSession_Decision"
              },
              {
                "type": "null"
              }
            ]
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "grantedScope": {
            "type": [
              "string",
              "null"
            ]
          },
          "sessionID": {
            "type": [
              "string",
              "null"
            ]
          },
          "ticketHash": {
            "type": [
              "string",
              "null"
            ]
          },
          "decidedTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "expTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "createdTs": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "clientID",
          "redirectUri",
          "codeChallenge",
          "codeChallengeMethod",
          "scope",
          "expTs",
          "createdTs"
        ],
        "title": "OAuthLoginSession",
        "description": "Entity `OAuthLoginSession` (table: OAuthLoginSession )"
      },
      "IOAuthLoginSession": {
        "$ref": "#/components/schemas/OAuthLoginSession"
      },
      "Iteration": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "integer"
          },
          "year": {
            "type": "integer"
          },
          "month": {
            "type": "integer"
          },
          "week": {
            "type": "integer"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "title": {
            "type": "string"
          },
          "timeWorked": {
            "type": "integer"
          },
          "notWorkDays": {
            "type": "object",
            "additionalProperties": true
          },
          "shortDays": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "key",
          "year",
          "month",
          "week",
          "startDayKey",
          "endDayKey",
          "start",
          "end",
          "title",
          "timeWorked",
          "notWorkDays",
          "updTS"
        ],
        "title": "Iteration",
        "description": "Entity `Iteration` (table: Iteration )"
      },
      "CurrencyRate": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "rates": {
            "type": "object",
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "rates",
          "updTS"
        ],
        "title": "CurrencyRate",
        "description": "Entity `CurrencyRate` (table: CurrencyRate )"
      },
      "ICurrencyRate": {
        "$ref": "#/components/schemas/CurrencyRate"
      },
      "DemoSetState": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "startDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "generatedUntil": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "emulatedUntilTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "setCommit": {
            "type": [
              "string",
              "null"
            ]
          },
          "checks": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "work": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "drafts": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "settings": {
            "type": "object",
            "additionalProperties": true
          },
          "settingsLog": {
            "type": "array",
            "items": {},
            "default": []
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updBy": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "settings",
          "updTS",
          "updBy"
        ],
        "title": "DemoSetState",
        "description": "Entity `DemoSetState` (table: DemoSetState )"
      },
      "IDemoSetState": {
        "$ref": "#/components/schemas/DemoSetState"
      },
      "DemoRun": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "set": {
            "type": "string"
          },
          "command": {
            "$ref": "#/components/schemas/DemoRun_Command"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          },
          "createdBy": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/DemoRun_Source"
          },
          "status": {
            "$ref": "#/components/schemas/DemoRun_Status"
          },
          "activeSet": {
            "type": [
              "string",
              "null"
            ]
          },
          "stopRequested": {
            "type": "boolean",
            "default": false
          },
          "stoppedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "heartbeatTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "setCommit": {
            "type": [
              "string",
              "null"
            ]
          },
          "progress": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "aiSpent": {
            "type": "number",
            "default": 0
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "startDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finishDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "ID",
          "set",
          "command",
          "params",
          "createdBy",
          "source",
          "status",
          "createDT"
        ],
        "title": "DemoRun",
        "description": "Entity `DemoRun` (table: DemoRun )"
      },
      "IDemoRun": {
        "$ref": "#/components/schemas/DemoRun"
      },
      "Notification": {
        "type": "object",
        "properties": {
          "channel": {
            "$ref": "#/components/schemas/Notification_channel"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "actionType": {
            "$ref": "#/components/schemas/Notification_ActionType"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "resID": {
            "type": [
              "string",
              "null"
            ]
          },
          "resType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Notification_ResType"
              },
              {
                "type": "null"
              }
            ]
          },
          "payload": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "sendAtTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "eventTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "lockStateDT": {
            "type": "string",
            "format": "date-time"
          },
          "lockState": {
            "$ref": "#/components/schemas/Notification_lockState"
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "channel",
          "userID",
          "ID",
          "actionType",
          "lockStateDT",
          "lockState",
          "createdDT",
          "createdUID",
          "updTS",
          "updUID"
        ],
        "title": "Notification",
        "description": "Entity `Notification` (table: Notification )"
      },
      "INotification": {
        "$ref": "#/components/schemas/Notification"
      },
      "File": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/File_type"
          },
          "mimeType": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "ext": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "format": "int64"
          },
          "owner": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "uploaded": {
            "type": "integer"
          },
          "storage": {
            "type": "boolean"
          },
          "ready": {
            "type": "boolean"
          },
          "preview": {
            "$ref": "#/components/schemas/Notification_lockState"
          },
          "uplDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "uplUID": {
            "type": "string"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "sessID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "ID",
          "type",
          "mimeType",
          "name",
          "ext",
          "size",
          "uploaded",
          "storage",
          "ready",
          "preview",
          "uplUID"
        ],
        "title": "File",
        "description": "Entity `File` (table: File )"
      },
      "IFile": {
        "$ref": "#/components/schemas/File"
      },
      "FileRelation": {
        "type": "object",
        "properties": {
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "fID": {
            "type": "string",
            "format": "uuid"
          },
          "entityID": {
            "type": "string",
            "format": "uuid"
          },
          "entityType": {
            "$ref": "#/components/schemas/FileRelation_EntityType"
          },
          "field": {
            "$ref": "#/components/schemas/FileRelation_FieldType"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createUID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID",
          "fID",
          "entityID",
          "entityType",
          "field",
          "createDT",
          "createUID"
        ],
        "title": "FileRelation",
        "description": "Entity `FileRelation` (table: FileRelation )"
      },
      "IFileRelation": {
        "$ref": "#/components/schemas/FileRelation"
      },
      "Chat": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/Chat_Type"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "type",
          "createDT",
          "updTS",
          "updUID"
        ],
        "title": "Chat",
        "description": "Entity `Chat` (table: Chat )"
      },
      "IChat": {
        "$ref": "#/components/schemas/Chat"
      },
      "ChatMember": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "chatID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "isMute": {
            "type": "boolean",
            "default": false
          },
          "isAdmin": {
            "type": "boolean",
            "default": false
          },
          "openedTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "chatID",
          "userID",
          "openedTS",
          "createDT",
          "updTS",
          "updUID"
        ],
        "title": "ChatMember",
        "description": "Entity `ChatMember` (table: ChatMember )"
      },
      "IChatMember": {
        "$ref": "#/components/schemas/ChatMember"
      },
      "ChatMessage": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "authorUID": {
            "type": "string",
            "format": "uuid"
          },
          "authorType": {
            "$ref": "#/components/schemas/ChatMessage_AuthorType"
          },
          "type": {
            "$ref": "#/components/schemas/ChatMessage_Type"
          },
          "text": {
            "type": "string"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "dayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "dt": {
            "type": "string",
            "format": "date-time"
          },
          "editedDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "replied": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ID": {
                "type": "string",
                "format": "uuid"
              },
              "text": {
                "type": "string"
              },
              "authorUID": {
                "type": "string",
                "format": "uuid"
              },
              "attachmentFID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "attachmentCount": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "ID",
              "text",
              "authorUID"
            ]
          },
          "mentioned": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "reactions": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "viewed": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "string",
              "format": "date-time"
            }
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "apiTokenID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "event": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "type": {
                    "$ref": "#/components/schemas/ChatMessage_SystemEvent"
                  },
                  "newTitle": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "targetUID": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  }
                },
                "required": [
                  "type"
                ]
              },
              "forwarded": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "chatID": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "messageID": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "chatTitle": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chatLogoUrl": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "authorUID": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "dt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "entType": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/EntityType"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "productID": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  }
                },
                "required": [
                  "chatID",
                  "authorUID"
                ]
              }
            }
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "deletedUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "chatID",
          "ID",
          "authorUID",
          "authorType",
          "type",
          "text",
          "dayKey",
          "dt",
          "updTS",
          "updUID"
        ],
        "title": "ChatMessage",
        "description": "Entity `ChatMessage` (table: ChatMessage )"
      },
      "IChatMessage": {
        "$ref": "#/components/schemas/ChatMessage"
      },
      "Project": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "ID",
          "title",
          "ord",
          "updTS",
          "updUID"
        ],
        "title": "Project",
        "description": "Entity `Project` (table: Project )"
      },
      "IProject": {
        "$ref": "#/components/schemas/Project"
      },
      "ProjectRepository": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          },
          "integrationID": {
            "type": "string",
            "format": "uuid"
          },
          "agentAccess": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProjectRepository_AgentAccess"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "cID",
          "projectID",
          "repositoryID",
          "integrationID",
          "createdUID",
          "createdDT",
          "updTS"
        ],
        "title": "ProjectRepository",
        "description": "Entity `ProjectRepository` (table: ProjectRepository )"
      },
      "IProjectRepository": {
        "$ref": "#/components/schemas/ProjectRepository"
      },
      "Product": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "cardFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "analyticAssignee": {
            "type": "string"
          },
          "platform": {
            "$ref": "#/components/schemas/Product_Platform"
          },
          "title": {
            "type": "string"
          },
          "techStack": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "leadUID": {
            "type": "string",
            "format": "uuid"
          },
          "startD": {
            "type": "string",
            "format": "date-time"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isArchived": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "archivedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isDeployEnabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "team": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds"
            }
          },
          "git": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "design": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "fileUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "uiKitUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refUrls": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              }
            }
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "spec": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "projectID",
          "ID",
          "analyticAssignee",
          "platform",
          "title",
          "techStack",
          "leadUID",
          "startD",
          "ord",
          "spec",
          "updTS",
          "updUID"
        ],
        "title": "Product",
        "description": "Entity `Product` (table: Product )"
      },
      "IProduct": {
        "$ref": "#/components/schemas/Product"
      },
      "Version": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "major": {
            "type": "integer"
          },
          "minor": {
            "type": "integer"
          },
          "build": {
            "type": [
              "integer",
              "null"
            ]
          },
          "resolvedBugs": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "notes": {
            "type": "string"
          },
          "isDone": {
            "type": "boolean"
          },
          "isPublished": {
            "type": "boolean"
          },
          "releaseDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "design": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "fileUrl": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updateDT": {
            "type": "string",
            "format": "date-time"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "projectID",
          "productID",
          "ID",
          "title",
          "major",
          "minor",
          "notes",
          "isDone",
          "isPublished",
          "createDT",
          "updateDT",
          "updTS",
          "updUID"
        ],
        "title": "Version",
        "description": "Entity `Version` (table: Version )"
      },
      "IVersion": {
        "$ref": "#/components/schemas/Version"
      },
      "Feature": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": [
              "integer",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "spec": {
            "type": "string"
          },
          "gist": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "analyticAssignee": {
            "type": "string"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "projectID",
          "productID",
          "versionID",
          "ID",
          "title",
          "status",
          "spec",
          "analyticAssignee",
          "ord",
          "updTS",
          "updUID"
        ],
        "title": "Feature",
        "description": "Entity `Feature` (table: Feature )"
      },
      "IFeature": {
        "$ref": "#/components/schemas/Feature"
      },
      "Module": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "parentID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "title": {
            "type": "string"
          },
          "desc": {
            "type": "string"
          },
          "components": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "ver": {
            "type": "integer"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "path": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "title"
            ]
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "projectID",
          "productID",
          "ID",
          "ord",
          "title",
          "desc",
          "components",
          "ver",
          "updTS",
          "updUID"
        ],
        "title": "Module",
        "description": "Entity `Module` (table: Module )"
      },
      "IModule": {
        "$ref": "#/components/schemas/Module"
      },
      "Component": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "ver": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "desc": {
            "type": "string"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "projectID",
          "productID",
          "ID",
          "ver",
          "title",
          "desc",
          "updTS",
          "updUID"
        ],
        "title": "Component",
        "description": "Entity `Component` (table: Component )"
      },
      "IComponent": {
        "$ref": "#/components/schemas/Component"
      },
      "Task": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "state": {
            "$ref": "#/components/schemas/TaskState"
          },
          "category": {
            "$ref": "#/components/schemas/TaskCategory"
          },
          "type": {
            "$ref": "#/components/schemas/TaskType"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "urgently": {
            "type": [
              "integer",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "searchTitle": {
            "type": "string"
          },
          "key": {
            "type": "integer"
          },
          "currentAssignee": {
            "type": "string"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "spec": {
            "type": "string"
          },
          "gist": {
            "type": [
              "string",
              "null"
            ]
          },
          "modules": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "components": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "approvalAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "workAssignee": {
            "type": "string"
          },
          "workIterationKey": {
            "type": [
              "integer",
              "null"
            ]
          },
          "workTimePlan": {
            "type": [
              "integer",
              "null"
            ]
          },
          "workEvaluation": {
            "type": [
              "number",
              "null"
            ]
          },
          "reviewAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "testAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolutionVersionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "resolutionType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskResolutionType"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "git": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "creatorUID": {
            "type": "string",
            "format": "uuid"
          },
          "stage": {
            "$ref": "#/components/schemas/TaskStageType"
          },
          "browser": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskBrowser"
              },
              {
                "type": "null"
              }
            ]
          },
          "bugType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskBugType"
              },
              {
                "type": "null"
              }
            ]
          },
          "build": {
            "type": [
              "string",
              "null"
            ]
          },
          "devices": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "labels": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "fuzzy": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updUID": {
            "type": "string"
          },
          "rejectUID": {
            "type": [
              "string",
              "null"
            ]
          },
          "rejectTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        },
        "required": [
          "cID",
          "projectID",
          "productID",
          "ID",
          "status",
          "state",
          "category",
          "type",
          "priority",
          "title",
          "searchTitle",
          "key",
          "currentAssignee",
          "ord",
          "spec",
          "workAssignee",
          "createDT",
          "creatorUID",
          "stage",
          "updTS",
          "updUID"
        ],
        "title": "Task",
        "description": "Entity `Task` (table: Task )"
      },
      "ITask": {
        "$ref": "#/components/schemas/Task"
      },
      "UserRole": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/UserRole_Type"
          },
          "level": {
            "$ref": "#/components/schemas/UserRole_Level"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "award": {
            "type": "integer"
          },
          "salary": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "startDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "trialEndDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "note": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "isMain": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "userID",
          "cID",
          "type",
          "level",
          "award",
          "salary",
          "total",
          "startDK",
          "updTS",
          "updUID"
        ],
        "title": "UserRole",
        "description": "Entity `UserRole` (table: UserRole )"
      },
      "IUserRole": {
        "$ref": "#/components/schemas/UserRole"
      },
      "WorkLog": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "taskID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "meetingID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "category": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskCategory"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "sessID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "roleID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "roleType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserRole_Type"
              },
              {
                "type": "null"
              }
            ]
          },
          "iterationKey": {
            "type": "integer"
          },
          "isActive": {
            "type": "boolean"
          },
          "daykey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "startDt": {
            "type": "string",
            "format": "date-time"
          },
          "endDt": {
            "type": "string",
            "format": "date-time"
          },
          "time": {
            "type": "integer"
          },
          "money": {
            "type": "integer"
          },
          "moneySalary": {
            "type": "integer"
          },
          "moneyAward": {
            "type": "integer"
          },
          "note": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "sessID",
          "userID",
          "iterationKey",
          "isActive",
          "daykey",
          "startDt",
          "endDt",
          "time",
          "money",
          "moneySalary",
          "moneyAward",
          "updTS",
          "updUID"
        ],
        "title": "WorkLog",
        "description": "Entity `WorkLog` (table: WorkLog )"
      },
      "IWorkLog": {
        "$ref": "#/components/schemas/WorkLog"
      },
      "TaskIterationState": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "snapshotTargetID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "state": {
            "$ref": "#/components/schemas/TaskState"
          },
          "category": {
            "$ref": "#/components/schemas/TaskCategory"
          },
          "type": {
            "$ref": "#/components/schemas/TaskType"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "key": {
            "type": "string"
          },
          "currentAssignee": {
            "type": "string"
          },
          "approvalAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "workAssignee": {
            "type": "string"
          },
          "reviewAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "testAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "workTimePlan": {
            "type": [
              "integer",
              "null"
            ]
          },
          "creatorUID": {
            "type": "string",
            "format": "uuid"
          },
          "bugType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskBugType"
              },
              {
                "type": "null"
              }
            ]
          },
          "workIterationKey": {
            "type": [
              "integer",
              "null"
            ]
          },
          "updUID": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "snapshotCreateDT": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "cID",
          "projectID",
          "productID",
          "snapshotTargetID",
          "ID",
          "title",
          "ord",
          "status",
          "state",
          "category",
          "type",
          "priority",
          "key",
          "currentAssignee",
          "workAssignee",
          "creatorUID",
          "updUID",
          "updTS",
          "snapshotCreateDT"
        ],
        "title": "TaskIterationState",
        "description": "Entity `TaskIterationState` (table: TaskIterationState )"
      },
      "ITaskIterationState": {
        "$ref": "#/components/schemas/TaskIterationState"
      },
      "EntityRelation": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "fromID": {
            "type": "string",
            "format": "uuid"
          },
          "fromType": {
            "type": "string"
          },
          "toID": {
            "type": "string",
            "format": "uuid"
          },
          "toType": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/RelationType",
            "default": "related"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "ID",
          "fromID",
          "fromType",
          "toID",
          "toType",
          "updTS",
          "updUID"
        ],
        "title": "EntityRelation",
        "description": "Entity `EntityRelation` (table: EntityRelation )"
      },
      "IEntityRelation": {
        "$ref": "#/components/schemas/EntityRelation"
      },
      "Company": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "foundationDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultMarginPercent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000
          },
          "demoSet": {
            "type": [
              "string",
              "null"
            ]
          },
          "testSlot": {
            "type": [
              "integer",
              "null"
            ]
          },
          "agentPrices": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "docs": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "INN": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other1": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other2": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "requisites": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          },
          "timeZone": {
            "type": "string",
            "default": "Europe/Moscow"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "activityType": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "activityDescription": {
            "type": [
              "string",
              "null"
            ]
          },
          "titleHash": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "title",
          "phone",
          "email",
          "url",
          "description",
          "address",
          "titleHash",
          "updTS",
          "updUID",
          "createDT",
          "createUID"
        ],
        "title": "Company",
        "description": "Entity `Company` (table: Company )"
      },
      "ICompany": {
        "$ref": "#/components/schemas/Company"
      },
      "CompanyDictionary": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "accessType": {
            "$ref": "#/components/schemas/AccessType"
          },
          "key": {
            "type": "string"
          },
          "items": {
            "type": "object",
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "cID",
          "accessType",
          "key",
          "items",
          "updTS",
          "updUID"
        ],
        "title": "CompanyDictionary",
        "description": "Entity `CompanyDictionary` (table: CompanyDictionary )"
      },
      "ICompanyDictionary": {
        "$ref": "#/components/schemas/CompanyDictionary"
      },
      "UserAccess": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "accessType": {
            "$ref": "#/components/schemas/AccessType"
          },
          "status": {
            "type": "string"
          },
          "statusDT": {
            "type": "string",
            "format": "date-time"
          },
          "statusUID": {
            "type": "string"
          },
          "hasActiveRole": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "allProductAccess": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "rolesStartDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "employment": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isOwner": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "params": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "productAccess": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds"
            }
          },
          "marginPercent": {
            "type": [
              "integer",
              "null"
            ]
          },
          "roles": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "department": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allowsSchemes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allows": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allowsTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "cID",
          "userID",
          "accessType",
          "status",
          "statusDT",
          "statusUID",
          "isOwner",
          "updTS",
          "updUID"
        ],
        "title": "UserAccess",
        "description": "Entity `UserAccess` (table: UserAccess )"
      },
      "IUserAccess": {
        "$ref": "#/components/schemas/UserAccess"
      },
      "UserActivityLogs": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "dt": {
            "type": "string",
            "format": "date-time"
          },
          "iterationKey": {
            "type": "integer"
          },
          "dayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "monthKey": {
            "type": "integer"
          },
          "session": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "authorID": {
            "type": "string",
            "format": "uuid"
          },
          "apiTokenID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "snapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "resParentID": {
            "type": [
              "string",
              "null"
            ]
          },
          "resID": {
            "type": "string",
            "format": "uuid"
          },
          "resType": {
            "$ref": "#/components/schemas/UserActivityLogs_ResourceType"
          },
          "changes": {
            "type": "object",
            "additionalProperties": true
          },
          "parentLogID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "ID",
          "dt",
          "iterationKey",
          "dayKey",
          "monthKey",
          "authorID",
          "snapshot",
          "resID",
          "resType",
          "changes"
        ],
        "title": "UserActivityLogs",
        "description": "Entity `UserActivityLogs` (table: UserActivityLogs )"
      },
      "IUserActivityLogs": {
        "$ref": "#/components/schemas/UserActivityLogs"
      },
      "Payment": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "paid": {
            "type": "boolean"
          },
          "type": {
            "$ref": "#/components/schemas/Payment_Type"
          },
          "reason": {
            "type": [
              "integer",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "monthDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)",
            "default": 0
          },
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "orderDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "iterationKey": {
            "type": [
              "integer",
              "null"
            ]
          },
          "timeOffID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "timeOffType": {
            "type": [
              "string",
              "null"
            ]
          },
          "startDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "daysCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "amountTotal": {
            "type": "number"
          },
          "amountPaid": {
            "type": "number"
          },
          "changeNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "isAmountChanged": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "isAdditional": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "employmentType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Payment_employmentType"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "paidDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "paidUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "userID",
          "ID",
          "paid",
          "type",
          "amountTotal",
          "amountPaid",
          "createdDT",
          "updTS",
          "updUID"
        ],
        "title": "Payment",
        "description": "Entity `Payment` (table: Payment )"
      },
      "IPayment": {
        "$ref": "#/components/schemas/Payment"
      },
      "PaymentAwardPart": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "monthDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "type": {
            "$ref": "#/components/schemas/PaymentAwardPart_Type"
          },
          "amount": {
            "type": "number"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "percent": {
            "type": [
              "integer",
              "null"
            ]
          },
          "base": {
            "type": [
              "number",
              "null"
            ]
          },
          "resource": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "cID",
          "ID",
          "userID",
          "monthDK",
          "type",
          "amount",
          "createdDT",
          "updTS",
          "updUID"
        ],
        "title": "PaymentAwardPart",
        "description": "Entity `PaymentAwardPart` (table: PaymentAwardPart )"
      },
      "IPaymentAwardPart": {
        "$ref": "#/components/schemas/PaymentAwardPart"
      },
      "UserTimeOff": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "roleID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "paid": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "sickLeaveID": {
            "type": [
              "string",
              "null"
            ]
          },
          "statementFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementOrgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementSentTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "year": {
            "type": "integer"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "daysCount": {
            "type": "integer"
          },
          "startWorkDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "userNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "userAvailable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "adminNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "adminUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "payment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserTimeOff_payment"
              },
              {
                "type": "null"
              }
            ]
          },
          "statement": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "cID",
          "userID",
          "roleID",
          "type",
          "year",
          "startDayKey",
          "daysCount",
          "status",
          "updTS",
          "updUID"
        ],
        "title": "UserTimeOff",
        "description": "Entity `UserTimeOff` (table: UserTimeOff )"
      },
      "IUserTimeOff": {
        "$ref": "#/components/schemas/UserTimeOff"
      },
      "GitCommit": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "integrationID": {
            "type": "string",
            "format": "uuid"
          },
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "sourceId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "sha": {
            "type": "string"
          },
          "sourceUrl": {
            "type": "string"
          },
          "comments": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "authorGitUID": {
            "type": "string"
          },
          "authorName": {
            "type": "string"
          },
          "authorEmail": {
            "type": "string"
          },
          "dt": {
            "type": "string",
            "format": "date-time"
          },
          "meta": {
            "type": "object",
            "additionalProperties": true
          },
          "taskKeys": {
            "type": "array",
            "items": {}
          },
          "branches": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "changedPaths": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "changedLines": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "changed": {
            "type": "object",
            "additionalProperties": true
          },
          "lockStateDT": {
            "type": "string",
            "format": "date-time"
          },
          "lockState": {
            "$ref": "#/components/schemas/Notification_lockState"
          },
          "isDraft": {
            "type": "boolean"
          },
          "syncDT": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "cID",
          "integrationID",
          "repositoryID",
          "ID",
          "sourceId",
          "title",
          "message",
          "sha",
          "sourceUrl",
          "authorGitUID",
          "authorName",
          "authorEmail",
          "dt",
          "meta",
          "taskKeys",
          "changed",
          "lockStateDT",
          "lockState",
          "isDraft",
          "syncDT"
        ],
        "title": "GitCommit",
        "description": "Entity `GitCommit` (table: GitCommit )"
      },
      "IGitCommit": {
        "$ref": "#/components/schemas/GitCommit"
      },
      "GitCommitTask": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "taskID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ]
          },
          "authorGitUID": {
            "type": "string"
          },
          "commitID": {
            "type": "string",
            "format": "uuid"
          },
          "integrationID": {
            "type": "string",
            "format": "uuid"
          },
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          },
          "linkType": {
            "$ref": "#/components/schemas/GitCommitTaskLink_Type"
          }
        },
        "required": [
          "ID",
          "cID",
          "productID",
          "taskID",
          "authorGitUID",
          "commitID",
          "integrationID",
          "repositoryID",
          "linkType"
        ],
        "title": "GitCommitTask",
        "description": "Entity `GitCommitTask` (table: GitCommitTask )"
      },
      "IGitCommitTask": {
        "$ref": "#/components/schemas/GitCommitTask"
      },
      "GitIntegration": {
        "type": "object",
        "properties": {
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/GitIntegration_Type"
          },
          "status": {
            "$ref": "#/components/schemas/GitIntegration_Status",
            "default": 1
          },
          "title": {
            "type": "string"
          },
          "webHookSecret": {
            "type": [
              "string",
              "null"
            ]
          },
          "webHookSecretHash": {
            "type": [
              "string",
              "null"
            ]
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          },
          "hookId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "users": {
            "type": "object",
            "additionalProperties": true
          },
          "autoProvisionUsers": {
            "type": "boolean"
          },
          "isAdmin": {
            "type": "boolean",
            "default": false
          },
          "adminActions": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "installationId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "syncDT": {
            "type": "string",
            "format": "date-time"
          },
          "syncTimeout": {
            "type": "integer"
          },
          "syncLogs": {
            "type": "array",
            "items": {}
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "isDraft": {
            "type": "boolean"
          },
          "lockStateDT": {
            "type": "string",
            "format": "date-time"
          },
          "lockState": {
            "$ref": "#/components/schemas/Notification_lockState"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "type",
          "title",
          "params",
          "users",
          "autoProvisionUsers",
          "syncDT",
          "syncTimeout",
          "syncLogs",
          "createdDT",
          "createdUID",
          "isDraft",
          "lockStateDT",
          "lockState",
          "updTS",
          "updUID"
        ],
        "title": "GitIntegration",
        "description": "Entity `GitIntegration` (table: GitIntegration )"
      },
      "IGitIntegration": {
        "$ref": "#/components/schemas/GitIntegration"
      },
      "GitIntegrationUser": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "integrationID": {
            "type": "string",
            "format": "uuid"
          },
          "gitUID": {
            "type": "string"
          },
          "uID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "fullName": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "login": {
            "type": [
              "string",
              "null"
            ]
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "isManual": {
            "type": "boolean",
            "default": false
          },
          "state": {
            "$ref": "#/components/schemas/GitIntegrationUser_State",
            "default": "employee"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "cID",
          "integrationID",
          "gitUID",
          "fullName",
          "updTS"
        ],
        "title": "GitIntegrationUser",
        "description": "Entity `GitIntegrationUser` (table: GitIntegrationUser )"
      },
      "IGitIntegrationUser": {
        "$ref": "#/components/schemas/GitIntegrationUser"
      },
      "GitRepository": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "integrationID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "sourceId": {
            "type": "string"
          },
          "namespace": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/GitIntegration_Status",
            "default": 1
          },
          "meta": {
            "type": "object",
            "additionalProperties": true
          },
          "commitsCount": {
            "type": "integer"
          },
          "hookId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "sourceUrl": {
            "type": "string"
          },
          "syncDT": {
            "type": "string",
            "format": "date-time"
          },
          "commitsSyncDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "syncLogs": {
            "type": "array",
            "items": {}
          },
          "passport": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "cID",
          "integrationID",
          "ID",
          "sourceId",
          "namespace",
          "name",
          "meta",
          "commitsCount",
          "sourceUrl",
          "syncDT",
          "syncLogs"
        ],
        "title": "GitRepository",
        "description": "Entity `GitRepository` (table: GitRepository )"
      },
      "IGitRepository": {
        "$ref": "#/components/schemas/GitRepository"
      },
      "MeetingIntegration": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/MeetingIntegration_Status",
            "default": 1
          },
          "type": {
            "$ref": "#/components/schemas/MeetingIntegration_type"
          },
          "account": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "accountId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "planType": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "email"
            ]
          },
          "credentials": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "accessToken": {
                "type": "string"
              },
              "refreshToken": {
                "type": "string"
              },
              "expirationTimeIso": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "syncTimeout": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "accessToken",
              "refreshToken",
              "expirationTimeIso",
              "scopes"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MeetingIntegration_ErrorCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "cID",
          "type",
          "createdDT",
          "createdUID",
          "updTS",
          "updUID"
        ],
        "title": "MeetingIntegration",
        "description": "Entity `MeetingIntegration` (table: MeetingIntegration )"
      },
      "IMeetingIntegration": {
        "$ref": "#/components/schemas/MeetingIntegration"
      },
      "MeetingIntegrationTask": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "meetingID": {
            "type": "string",
            "format": "uuid"
          },
          "integrationID": {
            "type": "string",
            "format": "uuid"
          },
          "externalFileID": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/MeetingIntegrationTask_Type"
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "downloadUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "playUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "password": {
            "type": [
              "string",
              "null"
            ]
          },
          "storedFileID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "lockStateDT": {
            "type": "string",
            "format": "date-time"
          },
          "lockState": {
            "$ref": "#/components/schemas/Notification_lockState"
          },
          "attempts": {
            "type": "integer"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "completedDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "ID",
          "cID",
          "meetingID",
          "integrationID",
          "externalFileID",
          "type",
          "lockStateDT",
          "lockState",
          "attempts",
          "createdDT"
        ],
        "title": "MeetingIntegrationTask",
        "description": "Entity `MeetingIntegrationTask` (table: MeetingIntegrationTask )"
      },
      "IMeetingIntegrationTask": {
        "$ref": "#/components/schemas/MeetingIntegrationTask"
      },
      "Design": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/Design_type"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "string"
          },
          "lastModified": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/Design_status"
          },
          "snapshotFID": {
            "type": "string",
            "format": "uuid"
          },
          "contextFID": {
            "type": "string",
            "format": "uuid"
          },
          "assetsFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "snapshotSize": {
            "type": [
              "integer",
              "null"
            ]
          },
          "contextSize": {
            "type": [
              "integer",
              "null"
            ]
          },
          "assetsSize": {
            "type": [
              "integer",
              "null"
            ]
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "integrationID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "fileKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "pageID": {
            "type": [
              "string",
              "null"
            ]
          },
          "pageName": {
            "type": [
              "string",
              "null"
            ]
          },
          "nodeID": {
            "type": [
              "string",
              "null"
            ]
          },
          "nodeType": {
            "type": [
              "string",
              "null"
            ]
          },
          "nodeUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "nodeName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "createdTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "cID",
          "type",
          "version",
          "status",
          "snapshotFID",
          "contextFID",
          "width",
          "height",
          "createdUID",
          "createdTS",
          "updTS",
          "updUID"
        ],
        "title": "Design",
        "description": "Entity `Design` (table: Design )"
      },
      "IDesign": {
        "$ref": "#/components/schemas/Design"
      },
      "DesignRef": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "designID": {
            "type": "string",
            "format": "uuid"
          },
          "entityID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID",
          "cID",
          "designID",
          "entityID"
        ],
        "title": "DesignRef",
        "description": "Entity `DesignRef` (table: DesignRef )"
      },
      "IDesignRef": {
        "$ref": "#/components/schemas/DesignRef"
      },
      "HolidayGreeting": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/HolidayGreeting_Type"
          },
          "dayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "messageID": {
            "type": "string",
            "format": "uuid"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "cID",
          "ID",
          "type",
          "dayKey",
          "messageID",
          "createDT"
        ],
        "title": "HolidayGreeting",
        "description": "Entity `HolidayGreeting` (table: HolidayGreeting )"
      },
      "IHolidayGreeting": {
        "$ref": "#/components/schemas/HolidayGreeting"
      },
      "BirthdayGreeting": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "dayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "messageID": {
            "type": "string",
            "format": "uuid"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "cID",
          "ID",
          "userID",
          "dayKey",
          "messageID",
          "createDT"
        ],
        "title": "BirthdayGreeting",
        "description": "Entity `BirthdayGreeting` (table: BirthdayGreeting )"
      },
      "IBirthdayGreeting": {
        "$ref": "#/components/schemas/BirthdayGreeting"
      },
      "AgentMemory": {
        "type": "object",
        "properties": {
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "level": {
            "$ref": "#/components/schemas/AgentMemory_Level"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "repositoryID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "load": {
            "$ref": "#/components/schemas/AgentMemory_Load",
            "default": "request"
          },
          "jobs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentMemory_Job"
            },
            "default": []
          },
          "title": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "shared": {
            "type": "boolean",
            "default": false
          },
          "verified": {
            "type": "boolean",
            "default": false
          },
          "deliveredCount": {
            "type": "integer",
            "default": 0
          },
          "readCount": {
            "type": "integer",
            "default": 0
          },
          "lastUsedDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "authorUID": {
            "type": "string",
            "format": "uuid"
          },
          "apiTokenID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "verifiedUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "verifiedDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updUID": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "level",
          "title",
          "text",
          "authorUID",
          "createDT",
          "updUID",
          "version"
        ],
        "title": "AgentMemory",
        "description": "Entity `AgentMemory` (table: AgentMemory )"
      },
      "IAgentMemory": {
        "$ref": "#/components/schemas/AgentMemory"
      },
      "AgentSessionRun": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "taskID": {
            "type": "string",
            "format": "uuid"
          },
          "taskStatus": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "apiTokenID": {
            "type": "string",
            "format": "uuid"
          },
          "agentSessionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "runKey": {
            "type": "string"
          },
          "agentVendor": {
            "type": "string"
          },
          "agentApp": {
            "type": "string"
          },
          "agentVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "agentModel": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "additionalProperties": true
          },
          "limits": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "cost": {
            "type": [
              "number",
              "null"
            ]
          },
          "accuracy": {
            "type": "number"
          },
          "mcps": {
            "type": "object",
            "additionalProperties": true
          },
          "subagents": {
            "type": "array",
            "items": {},
            "default": []
          },
          "ms": {
            "type": "number"
          },
          "startDT": {
            "type": "string",
            "format": "date-time"
          },
          "finishDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "start": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "cID",
          "ID",
          "projectID",
          "productID",
          "taskID",
          "taskStatus",
          "userID",
          "apiTokenID",
          "runKey",
          "agentVendor",
          "agentApp",
          "agentModel",
          "usage",
          "accuracy",
          "mcps",
          "ms",
          "startDT"
        ],
        "title": "AgentSessionRun",
        "description": "Entity `AgentSessionRun` (table: AgentSessionRun )"
      },
      "IAgentSessionRun": {
        "$ref": "#/components/schemas/AgentSessionRun"
      },
      "LLMFunctionConnection": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "costFactor": {
            "type": [
              "number",
              "null"
            ]
          },
          "launch": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LLMFunctionConnection_launch"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastUsedTs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "key",
          "cID",
          "createdDT",
          "updTS",
          "updUID"
        ],
        "title": "LLMFunctionConnection",
        "description": "Entity `LLMFunctionConnection` (table: LLMFunctionConnection )"
      },
      "ILLMFunctionConnection": {
        "$ref": "#/components/schemas/LLMFunctionConnection"
      },
      "LLMCall": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "providerModel": {
            "type": [
              "string",
              "null"
            ]
          },
          "runID": {
            "type": "string",
            "format": "uuid"
          },
          "entityType": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "inputTokens": {
            "type": "integer",
            "default": 0
          },
          "cachedTokens": {
            "type": "integer",
            "default": 0
          },
          "outputTokens": {
            "type": "integer",
            "default": 0
          },
          "reasoningTokens": {
            "type": "integer",
            "default": 0
          },
          "cost": {
            "type": "number",
            "default": 0
          },
          "costFactor": {
            "type": "number",
            "default": 1
          },
          "price": {
            "type": "number",
            "default": 0
          },
          "durationMs": {
            "type": "integer",
            "default": 0
          },
          "status": {
            "$ref": "#/components/schemas/LLMCall_Status"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LLMCall_Outcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "outcomeDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "ID",
          "cID",
          "key",
          "model",
          "runID",
          "status",
          "createDT"
        ],
        "title": "LLMCall",
        "description": "Entity `LLMCall` (table: LLMCall )"
      },
      "ILLMCall": {
        "$ref": "#/components/schemas/LLMCall"
      },
      "FigmaIntegration": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/MeetingIntegration_Status",
            "default": 1
          },
          "account": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "handle": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id"
            ]
          },
          "credentials": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "accessToken": {
                "type": "string"
              },
              "refreshToken": {
                "type": "string"
              },
              "expirationTimeIso": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "accessToken",
              "refreshToken",
              "expirationTimeIso",
              "scopes"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FigmaIntegration_ErrorCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "cID",
          "createdDT",
          "createdUID",
          "updTS",
          "updUID"
        ],
        "title": "FigmaIntegration",
        "description": "Entity `FigmaIntegration` (table: FigmaIntegration )"
      },
      "IFigmaIntegration": {
        "$ref": "#/components/schemas/FigmaIntegration"
      },
      "SSEMessageEvent": {
        "type": "string",
        "enum": [
          "onConnect",
          "reconnect",
          "session-user",
          "company-state",
          "work-state",
          "notification",
          "team",
          "chat-state",
          "chat-message",
          "chat-member",
          "design-progress",
          "allows"
        ],
        "x-enum-varnames": [
          "onConnect",
          "reconnect",
          "currentUser",
          "companyState",
          "workState",
          "notification",
          "team",
          "chatState",
          "chatMessage",
          "chatMember",
          "designProgress",
          "allows"
        ],
        "title": "SSEMessageEvent",
        "description": "`onConnect` = \"onConnect\", `reconnect` = \"reconnect\", `currentUser` = \"session-user\", `companyState` = \"company-state\", `workState` = \"work-state\", `notification` = \"notification\", `team` = \"team\", `chatState` = \"chat-state\", `chatMessage` = \"chat-message\", `chatMember` = \"chat-member\", `designProgress` = \"design-progress\", `allows` = \"allows\""
      },
      "SystemEntityType": {
        "type": "string",
        "enum": [
          "project",
          "product",
          "module",
          "component",
          "version",
          "feature",
          "task",
          "bug",
          "meeting"
        ],
        "x-enum-varnames": [
          "project",
          "product",
          "module",
          "component",
          "version",
          "feature",
          "task",
          "bug",
          "meeting"
        ],
        "title": "SystemEntityType",
        "description": "`project` = \"project\", `product` = \"product\", `module` = \"module\", `component` = \"component\", `version` = \"version\", `feature` = \"feature\", `task` = \"task\", `bug` = \"bug\", `meeting` = \"meeting\""
      },
      "User_Provider": {
        "type": "string",
        "enum": [
          "vkid",
          "yandex"
        ],
        "x-enum-varnames": [
          "vkid",
          "yandex"
        ],
        "title": "User_Provider",
        "description": "`vkid` = \"vkid\", `yandex` = \"yandex\""
      },
      "Meeting_Type": {
        "type": "string",
        "enum": [
          "vk",
          "zoom",
          "yandex",
          "google",
          "ok",
          "offline",
          "online"
        ],
        "x-enum-varnames": [
          "vk",
          "zoom",
          "yandex",
          "google",
          "ok",
          "offline",
          "online"
        ],
        "title": "Meeting_Type",
        "description": "`vk` = \"vk\", `zoom` = \"zoom\", `yandex` = \"yandex\", `google` = \"google\", `ok` = \"ok\", `offline` = \"offline\", `online` = \"online\""
      },
      "AuthSignInCode_Status": {
        "type": "integer",
        "enum": [
          0,
          1,
          -1
        ],
        "x-enum-varnames": [
          "wait",
          "sended",
          "error"
        ],
        "title": "AuthSignInCode_Status",
        "description": "`wait` = 0, `sended` = 1, `error` = -1"
      },
      "AuthSignInCode_Purpose": {
        "type": "string",
        "enum": [
          "signin",
          "contact"
        ],
        "x-enum-varnames": [
          "signin",
          "contact"
        ],
        "title": "AuthSignInCode_Purpose",
        "description": "`signin` = \"signin\", `contact` = \"contact\""
      },
      "OauthLoginSession_Decision": {
        "type": "string",
        "enum": [
          "allow",
          "deny"
        ],
        "x-enum-varnames": [
          "allow",
          "deny"
        ],
        "title": "OauthLoginSession_Decision",
        "description": "`allow` = \"allow\", `deny` = \"deny\""
      },
      "Currency_Code": {
        "type": "string",
        "enum": [
          "RUB",
          "USD",
          "EUR",
          "CNY"
        ],
        "x-enum-varnames": [
          "RUB",
          "USD",
          "EUR",
          "CNY"
        ],
        "title": "Currency_Code",
        "description": "`RUB` = \"RUB\", `USD` = \"USD\", `EUR` = \"EUR\", `CNY` = \"CNY\""
      },
      "DemoRun_Command": {
        "type": "string",
        "enum": [
          "init",
          "generate"
        ],
        "x-enum-varnames": [
          "init",
          "generate"
        ],
        "title": "DemoRun_Command",
        "description": "`init` = \"init\", `generate` = \"generate\""
      },
      "DemoRun_Status": {
        "type": "string",
        "enum": [
          "queued",
          "running",
          "done",
          "error",
          "stopped"
        ],
        "x-enum-varnames": [
          "queued",
          "running",
          "done",
          "error",
          "stopped"
        ],
        "title": "DemoRun_Status",
        "description": "`queued` = \"queued\", `running` = \"running\", `done` = \"done\", `error` = \"error\", `stopped` = \"stopped\""
      },
      "DemoRun_Source": {
        "type": "string",
        "enum": [
          "cli",
          "console",
          "schedule"
        ],
        "x-enum-varnames": [
          "cli",
          "console",
          "schedule"
        ],
        "title": "DemoRun_Source",
        "description": "`cli` = \"cli\", `console` = \"console\", `schedule` = \"schedule\""
      },
      "Notification_ActionType": {
        "type": "string",
        "enum": [
          "new",
          "deleted",
          "task_current_assignee_changed",
          "task_unblocked",
          "task_time_estimated",
          "task_work_evaluated",
          "repository_passport",
          "meeting_reminder_started",
          "meeting_reminder_1h",
          "meeting_reminder_15m",
          "meeting_participant_declined",
          "meeting_reminder_ending",
          "meeting_participant_invite",
          "accepted_vacation",
          "declined_vacation",
          "close_sick",
          "worklogs_changed",
          "reaction",
          "product_access_granted",
          "product_access_revoked",
          "privileges_changed"
        ],
        "x-enum-varnames": [
          "New",
          "Deleted",
          "TaskCurrentAssigneeChanged",
          "TaskUnblocked",
          "TaskTimeEstimated",
          "TaskWorkEvaluated",
          "RepositoryPassport",
          "MeetingReminderStarted",
          "MeetingReminder1H",
          "MeetingReminder15M",
          "MeetingParticipantDeclined",
          "MeetingReminderEnding",
          "MeetingParticipantInvite",
          "AcceptedVacation",
          "DeclinedVacation",
          "CloseSick",
          "WorklogsChanged",
          "Reaction",
          "ProductAccessGranted",
          "ProductAccessRevoked",
          "PrivilegesChanged"
        ],
        "title": "Notification_ActionType",
        "description": "`New` = \"new\", `Deleted` = \"deleted\", `TaskCurrentAssigneeChanged` = \"task_current_assignee_changed\", `TaskUnblocked` = \"task_unblocked\", `TaskTimeEstimated` = \"task_time_estimated\", `TaskWorkEvaluated` = \"task_work_evaluated\", `RepositoryPassport` = \"repository_passport\", `MeetingReminderStarted` = \"meeting_reminder_started\", `MeetingReminder1H` = \"meeting_reminder_1h\", `MeetingReminder15M` = \"meeting_reminder_15m\", `MeetingParticipantDeclined` = \"meeting_participant_declined\", `MeetingReminderEnding` = \"meeting_reminder_ending\", `MeetingParticipantInvite` = \"meeting_participant_invite\", `AcceptedVacation` = \"accepted_vacation\", `DeclinedVacation` = \"declined_vacation\", `CloseSick` = \"close_sick\", `WorklogsChanged` = \"worklogs_changed\", `Reaction` = \"reaction\", `ProductAccessGranted` = \"product_access_granted\", `ProductAccessRevoked` = \"product_access_revoked\", `PrivilegesChanged` = \"privileges_changed\""
      },
      "Notification_ResType": {
        "type": "string",
        "enum": [
          "task",
          "Task",
          "product",
          "Product",
          "meeting",
          "Meeting",
          "session",
          "userrole",
          "usertimeoff",
          "worklogs",
          "chatMessage",
          "agentMemory",
          "privileges",
          "gitRepository"
        ],
        "x-enum-varnames": [
          "Task",
          "task",
          "Product",
          "product",
          "Meeting",
          "meeting",
          "Session",
          "UserRole",
          "UserTimeOff",
          "Worklogs",
          "ChatMessage",
          "AgentMemory",
          "Privileges",
          "GitRepository"
        ],
        "title": "Notification_ResType",
        "description": "`Task` = \"task\", `task` = \"Task\", `Product` = \"product\", `product` = \"Product\", `Meeting` = \"meeting\", `meeting` = \"Meeting\", `Session` = \"session\", `UserRole` = \"userrole\", `UserTimeOff` = \"usertimeoff\", `Worklogs` = \"worklogs\", `ChatMessage` = \"chatMessage\", `AgentMemory` = \"agentMemory\", `Privileges` = \"privileges\", `GitRepository` = \"gitRepository\""
      },
      "FileRelation_EntityType": {
        "type": "string",
        "enum": [
          "user",
          "userAccess",
          "company",
          "project",
          "product",
          "version",
          "chat",
          "chatMessage",
          "meeting",
          "task",
          "feature",
          "design",
          "userTimeOff"
        ],
        "x-enum-varnames": [
          "user",
          "userAccess",
          "company",
          "project",
          "product",
          "version",
          "chat",
          "chatMessage",
          "meeting",
          "task",
          "feature",
          "design",
          "userTimeOff"
        ],
        "title": "FileRelation_EntityType",
        "description": "`user` = \"user\", `userAccess` = \"userAccess\", `company` = \"company\", `project` = \"project\", `product` = \"product\", `version` = \"version\", `chat` = \"chat\", `chatMessage` = \"chatMessage\", `meeting` = \"meeting\", `task` = \"task\", `feature` = \"feature\", `design` = \"design\", `userTimeOff` = \"userTimeOff\""
      },
      "FileRelation_FieldType": {
        "type": "string",
        "enum": [
          "avatar",
          "logo",
          "passport",
          "document",
          "attachment",
          "spec",
          "result",
          "notes",
          "agenda",
          "summary",
          "transcript",
          "resolution",
          "snapshot",
          "context",
          "assets",
          "statement"
        ],
        "x-enum-varnames": [
          "avatar",
          "logo",
          "passport",
          "document",
          "attachment",
          "spec",
          "result",
          "notes",
          "agenda",
          "summary",
          "transcript",
          "resolution",
          "snapshot",
          "context",
          "assets",
          "statement"
        ],
        "title": "FileRelation_FieldType",
        "description": "`avatar` = \"avatar\", `logo` = \"logo\", `passport` = \"passport\", `document` = \"document\", `attachment` = \"attachment\", `spec` = \"spec\", `result` = \"result\", `notes` = \"notes\", `agenda` = \"agenda\", `summary` = \"summary\", `transcript` = \"transcript\", `resolution` = \"resolution\", `snapshot` = \"snapshot\", `context` = \"context\", `assets` = \"assets\", `statement` = \"statement\""
      },
      "EntityType": {
        "type": "string",
        "enum": [
          "project",
          "product",
          "module",
          "component",
          "version",
          "feature",
          "task",
          "bug"
        ],
        "x-enum-varnames": [
          "project",
          "product",
          "module",
          "component",
          "version",
          "feature",
          "task",
          "bug"
        ],
        "title": "EntityType",
        "description": "`project` = \"project\", `product` = \"product\", `module` = \"module\", `component` = \"component\", `version` = \"version\", `feature` = \"feature\", `task` = \"task\", `bug` = \"bug\""
      },
      "Chat_Type": {
        "type": "string",
        "enum": [
          "public",
          "private",
          "direct",
          "company",
          "meeting"
        ],
        "x-enum-varnames": [
          "public",
          "private",
          "direct",
          "company",
          "meeting"
        ],
        "title": "Chat_Type",
        "description": "`public` = \"public\", `private` = \"private\", `direct` = \"direct\", `company` = \"company\", `meeting` = \"meeting\""
      },
      "ChatMessage_AuthorType": {
        "type": "string",
        "enum": [
          "user",
          "agent",
          "system"
        ],
        "x-enum-varnames": [
          "User",
          "Agent",
          "System"
        ],
        "title": "ChatMessage_AuthorType",
        "description": "`User` = \"user\", `Agent` = \"agent\", `System` = \"system\""
      },
      "ChatMessage_Type": {
        "type": "string",
        "enum": [
          "regular",
          "event",
          "template"
        ],
        "x-enum-varnames": [
          "Regular",
          "Event",
          "Template"
        ],
        "title": "ChatMessage_Type",
        "description": "`Regular` = \"regular\", `Event` = \"event\", `Template` = \"template\""
      },
      "ChatMessage_REACTIONS": {
        "type": "string",
        "enum": [
          "thumbs-up",
          "thumbs-down",
          "ok",
          "handshake",
          "hands-folded",
          "100p",
          "face-smile",
          "face-lol",
          "face-thinking",
          "face-grimacing",
          "face-screaming",
          "face-angry",
          "fire",
          "eyes",
          "call",
          "lady-bug",
          "crutch",
          "no-bicycles"
        ],
        "x-enum-varnames": [
          "thumbs-up",
          "thumbs-down",
          "ok",
          "handshake",
          "hands-folded",
          "100p",
          "face-smile",
          "face-lol",
          "face-thinking",
          "face-grimacing",
          "face-screaming",
          "face-angry",
          "fire",
          "eyes",
          "call",
          "lady-bug",
          "crutch",
          "no-bicycles"
        ],
        "title": "ChatMessage_REACTIONS",
        "description": "`thumbs-up` = \"thumbs-up\", `thumbs-down` = \"thumbs-down\", `ok` = \"ok\", `handshake` = \"handshake\", `hands-folded` = \"hands-folded\", `100p` = \"100p\", `face-smile` = \"face-smile\", `face-lol` = \"face-lol\", `face-thinking` = \"face-thinking\", `face-grimacing` = \"face-grimacing\", `face-screaming` = \"face-screaming\", `face-angry` = \"face-angry\", `fire` = \"fire\", `eyes` = \"eyes\", `call` = \"call\", `lady-bug` = \"lady-bug\", `crutch` = \"crutch\", `no-bicycles` = \"no-bicycles\""
      },
      "ChatMessage_SystemEvent": {
        "type": "string",
        "enum": [
          "chat_title_changed",
          "chat_logo_changed",
          "chat_member_added",
          "chat_member_removed",
          "chat_member_joined",
          "chat_member_left"
        ],
        "x-enum-varnames": [
          "ChatTitleChanged",
          "ChatLogoChanged",
          "ChatMemberAdded",
          "ChatMemberRemoved",
          "ChatMemberJoined",
          "ChatMemberLeft"
        ],
        "title": "ChatMessage_SystemEvent",
        "description": "`ChatTitleChanged` = \"chat_title_changed\", `ChatLogoChanged` = \"chat_logo_changed\", `ChatMemberAdded` = \"chat_member_added\", `ChatMemberRemoved` = \"chat_member_removed\", `ChatMemberJoined` = \"chat_member_joined\", `ChatMemberLeft` = \"chat_member_left\""
      },
      "ProjectRepository_AgentAccess": {
        "type": "string",
        "enum": [
          "read",
          "write"
        ],
        "x-enum-varnames": [
          "read",
          "write"
        ],
        "title": "ProjectRepository_AgentAccess",
        "description": "`read` = \"read\", `write` = \"write\""
      },
      "Product_Platform": {
        "type": "integer",
        "enum": [
          10,
          20,
          30,
          40,
          50,
          60
        ],
        "x-enum-varnames": [
          "webApp",
          "backend",
          "website",
          "ios",
          "android",
          "ai"
        ],
        "title": "Product_Platform",
        "description": "`webApp` = 10, `backend` = 20, `website` = 30, `ios` = 40, `android` = 50, `ai` = 60"
      },
      "Feature_Status": {
        "type": "integer",
        "enum": [
          0,
          100,
          200,
          300,
          400
        ],
        "x-enum-varnames": [
          "draft",
          "development",
          "testing",
          "acceptance",
          "done"
        ],
        "title": "Feature_Status",
        "description": "`draft` = 0, `development` = 100, `testing` = 200, `acceptance` = 300, `done` = 400"
      },
      "TaskBrowser": {
        "type": "integer",
        "enum": [
          0,
          10,
          20,
          30,
          40,
          50,
          60
        ],
        "x-enum-varnames": [
          "any",
          "chrome",
          "safari",
          "opera",
          "edge",
          "firefox",
          "yandex"
        ],
        "title": "TaskBrowser",
        "description": "`any` = 0, `chrome` = 10, `safari` = 20, `opera` = 30, `edge` = 40, `firefox` = 50, `yandex` = 60"
      },
      "TaskBugType": {
        "type": "integer",
        "enum": [
          10,
          20,
          30,
          40
        ],
        "x-enum-varnames": [
          "ui",
          "fn",
          "ux",
          "spec"
        ],
        "title": "TaskBugType",
        "description": "`ui` = 10, `fn` = 20, `ux` = 30, `spec` = 40"
      },
      "TaskCategory": {
        "type": "integer",
        "enum": [
          1,
          3,
          6,
          9
        ],
        "x-enum-varnames": [
          "common",
          "dev",
          "qa",
          "bug"
        ],
        "title": "TaskCategory",
        "description": "`common` = 1, `dev` = 3, `qa` = 6, `bug` = 9"
      },
      "TaskPriority": {
        "type": "integer",
        "enum": [
          -10,
          0,
          1,
          10,
          20
        ],
        "x-enum-varnames": [
          "postponed",
          "unset",
          "inOrder",
          "important",
          "urgent"
        ],
        "title": "TaskPriority",
        "description": "`postponed` = -10, `unset` = 0, `inOrder` = 1, `important` = 10, `urgent` = 20"
      },
      "TaskResolutionType": {
        "type": "integer",
        "enum": [
          0,
          1,
          2,
          3,
          4
        ],
        "x-enum-varnames": [
          "resolved",
          "notDoing",
          "notReproducible",
          "notBug",
          "duplicate"
        ],
        "title": "TaskResolutionType",
        "description": "`resolved` = 0, `notDoing` = 1, `notReproducible` = 2, `notBug` = 3, `duplicate` = 4"
      },
      "TaskStageType": {
        "type": "integer",
        "enum": [
          0,
          10,
          20,
          30,
          40,
          100
        ],
        "x-enum-varnames": [
          "dev",
          "alpha",
          "betta",
          "rc",
          "hotfix",
          "prod"
        ],
        "title": "TaskStageType",
        "description": "`dev` = 0, `alpha` = 10, `betta` = 20, `rc` = 30, `hotfix` = 40, `prod` = 100"
      },
      "TaskState": {
        "type": "integer",
        "enum": [
          -1,
          0,
          1,
          10
        ],
        "x-enum-varnames": [
          "waiting",
          "pause",
          "work",
          "closed"
        ],
        "title": "TaskState",
        "description": "`waiting` = -1, `pause` = 0, `work` = 1, `closed` = 10"
      },
      "TaskStatus": {
        "type": "integer",
        "enum": [
          0,
          110,
          120,
          130,
          140,
          150,
          200
        ],
        "x-enum-varnames": [
          "draft",
          "approval",
          "work",
          "review",
          "deployment",
          "testing",
          "closed"
        ],
        "title": "TaskStatus",
        "description": "`draft` = 0, `approval` = 110, `work` = 120, `review` = 130, `deployment` = 140, `testing` = 150, `closed` = 200"
      },
      "TaskTransition": {
        "type": "integer",
        "enum": [
          1,
          2,
          3,
          20,
          30,
          40,
          50,
          60,
          100,
          110,
          120
        ],
        "x-enum-varnames": [
          "work",
          "pause",
          "wait",
          "publish",
          "accept",
          "decline",
          "testing",
          "reject",
          "done",
          "close",
          "reopen"
        ],
        "title": "TaskTransition",
        "description": "`work` = 1, `pause` = 2, `wait` = 3, `publish` = 20, `accept` = 30, `decline` = 40, `testing` = 50, `reject` = 60, `done` = 100, `close` = 110, `reopen` = 120"
      },
      "TaskType": {
        "type": "integer",
        "enum": [
          11,
          12,
          13,
          14,
          15,
          16,
          19,
          31,
          32,
          33,
          34,
          35,
          61,
          62,
          63,
          64,
          91,
          93,
          95,
          97,
          99
        ],
        "x-enum-varnames": [
          "planning",
          "analysis",
          "design",
          "research",
          "education",
          "documentation",
          "other",
          "frontend",
          "backend",
          "devops",
          "tests",
          "fullstack",
          "freetest",
          "smoke",
          "regression",
          "testcase",
          "bug_trivial",
          "bug_minor",
          "bug_major",
          "bug_critical",
          "bug_block"
        ],
        "title": "TaskType",
        "description": "`planning` = 11, `analysis` = 12, `design` = 13, `research` = 14, `education` = 15, `documentation` = 16, `other` = 19, `frontend` = 31, `backend` = 32, `devops` = 33, `tests` = 34, `fullstack` = 35, `freetest` = 61, `smoke` = 62, `regression` = 63, `testcase` = 64, `bug_trivial` = 91, `bug_minor` = 93, `bug_major` = 95, `bug_critical` = 97, `bug_block` = 99"
      },
      "RelationType": {
        "type": "string",
        "enum": [
          "blocker",
          "regression",
          "derived",
          "duplicate",
          "related"
        ],
        "x-enum-varnames": [
          "blocker",
          "regression",
          "derived",
          "duplicate",
          "related"
        ],
        "title": "RelationType",
        "description": "`blocker` = \"blocker\", `regression` = \"regression\", `derived` = \"derived\", `duplicate` = \"duplicate\", `related` = \"related\""
      },
      "Company_QADeviceType": {
        "type": "integer",
        "enum": [
          10,
          20,
          30,
          40,
          50,
          60,
          70
        ],
        "x-enum-varnames": [
          "Mobile",
          "Desktop",
          "Tablet",
          "Console",
          "Tv",
          "Watch",
          "SmartHome"
        ],
        "title": "Company_QADeviceType",
        "description": "`Mobile` = 10, `Desktop` = 20, `Tablet` = 30, `Console` = 40, `Tv` = 50, `Watch` = 60, `SmartHome` = 70"
      },
      "Company_OrganizationType": {
        "type": "string",
        "enum": [
          "ooo",
          "ao",
          "ip"
        ],
        "x-enum-varnames": [
          "ooo",
          "ao",
          "ip"
        ],
        "title": "Company_OrganizationType",
        "description": "`ooo` = \"ooo\", `ao` = \"ao\", `ip` = \"ip\""
      },
      "ADMIN_ONLY_ALLOWS": {
        "type": "string",
        "enum": [
          "user:privileges",
          "company:info"
        ],
        "x-enum-varnames": [
          "user:privileges",
          "company:info"
        ],
        "title": "ADMIN_ONLY_ALLOWS",
        "description": "`user:privileges` = \"user:privileges\", `company:info` = \"company:info\""
      },
      "ADMIN_READ_ANY_ALLOWS": {
        "type": "string",
        "enum": [
          "project:read",
          "project:costs",
          "product:read",
          "product:costs",
          "version:read",
          "version:costs",
          "feature:read",
          "feature:costs",
          "task:read",
          "task:read-drafts",
          "task:worklogs",
          "task:costs",
          "chat:read",
          "meeting:read",
          "meeting:costs",
          "user:read",
          "user:allowed-products",
          "user:activity",
          "company:read",
          "agent:git-read",
          "report:read",
          "report:personal",
          "report:costs"
        ],
        "x-enum-varnames": [
          "project:read",
          "project:costs",
          "product:read",
          "product:costs",
          "version:read",
          "version:costs",
          "feature:read",
          "feature:costs",
          "task:read",
          "task:read-drafts",
          "task:worklogs",
          "task:costs",
          "chat:read",
          "meeting:read",
          "meeting:costs",
          "user:read",
          "user:allowed-products",
          "user:activity",
          "company:read",
          "agent:git-read",
          "report:read",
          "report:personal",
          "report:costs"
        ],
        "title": "ADMIN_READ_ANY_ALLOWS",
        "description": "`project:read` = \"project:read\", `project:costs` = \"project:costs\", `product:read` = \"product:read\", `product:costs` = \"product:costs\", `version:read` = \"version:read\", `version:costs` = \"version:costs\", `feature:read` = \"feature:read\", `feature:costs` = \"feature:costs\", `task:read` = \"task:read\", `task:read-drafts` = \"task:read-drafts\", `task:worklogs` = \"task:worklogs\", `task:costs` = \"task:costs\", `chat:read` = \"chat:read\", `meeting:read` = \"meeting:read\", `meeting:costs` = \"meeting:costs\", `user:read` = \"user:read\", `user:allowed-products` = \"user:allowed-products\", `user:activity` = \"user:activity\", `company:read` = \"company:read\", `agent:git-read` = \"agent:git-read\", `report:read` = \"report:read\", `report:personal` = \"report:personal\", `report:costs` = \"report:costs\""
      },
      "ALLOW_KEYS": {
        "type": "string",
        "enum": [
          "project:read",
          "project:create",
          "project:update",
          "project:delete",
          "project:costs",
          "product:read",
          "product:create",
          "product:update",
          "product:move",
          "product:delete",
          "product:structure",
          "product:costs",
          "version:read",
          "version:create",
          "version:update",
          "version:delete",
          "version:release",
          "version:costs",
          "feature:read",
          "feature:create",
          "feature:update",
          "feature:delete",
          "feature:move",
          "feature:publish",
          "feature:check",
          "feature:test",
          "feature:done",
          "feature:reopen",
          "feature:costs",
          "task:read",
          "task:read-drafts",
          "task:create",
          "task:duplicate",
          "task:update",
          "task:relations",
          "task:worklogs",
          "task:move",
          "task:delete-draft",
          "task:delete",
          "task:publish",
          "task:approve",
          "task:work",
          "task:pause",
          "task:done",
          "task:review",
          "task:test",
          "task:deploy",
          "task:close",
          "task:reopen",
          "task:costs",
          "task:evaluate",
          "task:work-evaluation",
          "worklog:update",
          "worklog:delete",
          "worklog:no-margin",
          "chat:read",
          "chat:create",
          "chat:join",
          "chat:leave",
          "chat:update",
          "chat:delete",
          "chat:admin",
          "chat:message",
          "chat:reaction",
          "chat:message-update",
          "chat:message-delete",
          "meeting:read",
          "meeting:create",
          "meeting:update",
          "meeting:delete",
          "meeting:finish",
          "meeting:invite",
          "meeting:respond",
          "meeting:join",
          "meeting:costs",
          "meeting:rates",
          "user:read",
          "user:update",
          "user:personal",
          "user:documents",
          "user:employment",
          "user:no-margin",
          "user:payments",
          "user:bonus",
          "user:timeoff",
          "user:allowed-products",
          "user:activity",
          "user:sessions",
          "user:ai-tokens",
          "user:create",
          "user:invite",
          "user:products",
          "user:block",
          "user:privileges",
          "company:create",
          "company:read",
          "company:info",
          "company:salaries",
          "company:qa-devices",
          "company:payments",
          "company:organizations",
          "company:llm",
          "integration:git",
          "integration:design",
          "integration:meetings",
          "agent:git-read",
          "agent:git-write",
          "memory:write",
          "memory:moderate",
          "report:read",
          "report:personal",
          "report:costs"
        ],
        "x-enum-varnames": [
          "project:read",
          "project:create",
          "project:update",
          "project:delete",
          "project:costs",
          "product:read",
          "product:create",
          "product:update",
          "product:move",
          "product:delete",
          "product:structure",
          "product:costs",
          "version:read",
          "version:create",
          "version:update",
          "version:delete",
          "version:release",
          "version:costs",
          "feature:read",
          "feature:create",
          "feature:update",
          "feature:delete",
          "feature:move",
          "feature:publish",
          "feature:check",
          "feature:test",
          "feature:done",
          "feature:reopen",
          "feature:costs",
          "task:read",
          "task:read-drafts",
          "task:create",
          "task:duplicate",
          "task:update",
          "task:relations",
          "task:worklogs",
          "task:move",
          "task:delete-draft",
          "task:delete",
          "task:publish",
          "task:approve",
          "task:work",
          "task:pause",
          "task:done",
          "task:review",
          "task:test",
          "task:deploy",
          "task:close",
          "task:reopen",
          "task:costs",
          "task:evaluate",
          "task:work-evaluation",
          "worklog:update",
          "worklog:delete",
          "worklog:no-margin",
          "chat:read",
          "chat:create",
          "chat:join",
          "chat:leave",
          "chat:update",
          "chat:delete",
          "chat:admin",
          "chat:message",
          "chat:reaction",
          "chat:message-update",
          "chat:message-delete",
          "meeting:read",
          "meeting:create",
          "meeting:update",
          "meeting:delete",
          "meeting:finish",
          "meeting:invite",
          "meeting:respond",
          "meeting:join",
          "meeting:costs",
          "meeting:rates",
          "user:read",
          "user:update",
          "user:personal",
          "user:documents",
          "user:employment",
          "user:no-margin",
          "user:payments",
          "user:bonus",
          "user:timeoff",
          "user:allowed-products",
          "user:activity",
          "user:sessions",
          "user:ai-tokens",
          "user:create",
          "user:invite",
          "user:products",
          "user:block",
          "user:privileges",
          "company:create",
          "company:read",
          "company:info",
          "company:salaries",
          "company:qa-devices",
          "company:payments",
          "company:organizations",
          "company:llm",
          "integration:git",
          "integration:design",
          "integration:meetings",
          "agent:git-read",
          "agent:git-write",
          "memory:write",
          "memory:moderate",
          "report:read",
          "report:personal",
          "report:costs"
        ],
        "title": "ALLOW_KEYS",
        "description": "`project:read` = \"project:read\", `project:create` = \"project:create\", `project:update` = \"project:update\", `project:delete` = \"project:delete\", `project:costs` = \"project:costs\", `product:read` = \"product:read\", `product:create` = \"product:create\", `product:update` = \"product:update\", `product:move` = \"product:move\", `product:delete` = \"product:delete\", `product:structure` = \"product:structure\", `product:costs` = \"product:costs\", `version:read` = \"version:read\", `version:create` = \"version:create\", `version:update` = \"version:update\", `version:delete` = \"version:delete\", `version:release` = \"version:release\", `version:costs` = \"version:costs\", `feature:read` = \"feature:read\", `feature:create` = \"feature:create\", `feature:update` = \"feature:update\", `feature:delete` = \"feature:delete\", `feature:move` = \"feature:move\", `feature:publish` = \"feature:publish\", `feature:check` = \"feature:check\", `feature:test` = \"feature:test\", `feature:done` = \"feature:done\", `feature:reopen` = \"feature:reopen\", `feature:costs` = \"feature:costs\", `task:read` = \"task:read\", `task:read-drafts` = \"task:read-drafts\", `task:create` = \"task:create\", `task:duplicate` = \"task:duplicate\", `task:update` = \"task:update\", `task:relations` = \"task:relations\", `task:worklogs` = \"task:worklogs\", `task:move` = \"task:move\", `task:delete-draft` = \"task:delete-draft\", `task:delete` = \"task:delete\", `task:publish` = \"task:publish\", `task:approve` = \"task:approve\", `task:work` = \"task:work\", `task:pause` = \"task:pause\", `task:done` = \"task:done\", `task:review` = \"task:review\", `task:test` = \"task:test\", `task:deploy` = \"task:deploy\", `task:close` = \"task:close\", `task:reopen` = \"task:reopen\", `task:costs` = \"task:costs\", `task:evaluate` = \"task:evaluate\", `task:work-evaluation` = \"task:work-evaluation\", `worklog:update` = \"worklog:update\", `worklog:delete` = \"worklog:delete\", `worklog:no-margin` = \"worklog:no-margin\", `chat:read` = \"chat:read\", `chat:create` = \"chat:create\", `chat:join` = \"chat:join\", `chat:leave` = \"chat:leave\", `chat:update` = \"chat:update\", `chat:delete` = \"chat:delete\", `chat:admin` = \"chat:admin\", `chat:message` = \"chat:message\", `chat:reaction` = \"chat:reaction\", `chat:message-update` = \"chat:message-update\", `chat:message-delete` = \"chat:message-delete\", `meeting:read` = \"meeting:read\", `meeting:create` = \"meeting:create\", `meeting:update` = \"meeting:update\", `meeting:delete` = \"meeting:delete\", `meeting:finish` = \"meeting:finish\", `meeting:invite` = \"meeting:invite\", `meeting:respond` = \"meeting:respond\", `meeting:join` = \"meeting:join\", `meeting:costs` = \"meeting:costs\", `meeting:rates` = \"meeting:rates\", `user:read` = \"user:read\", `user:update` = \"user:update\", `user:personal` = \"user:personal\", `user:documents` = \"user:documents\", `user:employment` = \"user:employment\", `user:no-margin` = \"user:no-margin\", `user:payments` = \"user:payments\", `user:bonus` = \"user:bonus\", `user:timeoff` = \"user:timeoff\", `user:allowed-products` = \"user:allowed-products\", `user:activity` = \"user:activity\", `user:sessions` = \"user:sessions\", `user:ai-tokens` = \"user:ai-tokens\", `user:create` = \"user:create\", `user:invite` = \"user:invite\", `user:products` = \"user:products\", `user:block` = \"user:block\", `user:privileges` = \"user:privileges\", `company:create` = \"company:create\", `company:read` = \"company:read\", `company:info` = \"company:info\", `company:salaries` = \"company:salaries\", `company:qa-devices` = \"company:qa-devices\", `company:payments` = \"company:payments\", `company:organizations` = \"company:organizations\", `company:llm` = \"company:llm\", `integration:git` = \"integration:git\", `integration:design` = \"integration:design\", `integration:meetings` = \"integration:meetings\", `agent:git-read` = \"agent:git-read\", `agent:git-write` = \"agent:git-write\", `memory:write` = \"memory:write\", `memory:moderate` = \"memory:moderate\", `report:read` = \"report:read\", `report:personal` = \"report:personal\", `report:costs` = \"report:costs\""
      },
      "AllowRelation": {
        "type": "integer",
        "enum": [
          0,
          10,
          100,
          1000,
          9999
        ],
        "x-enum-varnames": [
          "own",
          "self",
          "department",
          "product",
          "common"
        ],
        "title": "AllowRelation",
        "description": "`own` = 0, `self` = 10, `department` = 100, `product` = 1000, `common` = 9999"
      },
      "NO_MARGIN_ALLOWS": {
        "type": "string",
        "enum": [
          "worklog:no-margin",
          "user:no-margin"
        ],
        "x-enum-varnames": [
          "worklog:no-margin",
          "user:no-margin"
        ],
        "title": "NO_MARGIN_ALLOWS",
        "description": "`worklog:no-margin` = \"worklog:no-margin\", `user:no-margin` = \"user:no-margin\""
      },
      "NO_RESOURCE_ALLOWS": {
        "type": "string",
        "enum": [
          "project:create",
          "product:create",
          "chat:create",
          "meeting:create",
          "user:create",
          "user:invite"
        ],
        "x-enum-varnames": [
          "project:create",
          "product:create",
          "chat:create",
          "meeting:create",
          "user:create",
          "user:invite"
        ],
        "title": "NO_RESOURCE_ALLOWS",
        "description": "`project:create` = \"project:create\", `product:create` = \"product:create\", `chat:create` = \"chat:create\", `meeting:create` = \"meeting:create\", `user:create` = \"user:create\", `user:invite` = \"user:invite\""
      },
      "PERSONAL_WORK_ALLOWS": {
        "type": "string",
        "enum": [
          "task:work",
          "task:done"
        ],
        "x-enum-varnames": [
          "task:work",
          "task:done"
        ],
        "title": "PERSONAL_WORK_ALLOWS",
        "description": "`task:work` = \"task:work\", `task:done` = \"task:done\""
      },
      "READ_ALLOWS": {
        "type": "string",
        "enum": [
          "project:read",
          "project:costs",
          "product:read",
          "product:costs",
          "worklog:no-margin",
          "version:read",
          "version:costs",
          "feature:read",
          "feature:costs",
          "task:read",
          "task:read-drafts",
          "task:worklogs",
          "task:costs",
          "chat:read",
          "meeting:read",
          "meeting:costs",
          "user:read",
          "user:allowed-products",
          "user:activity",
          "user:no-margin",
          "company:read",
          "agent:git-read",
          "report:read",
          "report:personal",
          "report:costs"
        ],
        "x-enum-varnames": [
          "project:read",
          "project:costs",
          "product:read",
          "product:costs",
          "worklog:no-margin",
          "version:read",
          "version:costs",
          "feature:read",
          "feature:costs",
          "task:read",
          "task:read-drafts",
          "task:worklogs",
          "task:costs",
          "chat:read",
          "meeting:read",
          "meeting:costs",
          "user:read",
          "user:allowed-products",
          "user:activity",
          "user:no-margin",
          "company:read",
          "agent:git-read",
          "report:read",
          "report:personal",
          "report:costs"
        ],
        "title": "READ_ALLOWS",
        "description": "`project:read` = \"project:read\", `project:costs` = \"project:costs\", `product:read` = \"product:read\", `product:costs` = \"product:costs\", `worklog:no-margin` = \"worklog:no-margin\", `version:read` = \"version:read\", `version:costs` = \"version:costs\", `feature:read` = \"feature:read\", `feature:costs` = \"feature:costs\", `task:read` = \"task:read\", `task:read-drafts` = \"task:read-drafts\", `task:worklogs` = \"task:worklogs\", `task:costs` = \"task:costs\", `chat:read` = \"chat:read\", `meeting:read` = \"meeting:read\", `meeting:costs` = \"meeting:costs\", `user:read` = \"user:read\", `user:allowed-products` = \"user:allowed-products\", `user:activity` = \"user:activity\", `user:no-margin` = \"user:no-margin\", `company:read` = \"company:read\", `agent:git-read` = \"agent:git-read\", `report:read` = \"report:read\", `report:personal` = \"report:personal\", `report:costs` = \"report:costs\""
      },
      "UserActivityLogs_ResourceType": {
        "type": "integer",
        "enum": [
          1,
          2,
          10,
          20,
          21,
          22,
          30,
          40,
          50,
          60,
          70,
          80,
          100,
          110,
          120,
          130,
          140,
          145,
          150,
          151,
          160,
          170,
          180,
          200,
          201,
          202,
          203,
          300,
          305,
          306,
          310,
          320,
          400
        ],
        "x-enum-varnames": [
          "company",
          "dictionary",
          "project",
          "product",
          "module",
          "component",
          "version",
          "feature",
          "task",
          "bug",
          "meeting",
          "entityRelation",
          "user",
          "userRole",
          "userTimeOff",
          "userEmployment",
          "userPrivilege",
          "userProductAccess",
          "worklog",
          "worklogsGroup",
          "session",
          "apiToken",
          "accessDenied",
          "payments",
          "paymentAwardPart",
          "payrollDocsSend",
          "payrollRecalc",
          "integrationGit",
          "gitAgentAction",
          "agentMemory",
          "integrationMeeting",
          "integrationFigma",
          "chat"
        ],
        "title": "UserActivityLogs_ResourceType",
        "description": "`company` = 1, `dictionary` = 2, `project` = 10, `product` = 20, `module` = 21, `component` = 22, `version` = 30, `feature` = 40, `task` = 50, `bug` = 60, `meeting` = 70, `entityRelation` = 80, `user` = 100, `userRole` = 110, `userTimeOff` = 120, `userEmployment` = 130, `userPrivilege` = 140, `userProductAccess` = 145, `worklog` = 150, `worklogsGroup` = 151, `session` = 160, `apiToken` = 170, `accessDenied` = 180, `payments` = 200, `paymentAwardPart` = 201, `payrollDocsSend` = 202, `payrollRecalc` = 203, `integrationGit` = 300, `gitAgentAction` = 305, `agentMemory` = 306, `integrationMeeting` = 310, `integrationFigma` = 320, `chat` = 400"
      },
      "UserRole_Level": {
        "type": "integer",
        "enum": [
          -1,
          1,
          10,
          50,
          100,
          1000
        ],
        "x-enum-varnames": [
          "intern",
          "junior",
          "middle",
          "upperMiddle",
          "senior",
          "lead"
        ],
        "title": "UserRole_Level",
        "description": "`intern` = -1, `junior` = 1, `middle` = 10, `upperMiddle` = 50, `senior` = 100, `lead` = 1000"
      },
      "UserRole_Type": {
        "type": "integer",
        "enum": [
          10,
          20,
          30,
          40,
          50,
          60,
          70
        ],
        "x-enum-varnames": [
          "management",
          "analytics",
          "marketing",
          "design",
          "development",
          "qa",
          "support"
        ],
        "title": "UserRole_Type",
        "description": "`management` = 10, `analytics` = 20, `marketing` = 30, `design` = 40, `development` = 50, `qa` = 60, `support` = 70"
      },
      "Payment_Type": {
        "type": "integer",
        "enum": [
          0,
          10,
          15,
          20,
          30,
          40,
          50,
          100,
          -100
        ],
        "x-enum-varnames": [
          "iteration",
          "vacation",
          "compensation",
          "sick",
          "salary_advance",
          "salary_final",
          "award",
          "bonus",
          "deduction"
        ],
        "title": "Payment_Type",
        "description": "`iteration` = 0, `vacation` = 10, `compensation` = 15, `sick` = 20, `salary_advance` = 30, `salary_final` = 40, `award` = 50, `bonus` = 100, `deduction` = -100"
      },
      "Payment_MONTH_TYPES": {
        "type": "integer",
        "enum": [
          30,
          40,
          50
        ],
        "x-enum-varnames": [
          "30",
          "40",
          "50"
        ],
        "title": "Payment_MONTH_TYPES",
        "description": "`30` = 30, `40` = 40, `50` = 50"
      },
      "Payment_BonusReason": {
        "type": "integer",
        "enum": [
          10,
          20,
          30,
          40,
          50,
          60,
          100
        ],
        "x-enum-varnames": [
          "Project",
          "YearAward",
          "Loyalty",
          "Effectivity",
          "Compensation",
          "Adjustment",
          "Misc"
        ],
        "title": "Payment_BonusReason",
        "description": "`Project` = 10, `YearAward` = 20, `Loyalty` = 30, `Effectivity` = 40, `Compensation` = 50, `Adjustment` = 60, `Misc` = 100"
      },
      "Payment_DeductionReason": {
        "type": "integer",
        "enum": [
          -10,
          -20,
          -30,
          -40,
          -60,
          -100
        ],
        "x-enum-varnames": [
          "Aliment",
          "Damage",
          "Mulct",
          "Credit",
          "Adjustment",
          "MinusMisc"
        ],
        "title": "Payment_DeductionReason",
        "description": "`Aliment` = -10, `Damage` = -20, `Mulct` = -30, `Credit` = -40, `Adjustment` = -60, `MinusMisc` = -100"
      },
      "PaymentAwardPart_Type": {
        "type": "integer",
        "enum": [
          10,
          20,
          30,
          40,
          50
        ],
        "x-enum-varnames": [
          "output",
          "correction",
          "fine",
          "bonus",
          "carryover"
        ],
        "title": "PaymentAwardPart_Type",
        "description": "`output` = 10, `correction` = 20, `fine` = 30, `bonus` = 40, `carryover` = 50"
      },
      "PaymentAwardPart_MANUAL_TYPES": {
        "type": "integer",
        "enum": [
          20,
          30,
          40
        ],
        "x-enum-varnames": [
          "20",
          "30",
          "40"
        ],
        "title": "PaymentAwardPart_MANUAL_TYPES",
        "description": "`20` = 20, `30` = 30, `40` = 40"
      },
      "GitCommitTaskLink_Type": {
        "type": "string",
        "enum": [
          "message",
          "branch"
        ],
        "x-enum-varnames": [
          "message",
          "branch"
        ],
        "title": "GitCommitTaskLink_Type",
        "description": "`message` = \"message\", `branch` = \"branch\""
      },
      "GitIntegration_Type": {
        "type": "string",
        "enum": [
          "GitLab",
          "GitHub"
        ],
        "x-enum-varnames": [
          "gitlab",
          "github"
        ],
        "title": "GitIntegration_Type",
        "description": "`gitlab` = \"GitLab\", `github` = \"GitHub\""
      },
      "GitIntegration_Status": {
        "type": "integer",
        "enum": [
          10,
          2,
          1,
          0,
          -1,
          -10,
          -100
        ],
        "x-enum-varnames": [
          "sync",
          "waiting",
          "enabled",
          "disabled",
          "warn",
          "error",
          "removed"
        ],
        "title": "GitIntegration_Status",
        "description": "`sync` = 10, `waiting` = 2, `enabled` = 1, `disabled` = 0, `warn` = -1, `error` = -10, `removed` = -100"
      },
      "GitIntegrationUser_State": {
        "type": "string",
        "enum": [
          "employee",
          "agent",
          "service",
          "inactive"
        ],
        "x-enum-varnames": [
          "employee",
          "agent",
          "service",
          "inactive"
        ],
        "title": "GitIntegrationUser_State",
        "description": "`employee` = \"employee\", `agent` = \"agent\", `service` = \"service\", `inactive` = \"inactive\""
      },
      "MeetingIntegration_Status": {
        "type": "integer",
        "enum": [
          1,
          -1
        ],
        "x-enum-varnames": [
          "enabled",
          "warn"
        ],
        "title": "MeetingIntegration_Status",
        "description": "`enabled` = 1, `warn` = -1"
      },
      "MeetingIntegration_ErrorCode": {
        "type": "integer",
        "enum": [
          1,
          2,
          3
        ],
        "x-enum-varnames": [
          "SubscriptionPlanError",
          "IntegrationStatusError",
          "AlreadyConnectedError"
        ],
        "title": "MeetingIntegration_ErrorCode",
        "description": "`SubscriptionPlanError` = 1, `IntegrationStatusError` = 2, `AlreadyConnectedError` = 3"
      },
      "MeetingIntegrationTask_Type": {
        "type": "string",
        "enum": [
          "recording",
          "transcript"
        ],
        "x-enum-varnames": [
          "recording",
          "transcript"
        ],
        "title": "MeetingIntegrationTask_Type",
        "description": "`recording` = \"recording\", `transcript` = \"transcript\""
      },
      "HolidayGreeting_Type": {
        "type": "string",
        "enum": [
          "christmas",
          "defender_of_fatherland",
          "international_women_day",
          "tester_day",
          "programmer_day",
          "new_year"
        ],
        "x-enum-varnames": [
          "Christmas",
          "DefenderOfFatherland",
          "InternationalWomenDay",
          "TesterDay",
          "ProgrammerDay",
          "NewYear"
        ],
        "title": "HolidayGreeting_Type",
        "description": "`Christmas` = \"christmas\", `DefenderOfFatherland` = \"defender_of_fatherland\", `InternationalWomenDay` = \"international_women_day\", `TesterDay` = \"tester_day\", `ProgrammerDay` = \"programmer_day\", `NewYear` = \"new_year\""
      },
      "AgentMemory_Level": {
        "type": "string",
        "enum": [
          "company",
          "user",
          "project",
          "repository"
        ],
        "x-enum-varnames": [
          "company",
          "user",
          "project",
          "repository"
        ],
        "title": "AgentMemory_Level",
        "description": "`company` = \"company\", `user` = \"user\", `project` = \"project\", `repository` = \"repository\""
      },
      "AgentMemory_Load": {
        "type": "string",
        "enum": [
          "always",
          "job",
          "request"
        ],
        "x-enum-varnames": [
          "always",
          "job",
          "request"
        ],
        "title": "AgentMemory_Load",
        "description": "`always` = \"always\", `job` = \"job\", `request` = \"request\""
      },
      "AgentMemory_Job": {
        "type": "string",
        "enum": [
          "analysis",
          "dev",
          "qa",
          "devops",
          "review",
          "design"
        ],
        "x-enum-varnames": [
          "analysis",
          "dev",
          "qa",
          "devops",
          "review",
          "design"
        ],
        "title": "AgentMemory_Job",
        "description": "`analysis` = \"analysis\", `dev` = \"dev\", `qa` = \"qa\", `devops` = \"devops\", `review` = \"review\", `design` = \"design\""
      },
      "LLMCall_Status": {
        "type": "string",
        "enum": [
          "success",
          "error",
          "canceled",
          "timeout"
        ],
        "x-enum-varnames": [
          "success",
          "error",
          "canceled",
          "timeout"
        ],
        "title": "LLMCall_Status",
        "description": "`success` = \"success\", `error` = \"error\", `canceled` = \"canceled\", `timeout` = \"timeout\""
      },
      "LLMCall_Outcome": {
        "type": "string",
        "enum": [
          "applied",
          "dismissed",
          "overridden"
        ],
        "x-enum-varnames": [
          "applied",
          "dismissed",
          "overridden"
        ],
        "title": "LLMCall_Outcome",
        "description": "`applied` = \"applied\", `dismissed` = \"dismissed\", `overridden` = \"overridden\""
      },
      "FigmaIntegration_ErrorCode": {
        "type": "integer",
        "enum": [
          1,
          2
        ],
        "x-enum-varnames": [
          "IntegrationStatusError",
          "AlreadyConnectedError"
        ],
        "title": "FigmaIntegration_ErrorCode",
        "description": "`IntegrationStatusError` = 1, `AlreadyConnectedError` = 2"
      },
      "AccessType": {
        "type": "integer",
        "enum": [
          0,
          10,
          100
        ],
        "x-enum-varnames": [
          "unauthorized",
          "authorized",
          "administrator"
        ],
        "title": "AccessType",
        "description": "`unauthorized` = 0, `authorized` = 10, `administrator` = 100"
      },
      "Session": {
        "type": "integer",
        "enum": [
          60000,
          500
        ],
        "x-enum-varnames": [
          "TOUCH_INTERVAL_MS",
          "TOUCH_LOCK_TIMEOUT_MS"
        ],
        "title": "Session",
        "description": "`TOUCH_INTERVAL_MS` = 60000, `TOUCH_LOCK_TIMEOUT_MS` = 500"
      },
      "UserDeviceType": {
        "type": "string",
        "enum": [
          "desktop",
          "console",
          "embedded",
          "mobile",
          "tablet",
          "smarttv",
          "wearable",
          "xr"
        ],
        "x-enum-varnames": [
          "desktop",
          "console",
          "embedded",
          "mobile",
          "tablet",
          "smarttv",
          "wearable",
          "xr"
        ],
        "title": "UserDeviceType",
        "description": "`desktop` = \"desktop\", `console` = \"console\", `embedded` = \"embedded\", `mobile` = \"mobile\", `tablet` = \"tablet\", `smarttv` = \"smarttv\", `wearable` = \"wearable\", `xr` = \"xr\""
      },
      "User_gender": {
        "type": "string",
        "enum": [
          "male",
          "female"
        ],
        "x-enum-varnames": [
          "male",
          "female"
        ],
        "title": "User_gender",
        "description": "`male` = \"male\", `female` = \"female\""
      },
      "Meeting_entityType": {
        "type": "string",
        "enum": [
          "product",
          "version",
          "feature"
        ],
        "x-enum-varnames": [
          "product",
          "version",
          "feature"
        ],
        "title": "Meeting_entityType",
        "description": "`product` = \"product\", `version` = \"version\", `feature` = \"feature\""
      },
      "Meeting_online_service": {
        "type": "string",
        "enum": [
          "zoom"
        ],
        "x-enum-varnames": [
          "zoom"
        ],
        "title": "Meeting_online_service",
        "description": "`zoom` = \"zoom\""
      },
      "ApiToken_type": {
        "type": "string",
        "enum": [
          "agent",
          "integration",
          "test"
        ],
        "x-enum-varnames": [
          "agent",
          "integration",
          "test"
        ],
        "title": "ApiToken_type",
        "description": "`agent` = \"agent\", `integration` = \"integration\", `test` = \"test\""
      },
      "ApiToken_kind": {
        "type": "string",
        "enum": [
          "pat",
          "oauth"
        ],
        "x-enum-varnames": [
          "pat",
          "oauth"
        ],
        "title": "ApiToken_kind",
        "description": "`pat` = \"pat\", `oauth` = \"oauth\""
      },
      "Notification_channel": {
        "type": "string",
        "enum": [
          "webpush",
          "sse",
          "sms",
          "telegram"
        ],
        "x-enum-varnames": [
          "WebPush",
          "SSE",
          "SMS",
          "Telegram"
        ],
        "title": "Notification_channel",
        "description": "`WebPush` = \"webpush\", `SSE` = \"sse\", `SMS` = \"sms\", `Telegram` = \"telegram\""
      },
      "Notification_lockState": {
        "type": "integer",
        "enum": [
          -100,
          0,
          1,
          -1,
          -10
        ],
        "x-enum-varnames": [
          "none",
          "waiting",
          "ready",
          "processing",
          "error"
        ],
        "title": "Notification_lockState",
        "description": "`none` = -100, `waiting` = 0, `ready` = 1, `processing` = -1, `error` = -10"
      },
      "File_type": {
        "type": "string",
        "enum": [
          "image",
          "audio",
          "video",
          "doc",
          "other"
        ],
        "x-enum-varnames": [
          "image",
          "audio",
          "video",
          "doc",
          "other"
        ],
        "title": "File_type",
        "description": "`image` = \"image\", `audio` = \"audio\", `video` = \"video\", `doc` = \"doc\", `other` = \"other\""
      },
      "Payment_employmentType": {
        "type": "string",
        "enum": [
          "none",
          "ru_tk",
          "ru_gpd",
          "ru_ip",
          "ru_sam"
        ],
        "x-enum-varnames": [
          "none",
          "ruTK",
          "ruGPD",
          "ruIP",
          "ruSam"
        ],
        "title": "Payment_employmentType",
        "description": "`none` = \"none\", `ruTK` = \"ru_tk\", `ruGPD` = \"ru_gpd\", `ruIP` = \"ru_ip\", `ruSam` = \"ru_sam\""
      },
      "UserTimeOff_payment": {
        "type": "string",
        "enum": [
          "created",
          "paid"
        ],
        "x-enum-varnames": [
          "created",
          "paid"
        ],
        "title": "UserTimeOff_payment",
        "description": "`created` = \"created\", `paid` = \"paid\""
      },
      "MeetingIntegration_type": {
        "type": "string",
        "enum": [
          "zoom"
        ],
        "x-enum-varnames": [
          "Zoom"
        ],
        "title": "MeetingIntegration_type",
        "description": "`Zoom` = \"zoom\""
      },
      "Design_type": {
        "type": "string",
        "enum": [
          "figma"
        ],
        "x-enum-varnames": [
          "figma"
        ],
        "title": "Design_type",
        "description": "`figma` = \"figma\""
      },
      "Design_status": {
        "type": "string",
        "enum": [
          "wait",
          "error",
          "ready"
        ],
        "x-enum-varnames": [
          "wait",
          "error",
          "ready"
        ],
        "title": "Design_status",
        "description": "`wait` = \"wait\", `error` = \"error\", `ready` = \"ready\""
      },
      "LLMFunctionConnection_launch": {
        "type": "string",
        "enum": [
          "auto",
          "manual"
        ],
        "x-enum-varnames": [
          "auto",
          "manual"
        ],
        "title": "LLMFunctionConnection_launch",
        "description": "`auto` = \"auto\", `manual` = \"manual\""
      },
      "IServerErrorData": {
        "type": "object",
        "properties": {
          "err": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          },
          "stack": {
            "type": "string",
            "description": "Только non-prod"
          }
        }
      },
      "IServerResponse": {
        "type": "object",
        "required": [
          "code",
          "data",
          "srvTS",
          "rkey"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "example": 200
          },
          "data": {
            "description": "Generic data payload",
            "type": "object",
            "additionalProperties": true
          },
          "srvTS": {
            "type": "integer",
            "description": "Server timestamp (ms)"
          },
          "rkey": {
            "type": "string",
            "description": "Request key"
          }
        }
      },
      "Resp_agent-memory_delete": {
        "title": "Resp_agent-memory_delete",
        "description": "ResponseData for agent-memory/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "version": {
            "type": "number"
          }
        },
        "required": [
          "deleted",
          "version"
        ]
      },
      "Resp_agent-memory_list": {
        "title": "Resp_agent-memory_list",
        "description": "ResponseData for agent-memory/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentMemory"
            }
          },
          "repositories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentMemoryService_RepositoryRef"
            },
            "description": "Доступные пользователю репозитории: названия и проекты - для отображения области и выбора при переносе"
          }
        },
        "required": [
          "list",
          "repositories"
        ]
      },
      "Resp_chat_admin": {
        "title": "Resp_chat_admin",
        "description": "type ResponseData = number",
        "type": "number"
      },
      "Resp_chat_create": {
        "title": "Resp_chat_create",
        "description": "ResponseData for chat/create",
        "type": "object",
        "properties": {
          "chat": {
            "$ref": "#/components/schemas/Chat"
          },
          "member": {
            "$ref": "#/components/schemas/ChatMember"
          }
        },
        "required": [
          "chat",
          "member"
        ]
      },
      "Resp_chat_delete": {
        "title": "Resp_chat_delete",
        "description": "type ResponseData = number",
        "type": "number"
      },
      "Resp_chat_join": {
        "title": "Resp_chat_join",
        "description": "type ResponseData = number",
        "type": "number"
      },
      "Resp_chat_leave": {
        "title": "Resp_chat_leave",
        "description": "type ResponseData = number",
        "type": "number"
      },
      "Resp_chat_message_viewed": {
        "title": "Resp_chat_message_viewed",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_chat_notifications": {
        "title": "Resp_chat_notifications",
        "description": "type ResponseData = number",
        "type": "number"
      },
      "Resp_chat_open": {
        "title": "Resp_chat_open",
        "description": "ResponseData for chat/open",
        "type": "object",
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatMember"
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "task": {
            "$ref": "#/components/schemas/Task"
          },
          "bug": {
            "$ref": "#/components/schemas/Task"
          }
        },
        "required": [
          "members",
          "messages"
        ]
      },
      "Resp_ci_current-task": {
        "title": "Resp_ci_current-task",
        "description": "Pick<Task, ID | title | type | category>",
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "integer"
          },
          "category": {
            "type": "integer"
          }
        },
        "required": [
          "ID",
          "title",
          "type",
          "category"
        ]
      },
      "Resp_ci_deployed": {
        "title": "Resp_ci_deployed",
        "description": "ResponseData for ci/deployed",
        "type": "object",
        "properties": {
          "deployed": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "Pick<Task, ID | key | title | type | category>",
              "properties": {
                "ID": {
                  "type": "string",
                  "format": "uuid"
                },
                "key": {},
                "title": {
                  "type": "string"
                },
                "type": {
                  "type": "integer"
                },
                "category": {
                  "type": "integer"
                }
              },
              "required": [
                "ID",
                "key",
                "title",
                "type",
                "category"
              ]
            }
          }
        },
        "required": [
          "deployed"
        ]
      },
      "Resp_ci_resolve": {
        "title": "Resp_ci_resolve",
        "description": "ResponseData for ci/resolve",
        "type": "object",
        "properties": {
          "bugs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResolvedTask"
            }
          },
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResolvedTask"
            }
          },
          "components": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "bugs",
          "tasks",
          "components"
        ]
      },
      "Resp_company_access_check-user": {
        "title": "Resp_company_access_check-user",
        "description": "ResponseData for company/access/check-user",
        "type": "object",
        "properties": {
          "user": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/User"
                  }
                ],
                "description": "Partial<User>"
              },
              {
                "type": "null"
              }
            ]
          },
          "hasAccess": {
            "type": "boolean",
            "description": "Есть ли активный доступ к компании"
          },
          "hasRoles": {
            "type": "boolean",
            "description": "есть ли  любые роли в компании"
          }
        },
        "required": [
          "hasAccess",
          "hasRoles"
        ]
      },
      "Resp_company_access_delete": {
        "title": "Resp_company_access_delete",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_company_allows_catalog": {
        "title": "Resp_company_allows_catalog",
        "description": "ResponseData for company/allows/catalog",
        "type": "object",
        "properties": {
          "relations": {
            "type": "object",
            "additionalProperties": true,
            "description": "Отношения и их порядок: own < self < department < product < common"
          },
          "catalog": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "Ключ привилегии → допустимые отношения, в порядке каталога"
          },
          "adminOnly": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "description": "readonly AllowKey"
            },
            "description": "Привилегии только администратора: в схемы не включаются"
          },
          "sets": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "Системные наборы - только включённые привилегии"
          },
          "schemes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "$ref": "#/components/schemas/DefaultAllowSchemaKey"
                },
                "allows": {
                  "$ref": "#/components/schemas/AllowsSet"
                }
              },
              "required": [
                "key",
                "allows"
              ]
            },
            "description": "Стандартные схемы в порядке кода - только включённые привилегии"
          }
        },
        "required": [
          "relations",
          "catalog",
          "adminOnly",
          "sets",
          "schemes"
        ]
      },
      "Resp_company_allows_scheme-delete": {
        "title": "Resp_company_allows_scheme-delete",
        "description": "ResponseData for company/allows/scheme-delete",
        "type": "object",
        "properties": {
          "userIDs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Пользователи, у которых была удалённая схема"
          }
        },
        "required": [
          "userIDs"
        ]
      },
      "Resp_company_archive-file": {
        "title": "Resp_company_archive-file",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_company_check-requisites": {
        "title": "Resp_company_check-requisites",
        "description": "type ResponseData = { type: 'company'; data: OrganizationRequisites | null } | { type: 'bank'; data: BankRequisites | null }",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "company"
                ]
              },
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OrganizationRequisites"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "bank"
                ]
              },
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/BankRequisites"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "type",
              "data"
            ]
          }
        ]
      },
      "Resp_company_check": {
        "title": "Resp_company_check",
        "description": "ResponseData for company/check",
        "type": "object",
        "properties": {
          "title": {
            "type": "boolean"
          }
        },
        "required": [
          "title"
        ]
      },
      "Resp_company_control": {
        "title": "Resp_company_control",
        "description": "ResponseData for company/control",
        "type": "object",
        "properties": {
          "controlUser": {
            "$ref": "#/components/schemas/UserAccess"
          }
        }
      },
      "Resp_company_create": {
        "title": "Resp_company_create",
        "description": "ResponseData for company/create",
        "type": "object",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/AuthSession"
          },
          "currentUser": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastUpdTS": {
            "type": "number"
          }
        },
        "required": [
          "session",
          "lastUpdTS"
        ]
      },
      "Resp_company_users-management": {
        "title": "Resp_company_users-management",
        "description": "ResponseData for company/users-management",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ID": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "TS type: string avatarFID: string firstName: string lastName: string patronymic: string phone: string role: { ID: string type: UserRole.Type level: UserRole.Level title: string }"
                    },
                    {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "null /** Последний сеанс (IP, город, устройство)"
                    }
                  ]
                }
              },
              "required": [
                "ID"
              ]
            }
          }
        }
      },
      "Resp_costs_entity": {
        "title": "Resp_costs_entity",
        "description": "ResponseData for costs/entity",
        "type": "object",
        "properties": {
          "margin": {
            "type": "boolean",
            "description": "#26673 Применённый режим: true - суммы ворклогов с маржой, false - без маржи"
          },
          "iterations": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Итерации, в которых по сущности была работа, по убыванию"
          },
          "totals": {
            "type": "object",
            "properties": {
              "time": {
                "type": "number"
              },
              "salary": {
                "type": "number"
              },
              "award": {
                "type": "number"
              },
              "correction": {
                "type": "number"
              },
              "cost": {
                "type": "number"
              }
            },
            "required": [
              "time",
              "salary",
              "award",
              "correction",
              "cost"
            ],
            "description": "#26808 Стоимость = оклад + премия + коррекции"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostsRow"
            }
          },
          "corrections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentAwardPart"
            },
            "description": "Коррекции по сущности, её подсущностям и ворклогам"
          },
          "worklogs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostsWorklog"
            },
            "description": "У задачи и ошибки - завершённые ворклоги выбранной итерации: уровень ворклогов и коррекция по ворклогу"
          },
          "titles": {
            "type": "object",
            "additionalProperties": true,
            "description": "Названия задач, фич и версий из строк: в сторе веба их может не быть"
          }
        },
        "required": [
          "margin",
          "iterations",
          "totals",
          "rows",
          "corrections"
        ]
      },
      "Resp_costs_user-corrections": {
        "title": "Resp_costs_user-corrections",
        "description": "ResponseData for costs/user-corrections",
        "type": "object",
        "properties": {
          "corrections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentAwardPart"
            }
          }
        },
        "required": [
          "corrections"
        ]
      },
      "Resp_design_create": {
        "title": "Resp_design_create",
        "anyOf": [
          {
            "$ref": "#/components/schemas/Design"
          },
          {
            "type": "null"
          }
        ]
      },
      "Resp_design_preview": {
        "title": "Resp_design_preview",
        "description": "ResponseData for design/preview",
        "type": "object",
        "properties": {
          "FID": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "size": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "nodeUrl": {
            "type": "string"
          }
        },
        "required": [
          "FID",
          "name",
          "type",
          "size",
          "width",
          "height",
          "nodeUrl"
        ]
      },
      "Resp_design_reload": {
        "title": "Resp_design_reload",
        "anyOf": [
          {
            "$ref": "#/components/schemas/Design"
          },
          {
            "type": "null"
          }
        ]
      },
      "Resp_file_proxy-download": {
        "title": "Resp_file_proxy-download",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_figma_availability": {
        "title": "Resp_integration_figma_availability",
        "description": "ResponseData for integration/figma/availability",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "Resp_integration_figma_create": {
        "title": "Resp_integration_figma_create",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_figma_current": {
        "title": "Resp_integration_figma_current",
        "description": "ResponseData for integration/figma/current",
        "type": "object",
        "properties": {
          "integration": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "TS type: ( Pick<IFigmaIntegration, 'ID' | 'cID' | 'status' | 'createdDT' | 'errorCode'> & { account: FigmaIntegration.AccountInfo | null } )"
          }
        }
      },
      "Resp_integration_figma_delete": {
        "title": "Resp_integration_figma_delete",
        "description": "ResponseData for integration/figma/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_integration_figma_install-url": {
        "title": "Resp_integration_figma_install-url",
        "description": "ResponseData for integration/figma/install-url",
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ]
      },
      "Resp_integration_git_agent-access": {
        "title": "Resp_integration_git_agent-access",
        "description": "ResponseData for integration/git/agent-access",
        "type": "object",
        "properties": {
          "read": {
            "type": "boolean",
            "description": "Хотя бы один репозиторий проекта компании открыт агентам на чтение"
          },
          "write": {
            "type": "boolean",
            "description": "Хотя бы один репозиторий проекта компании открыт агентам на запись"
          }
        },
        "required": [
          "read",
          "write"
        ]
      },
      "Resp_integration_git_branch_create": {
        "title": "Resp_integration_git_branch_create",
        "description": "ResponseData for integration/git/branch/create",
        "type": "object",
        "properties": {
          "git": {
            "$ref": "#/components/schemas/TaskGit_Type",
            "description": "Обновлённое поле git задачи"
          },
          "name": {
            "type": "string",
            "description": "Имя ветки и ссылка на неё в этом репозитории"
          },
          "url": {
            "type": "string"
          },
          "created": {
            "type": "boolean",
            "description": "false - ветка с таким именем уже была у провайдера, записана ссылка на неё"
          }
        },
        "required": [
          "git",
          "name",
          "url",
          "created"
        ]
      },
      "Resp_integration_git_commit_comment-list": {
        "title": "Resp_integration_git_commit_comment-list",
        "description": "ResponseData for integration/git/commit/comment-list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GitComment"
            }
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_integration_git_commit_lines-backfill": {
        "title": "Resp_integration_git_commit_lines-backfill",
        "description": "ResponseData for integration/git/commit/lines-backfill",
        "type": "object",
        "properties": {
          "queued": {
            "type": "number",
            "description": "Коммитов поставлено в очередь воркера синхронизации"
          }
        },
        "required": [
          "queued"
        ]
      },
      "Resp_integration_git_commit-list": {
        "title": "Resp_integration_git_commit-list",
        "description": "ResponseData for integration/git/commit-list",
        "type": "object",
        "properties": {
          "tasks": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "repositories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GitRepositoryWithIntegrationTypeDTO"
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommitsGroup"
            }
          }
        },
        "required": [
          "tasks",
          "repositories",
          "groups"
        ]
      },
      "Resp_integration_git_create": {
        "title": "Resp_integration_git_create",
        "description": "ResponseData for integration/git/create",
        "type": "object",
        "properties": {
          "ID": {
            "type": "string"
          }
        },
        "required": [
          "ID"
        ]
      },
      "Resp_integration_git_delete": {
        "title": "Resp_integration_git_delete",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_git_github_install": {
        "title": "Resp_integration_git_github_install",
        "description": "ResponseData for integration/git/github/install",
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ]
      },
      "Resp_integration_git_list": {
        "title": "Resp_integration_git_list",
        "description": "ResponseData for integration/git/list",
        "type": "object",
        "properties": {
          "active": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GitIntegrationExtended"
            }
          },
          "inactive": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GitIntegrationExtended"
            }
          }
        },
        "required": [
          "active",
          "inactive"
        ]
      },
      "Resp_integration_git_passport_draft": {
        "title": "Resp_integration_git_passport_draft",
        "description": "ResponseData for integration/git/passport/draft",
        "type": "object",
        "properties": {
          "passport": {
            "$ref": "#/components/schemas/GitRepositoryPassport_Type"
          }
        },
        "required": [
          "passport"
        ]
      },
      "Resp_integration_git_passport_generate": {
        "title": "Resp_integration_git_passport_generate",
        "description": "ResponseData for integration/git/passport/generate",
        "type": "object",
        "properties": {
          "started": {
            "type": "object",
            "additionalProperties": true,
            "description": "Сборка запущена в фоне; итог придёт уведомлением тому, кто запустил (агенту - нет)"
          }
        },
        "required": [
          "started"
        ]
      },
      "Resp_integration_git_passport_get": {
        "title": "Resp_integration_git_passport_get",
        "description": "ResponseData for integration/git/passport/get",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Функция включена в компании и модели есть: кнопка «Сформировать» / «Обновить»; без `integration:git` - всегда false"
          },
          "building": {
            "type": "boolean",
            "description": "Сборка идёт прямо сейчас"
          },
          "passport": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/GitRepositoryPassport_Type"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "enabled",
          "building"
        ]
      },
      "Resp_integration_git_passport_save": {
        "title": "Resp_integration_git_passport_save",
        "description": "ResponseData for integration/git/passport/save",
        "type": "object",
        "properties": {
          "passport": {
            "$ref": "#/components/schemas/GitRepositoryPassport_Type"
          }
        },
        "required": [
          "passport"
        ]
      },
      "Resp_integration_git_update": {
        "title": "Resp_integration_git_update",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_git_updateRepoStatus": {
        "title": "Resp_integration_git_updateRepoStatus",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_git_updateStatus": {
        "title": "Resp_integration_git_updateStatus",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_git_webhook_github_webhook": {
        "title": "Resp_integration_git_webhook_github_webhook",
        "description": "ResponseData for integration/git/webhook/github/webhook",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ]
      },
      "Resp_integration_git_webhook_gitlab_system-webhook": {
        "title": "Resp_integration_git_webhook_gitlab_system-webhook",
        "description": "ResponseData for integration/git/webhook/gitlab/system-webhook",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ]
      },
      "Resp_integration_git_webhook_gitlab_webhook": {
        "title": "Resp_integration_git_webhook_gitlab_webhook",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_meeting_create": {
        "title": "Resp_integration_meeting_create",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_integration_meeting_delete": {
        "title": "Resp_integration_meeting_delete",
        "description": "ResponseData for integration/meeting/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_integration_meeting_zoom_availability": {
        "title": "Resp_integration_meeting_zoom_availability",
        "description": "ResponseData for integration/meeting/zoom/availability",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "Resp_integration_meeting_zoom_current": {
        "title": "Resp_integration_meeting_zoom_current",
        "description": "ResponseData for integration/meeting/zoom/current",
        "type": "object",
        "properties": {
          "integration": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "TS type: ( Pick<IMeetingIntegration, 'ID' | 'cID' | 'status' | 'createdDT' | 'errorCode'> & { account: Pick<MeetingIntegration.AccountInfo, 'id' | 'email' | 'name'> | null } )"
          },
          "usersWithoutZoomEmail": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Resp_integration_meeting_zoom_install-url": {
        "title": "Resp_integration_meeting_zoom_install-url",
        "description": "ResponseData for integration/meeting/zoom/install-url",
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ]
      },
      "Resp_integration_meeting_zoom_webhook": {
        "title": "Resp_integration_meeting_zoom_webhook",
        "description": "ResponseData for integration/meeting/zoom/webhook",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "plainToken": {
            "type": "string"
          },
          "encryptedToken": {
            "type": "string"
          }
        },
        "required": [
          "success"
        ]
      },
      "Resp_iteration_generate": {
        "title": "Resp_iteration_generate",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_iterations_list": {
        "title": "Resp_iterations_list",
        "description": "ResponseData for iterations/list",
        "type": "object",
        "properties": {
          "margin": {
            "type": "boolean",
            "description": "#26673 Применённый режим: true - суммы с маржой, false - без маржи"
          },
          "list": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "number timeSpent: number moneySpent: number"
                }
              },
              "required": [
                "key"
              ]
            }
          }
        },
        "required": [
          "margin",
          "list"
        ]
      },
      "Resp_iterations_state": {
        "title": "Resp_iterations_state",
        "description": "ResponseData for iterations/state",
        "type": "object",
        "properties": {
          "margin": {
            "type": "boolean",
            "description": "#26673 Применённый режим: true - суммы с маржой, false - без маржи"
          },
          "worklogs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkLog"
            }
          },
          "timeoffs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserTimeOff"
            }
          },
          "tasks": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "meetings": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "margin",
          "worklogs",
          "timeoffs",
          "tasks",
          "meetings"
        ]
      },
      "Resp_llm_create_title": {
        "title": "Resp_llm_create_title",
        "description": "type ResponseData = { title: string }",
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ]
      },
      "Resp_llm_edit_spellcheck": {
        "title": "Resp_llm_edit_spellcheck",
        "description": "TS type: LLMSpellcheck.Result & { runID: string }",
        "type": "object",
        "additionalProperties": true
      },
      "Resp_llm_entity_gist": {
        "title": "Resp_llm_entity_gist",
        "description": "ResponseData for llm/entity/gist",
        "type": "object",
        "properties": {
          "gist": {
            "$ref": "#/components/schemas/GistService_View",
            "description": "Записанная суть: текст, кто и когда написал, устарела ли"
          }
        },
        "required": [
          "gist"
        ]
      },
      "Resp_llm_functions_list": {
        "title": "Resp_llm_functions_list",
        "description": "ResponseData for llm/functions/list",
        "type": "object",
        "properties": {
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LLMFunctionView"
            }
          }
        },
        "required": [
          "functions"
        ]
      },
      "Resp_llm_meeting_result": {
        "title": "Resp_llm_meeting_result",
        "description": "ResponseData for llm/meeting/result",
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "Итог в Markdown - предпросмотр; сохраняет web по кнопке обычным обновлением совещания"
          },
          "truncated": {
            "type": "object",
            "additionalProperties": true,
            "description": "`{ what: 'transcript' }` - стенограмма длинная, учтена её последняя часть"
          },
          "runID": {
            "type": "string",
            "description": "#26967 Запуск - для итога «применён / закрыт» (`llm/outcome`)"
          }
        },
        "required": [
          "text",
          "truncated",
          "runID"
        ]
      },
      "Resp_llm_task_estimate": {
        "title": "Resp_llm_task_estimate",
        "description": "ResponseData for llm/task/estimate",
        "type": "object",
        "properties": {
          "started": {
            "type": "object",
            "additionalProperties": true,
            "description": "Оценка запущена в фоне; итог придёт уведомлением тому, кто запустил (агенту - нет)"
          }
        },
        "required": [
          "started"
        ]
      },
      "Resp_llm_task_evaluate-work": {
        "title": "Resp_llm_task_evaluate-work",
        "description": "ResponseData for llm/task/evaluate-work",
        "type": "object",
        "properties": {
          "started": {
            "type": "object",
            "additionalProperties": true,
            "description": "Оценка запущена в фоне; итог - уведомлением исполнителю и тому, кто запустил (агенту - нет)"
          }
        },
        "required": [
          "started"
        ]
      },
      "Resp_llm_version_notes": {
        "title": "Resp_llm_version_notes",
        "description": "ResponseData for llm/version/notes",
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "Заметки в Markdown - предпросмотр; сохраняет web обычным обновлением версии. Пусто - писать не о чем (#26685)"
          },
          "truncated": {
            "type": "object",
            "additionalProperties": true,
            "description": "`{ what: 'results' }` - версия большая, модель видела только названия задач"
          },
          "runID": {
            "type": [
              "string",
              "null"
            ],
            "description": "#26967 Запуск - для итога «применён / закрыт» (`llm/outcome`); null - модель не вызывалась: нет закрытых задач"
          }
        },
        "required": [
          "text",
          "truncated"
        ]
      },
      "Resp_logout_current": {
        "title": "Resp_logout_current",
        "description": "ResponseData for logout/current",
        "type": "object",
        "properties": {
          "terminated": {
            "type": "boolean"
          }
        },
        "required": [
          "terminated"
        ]
      },
      "Resp_logout_terminate-all": {
        "title": "Resp_logout_terminate-all",
        "description": "ResponseData for logout/terminate-all",
        "type": "object",
        "properties": {
          "terminated": {
            "type": "boolean"
          },
          "revoked": {
            "type": "number",
            "description": "#26809 Сколько подключений и токенов отозвано"
          }
        },
        "required": [
          "terminated",
          "revoked"
        ]
      },
      "Resp_logout_terminate": {
        "title": "Resp_logout_terminate",
        "description": "ResponseData for logout/terminate",
        "type": "object",
        "properties": {
          "terminated": {
            "type": "boolean"
          }
        },
        "required": [
          "terminated"
        ]
      },
      "Resp_meeting_delete": {
        "title": "Resp_meeting_delete",
        "description": "ResponseData for meeting/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_meeting_entity-worklogs": {
        "title": "Resp_meeting_entity-worklogs",
        "description": "ResponseData for meeting/entity-worklogs",
        "type": "object",
        "properties": {
          "years": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntityMeetingsByYears"
            },
            "description": "Совещания сгруппированные и сортированные по годам в убывающем порядке."
          }
        },
        "required": [
          "years"
        ]
      },
      "Resp_meeting_participant-suggestions": {
        "title": "Resp_meeting_participant-suggestions",
        "description": "ResponseData for meeting/participant-suggestions",
        "type": "object",
        "properties": {
          "users": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "options": {
            "type": "object",
            "additionalProperties": true,
            "description": "TS type: { /** * Список всех пользователей */ all?: string[] } & Partial<Record<Exclude<UserRole.Type, UserRole.Type.management>, string[]>>"
          }
        },
        "required": [
          "users",
          "options"
        ]
      },
      "Resp_meeting_propose-reschedule": {
        "title": "Resp_meeting_propose-reschedule",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_meeting_worklogs": {
        "title": "Resp_meeting_worklogs",
        "description": "ResponseData for meeting/worklogs",
        "type": "object",
        "properties": {
          "users": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "Статистика по пользователям"
          },
          "timeSpent": {
            "type": "number",
            "description": "Сумма времени всех worklogs по совещанию"
          },
          "moneySpent": {
            "type": "number",
            "description": "Сумма денег всех worklogs по совещанию"
          }
        },
        "required": [
          "users",
          "timeSpent",
          "moneySpent"
        ]
      },
      "Resp_notification_list": {
        "title": "Resp_notification_list",
        "description": "ResponseData for notification/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotificationItem"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_oauth_client_create": {
        "title": "Resp_oauth_client_create",
        "description": "ResponseData for oauth/client/create",
        "type": "object",
        "properties": {
          "client": {
            "$ref": "#/components/schemas/OAuthClientsServiceDto"
          },
          "clientSecret": {
            "type": "string",
            "description": "Секрет клиента - показывается один раз, в БД только его хэш"
          }
        },
        "required": [
          "client",
          "clientSecret"
        ]
      },
      "Resp_oauth_client_list": {
        "title": "Resp_oauth_client_list",
        "description": "ResponseData for oauth/client/list",
        "type": "object",
        "properties": {
          "clients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OAuthClientsServiceDto"
            }
          },
          "defaultRedirectUri": {
            "type": "string",
            "description": "Адрес возврата Gemini Enterprise - по умолчанию в форме выпуска"
          }
        },
        "required": [
          "clients",
          "defaultRedirectUri"
        ]
      },
      "Resp_oauth_connect_decide": {
        "title": "Resp_oauth_connect_decide",
        "description": "ResponseData for oauth/connect/decide",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Адрес завершения на MCP-сервере: веб-клиент переходит на него, MCP-сервер возвращает браузер в приложение"
          }
        },
        "required": [
          "url"
        ]
      },
      "Resp_oauth_connect_get": {
        "title": "Resp_oauth_connect_get",
        "allOf": [
          {
            "$ref": "#/components/schemas/OAuthConnectService_View"
          },
          {
            "type": "object",
            "properties": {
              "companies": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OAuthConnectService_Company"
                },
                "description": "Компании с действующим доступом пользователя: к ним можно подключить приложение"
              }
            },
            "required": [
              "companies"
            ]
          }
        ]
      },
      "Resp_projects_component_delete": {
        "title": "Resp_projects_component_delete",
        "description": "ResponseData for projects/component/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_projects_component_list": {
        "title": "Resp_projects_component_list",
        "description": "ResponseData for projects/component/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Component"
            }
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_projects_feature_delete": {
        "title": "Resp_projects_feature_delete",
        "description": "ResponseData for projects/feature/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_projects_feature_modules": {
        "title": "Resp_projects_feature_modules",
        "description": "ResponseData for projects/feature/modules",
        "type": "object",
        "properties": {
          "modules": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "components": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "modules",
          "components"
        ]
      },
      "Resp_projects_feature_status": {
        "title": "Resp_projects_feature_status",
        "allOf": [
          {
            "$ref": "#/components/schemas/CostInfo"
          },
          {
            "type": "object",
            "properties": {
              "progress": {
                "type": "number"
              },
              "isInBacklog": {
                "type": "boolean"
              }
            },
            "required": [
              "progress",
              "isInBacklog"
            ]
          }
        ]
      },
      "Resp_projects_feature_team": {
        "title": "Resp_projects_feature_team",
        "description": "ResponseData for projects/feature/team",
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataGroup"
            }
          },
          "timeSpent": {
            "type": "number"
          },
          "team": {
            "$ref": "#/components/schemas/Product_Team",
            "description": "Собственная команда фичи, НЕ команда продукта (#25596): аналитик фичи, пользователи\nс ворклогами в фиче и исполнители этапов незакрытых задач (userID -> ts последнего ворклога,\n0 - если времени не логировал)."
          }
        },
        "required": [
          "groups",
          "timeSpent",
          "team"
        ]
      },
      "Resp_projects_module_delete": {
        "title": "Resp_projects_module_delete",
        "description": "ResponseData for projects/module/delete",
        "type": "object",
        "properties": {
          "updated": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Module"
            }
          }
        },
        "required": [
          "updated"
        ]
      },
      "Resp_projects_module_list": {
        "title": "Resp_projects_module_list",
        "description": "ResponseData for projects/module/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Module"
            }
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_projects_product_delete": {
        "title": "Resp_projects_product_delete",
        "description": "ResponseData for projects/product/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_projects_product_filter-features": {
        "title": "Resp_projects_product_filter-features",
        "description": "ResponseData for projects/product/filter-features",
        "type": "object",
        "properties": {
          "features": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "features"
        ]
      },
      "Resp_projects_product_team": {
        "title": "Resp_projects_product_team",
        "description": "ResponseData for projects/product/team",
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataGroup"
            }
          },
          "timeSpent": {
            "type": "number"
          },
          "team": {
            "$ref": "#/components/schemas/Product_Team",
            "description": "Команда продукта (userID -> ts вступления): включает сотрудников без залогированного времени (#25596)"
          }
        },
        "required": [
          "groups",
          "timeSpent",
          "team"
        ]
      },
      "Resp_projects_project_delete": {
        "title": "Resp_projects_project_delete",
        "anyOf": [
          {
            "$ref": "#/components/schemas/Project"
          },
          {
            "type": "object",
            "properties": {},
            "additionalProperties": false,
            "description": "Empty object"
          }
        ]
      },
      "Resp_projects_project_repository_link": {
        "title": "Resp_projects_project_repository_link",
        "description": "ResponseData for projects/project/repository/link",
        "type": "object",
        "properties": {
          "link": {
            "$ref": "#/components/schemas/ProjectRepository"
          }
        },
        "required": [
          "link"
        ]
      },
      "Resp_projects_project_repository_list": {
        "title": "Resp_projects_project_repository_list",
        "description": "ResponseData for projects/project/repository/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectRepositoryDTO"
            }
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_projects_project_repository_unlink": {
        "title": "Resp_projects_project_repository_unlink",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_projects_task_delete": {
        "title": "Resp_projects_task_delete",
        "description": "ResponseData for projects/task/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_projects_task_list": {
        "title": "Resp_projects_task_list",
        "description": "ResponseData for projects/task/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskWithSpentTime"
            }
          },
          "categories": {
            "type": "object",
            "additionalProperties": true,
            "description": "Partial<Record<TaskCategory, number>>"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "filters": {
            "type": "object",
            "properties": {
              "statuses": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "TaskStatus[] assignees: string[] components: string"
                }
              }
            },
            "required": [
              "statuses"
            ]
          }
        },
        "required": [
          "list",
          "categories",
          "filters"
        ]
      },
      "Resp_projects_task_resolutes": {
        "title": "Resp_projects_task_resolutes",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_projects_task_search": {
        "title": "Resp_projects_task_search",
        "description": "ResponseData for projects/task/search",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskSearchItem"
            }
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_projects_task_work-evaluation": {
        "title": "Resp_projects_task_work-evaluation",
        "description": "ResponseData for projects/task/work-evaluation",
        "type": "object",
        "properties": {
          "workEvaluation": {
            "type": [
              "number",
              "null"
            ]
          },
          "correction": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskMeta_WorkCorrection"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Resp_projects_task_worklogs": {
        "title": "Resp_projects_task_worklogs",
        "description": "ResponseData for projects/task/worklogs",
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/Task"
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataGroup"
            }
          },
          "timeSpent": {
            "type": "number"
          }
        },
        "required": [
          "task",
          "groups",
          "timeSpent"
        ]
      },
      "Resp_projects_version_delete": {
        "title": "Resp_projects_version_delete",
        "description": "ResponseData for projects/version/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_projects_version_team": {
        "title": "Resp_projects_version_team",
        "description": "ResponseData for projects/version/team",
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataGroup"
            }
          },
          "timeSpent": {
            "type": "number"
          },
          "team": {
            "$ref": "#/components/schemas/Product_Team",
            "description": "Собственная команда версии, НЕ команда продукта (#25596): пользователи с ворклогами в версии\nи исполнители этапов незакрытых задач версии (userID -> ts последнего ворклога, 0 - если\nвремени не логировал)."
          }
        },
        "required": [
          "groups",
          "timeSpent",
          "team"
        ]
      },
      "Resp_relation_delete": {
        "title": "Resp_relation_delete",
        "description": "ResponseData for relation/delete",
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "Resp_session_handoff": {
        "title": "Resp_session_handoff",
        "description": "ResponseData for session/handoff",
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Одноразовый код для обмена на дочернюю сессию через `signin/handoff`"
          },
          "expTs": {
            "type": "number",
            "description": "Момент, после которого код недействителен (мс)"
          }
        },
        "required": [
          "code",
          "expTs"
        ]
      },
      "Resp_session_list": {
        "title": "Resp_session_list",
        "description": "ResponseData for session/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "Pick<Session, ID | parentID | expTs | createTs | lastActiveTs | ip | country | city | device>",
              "properties": {
                "ID": {
                  "type": "string",
                  "format": "uuid"
                },
                "parentID": {
                  "type": "string",
                  "format": "uuid"
                },
                "expTs": {},
                "createTs": {},
                "lastActiveTs": {},
                "ip": {},
                "country": {},
                "city": {},
                "device": {}
              },
              "required": [
                "ID",
                "parentID",
                "expTs",
                "createTs",
                "lastActiveTs",
                "ip",
                "country",
                "city",
                "device"
              ]
            },
            "description": "#26809 `parentID` - у дочерних handoff-сессий: веб показывает их внутри родителя"
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_signin_auth": {
        "title": "Resp_signin_auth",
        "description": "ResponseData for signin/auth",
        "type": "object",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/AuthSession"
          },
          "currentUser": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "company": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Company"
              },
              {
                "type": "null"
              }
            ]
          },
          "dictionaries": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Company_Dictionary"
              },
              {
                "type": "null"
              }
            ]
          },
          "availableCompanies": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CompanyItem"
            }
          }
        }
      },
      "Resp_signin_code": {
        "title": "Resp_signin_code",
        "description": "ResponseData for signin/code",
        "type": "object",
        "properties": {
          "codeStatus": {
            "$ref": "#/components/schemas/AuthSignInCode_Status",
            "description": "Статус отправки кода"
          }
        },
        "required": [
          "codeStatus"
        ]
      },
      "Resp_signin_company": {
        "title": "Resp_signin_company",
        "description": "ResponseData for signin/company",
        "type": "object",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/AuthSession"
          },
          "currentUser": {
            "$ref": "#/components/schemas/UserDto"
          },
          "company": {
            "$ref": "#/components/schemas/Company"
          },
          "dictionaries": {
            "$ref": "#/components/schemas/Company_Dictionary"
          }
        }
      },
      "Resp_signin_handoff": {
        "title": "Resp_signin_handoff",
        "description": "ResponseData for signin/handoff",
        "type": "object",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/AuthSession"
          },
          "currentUser": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "company": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Company"
              },
              {
                "type": "null"
              }
            ]
          },
          "dictionaries": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Company_Dictionary"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Resp_signin_methods": {
        "title": "Resp_signin_methods",
        "description": "ResponseData for signin/methods",
        "type": "object",
        "properties": {
          "phone": {
            "type": "object",
            "additionalProperties": true,
            "description": "Вход по телефону - всегда"
          },
          "email": {
            "type": "boolean",
            "description": "Вход по email: настроен почтовый канал"
          },
          "vkid": {
            "type": "boolean",
            "description": "#26810 Вход через VK ID: на стенде задан его `client_id`"
          },
          "yandex": {
            "type": "boolean",
            "description": "#26810 Вход через Яндекс ID: на стенде задан его `client_id`"
          }
        },
        "required": [
          "phone",
          "email",
          "vkid",
          "yandex"
        ]
      },
      "Resp_signin_provider_start": {
        "title": "Resp_signin_provider_start",
        "description": "ResponseData for signin/provider/start",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Адрес провайдера: веб переходит на него в том же окне"
          }
        },
        "required": [
          "url"
        ]
      },
      "Resp_sse_confirm-resync": {
        "title": "Resp_sse_confirm-resync",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_states_activity": {
        "title": "Resp_states_activity",
        "description": "ResponseData for states/activity",
        "type": "object",
        "properties": {
          "minStartDt": {
            "type": "string",
            "format": "date-time"
          },
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserActivityLogs"
            }
          },
          "tasks": {
            "type": "object",
            "additionalProperties": true
          },
          "meetings": {
            "type": "object",
            "additionalProperties": true
          },
          "products": {
            "type": "object",
            "additionalProperties": true
          },
          "repositories": {
            "type": "object",
            "additionalProperties": true,
            "description": "#27040 Репозитории записей о действиях через Git-интеграцию (создание ветки и др.)"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "list"
        ]
      },
      "Resp_states_dashboard-page": {
        "title": "Resp_states_dashboard-page",
        "description": "ResponseData for states/dashboard-page",
        "type": "object",
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskWithSpentTime"
            }
          },
          "meeting": {
            "$ref": "#/components/schemas/Meeting"
          }
        },
        "required": [
          "tasks"
        ]
      },
      "Resp_states_editor_task-details": {
        "title": "Resp_states_editor_task-details",
        "description": "ResponseData for states/editor/task-details",
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/TaskWithSpentTime"
          },
          "assigneesOptions": {
            "type": "object",
            "properties": {
              "approval": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "string[] work: string[] review: string[] test: string"
                }
              }
            },
            "required": [
              "approval"
            ]
          },
          "iterationsOptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Iteration"
            }
          },
          "usersIterationsPlans": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "task",
          "assigneesOptions",
          "iterationsOptions",
          "usersIterationsPlans"
        ]
      },
      "Resp_states_editor_version": {
        "title": "Resp_states_editor_version",
        "description": "ResponseData for states/editor/version",
        "type": "object",
        "properties": {
          "existingTitles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "version": {
            "$ref": "#/components/schemas/Version"
          },
          "features": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Feature"
            }
          },
          "resolvedBugs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Task"
            }
          }
        },
        "required": [
          "existingTitles",
          "version",
          "features",
          "resolvedBugs"
        ]
      },
      "Resp_states_entity-page": {
        "title": "Resp_states_entity-page",
        "description": "ResponseData for states/entity-page",
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/Task"
          },
          "bug": {
            "$ref": "#/components/schemas/Task"
          },
          "feature": {
            "$ref": "#/components/schemas/Feature"
          },
          "commitsCount": {
            "type": "number"
          },
          "chatMessagesCount": {
            "type": "number",
            "description": "Сообщений в чате сущности (обычные и шаблонные, без событий) - счётчик вкладки «Чат» (#26086). 0 -> undefined"
          },
          "featureComponents": {
            "type": "object",
            "properties": {
              "allIDs": {
                "type": "object",
                "additionalProperties": true,
                "description": "string[] // ID компонентов которые надо показать usedIDs?: string[] // ID компонентов которые используются (активные)"
              }
            },
            "required": [
              "allIDs"
            ]
          },
          "designs": {
            "$ref": "#/components/schemas/DesignMap",
            "description": "Словарь снимков открытой сущности (spec∪result). Всегда задан для feature/task/bug (#26146)."
          },
          "relations": {
            "$ref": "#/components/schemas/EntityRelationsData",
            "description": "Связи задачи/ошибки/фичи. Всегда задан для task/bug/feature, даже если рёбер нет (#26188)."
          },
          "costs": {
            "$ref": "#/components/schemas/CostInfo"
          }
        }
      },
      "Resp_states_kanban-page": {
        "title": "Resp_states_kanban-page",
        "description": "ResponseData for states/kanban-page",
        "type": "object",
        "properties": {
          "group": {
            "$ref": "#/components/schemas/DataGroup"
          }
        },
        "required": [
          "group"
        ]
      },
      "Resp_team_payment_disburse": {
        "title": "Resp_team_payment_disburse",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_team_payment_docs_list": {
        "title": "Resp_team_payment_docs_list",
        "description": "ResponseData for team/payment/docs/list",
        "type": "object",
        "properties": {
          "orgs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgDocs"
            }
          }
        },
        "required": [
          "orgs"
        ]
      },
      "Resp_team_payment_list": {
        "title": "Resp_team_payment_list",
        "description": "ResponseData for team/payment/list",
        "type": "object",
        "properties": {
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            }
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentAwardPart"
            },
            "description": "Части премии месяца (или сотрудника): и вошедшие в премию, и ещё не сформированные"
          },
          "hangingCarryoverIDs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "#26564 Непогашенные переносы: премия их месяца сформирована, но перенос не вошёл ни в одно формирование -\nу сотрудника не было трудоустройства (уволен). Администратор их списывает"
          }
        },
        "required": [
          "payments",
          "parts",
          "hangingCarryoverIDs"
        ]
      },
      "Resp_team_payment_month-users": {
        "title": "Resp_team_payment_month-users",
        "description": "ResponseData for team/payment/month-users",
        "type": "object",
        "properties": {
          "norms": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMonthNorms"
              },
              {
                "type": "null"
              }
            ],
            "description": "Рабочие дни и часы месяца по производственному календарю; null - календаря итераций на месяц нет"
          },
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentMonthUser"
            }
          }
        },
        "required": [
          "users"
        ]
      },
      "Resp_team_payment_months": {
        "title": "Resp_team_payment_months",
        "description": "ResponseData for team/payment/months",
        "type": "object",
        "properties": {
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentMonthStat"
            }
          }
        },
        "required": [
          "months"
        ]
      },
      "Resp_team_payment_recalc": {
        "title": "Resp_team_payment_recalc",
        "description": "ResponseData for team/payment/recalc",
        "type": "object",
        "properties": {
          "advance": {
            "type": "number",
            "description": "Сколько авансов создано или пересчитано"
          },
          "month": {
            "type": "number",
            "description": "Сколько сотрудников с пересчитанными основной выплатой и премией"
          }
        },
        "required": [
          "advance",
          "month"
        ]
      },
      "Resp_team_timeoff_delete": {
        "title": "Resp_team_timeoff_delete",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_team_timeoff_list": {
        "title": "Resp_team_timeoff_list",
        "description": "ResponseData for team/timeoff/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserTimeOff"
            }
          },
          "paidDaysLeft": {
            "type": "number"
          }
        },
        "required": [
          "list",
          "paidDaysLeft"
        ]
      },
      "Resp_team_timeoff_paid-days-left": {
        "title": "Resp_team_timeoff_paid-days-left",
        "description": "type ResponseData = number",
        "type": "number"
      },
      "Resp_team_timeoff_start-work-day": {
        "title": "Resp_team_timeoff_start-work-day",
        "description": "ResponseData for team/timeoff/start-work-day",
        "type": "object",
        "properties": {
          "startWorkDayKey": {
            "type": "number"
          }
        },
        "required": [
          "startWorkDayKey"
        ]
      },
      "Resp_team_user-products": {
        "title": "Resp_team_user-products",
        "description": "ResponseData for team/user-products",
        "type": "object",
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataProduct"
            }
          }
        },
        "required": [
          "products"
        ]
      },
      "Resp_test_reset": {
        "title": "Resp_test_reset",
        "description": "ResponseData for test/reset",
        "type": "object",
        "properties": {
          "cID": {
            "type": "string"
          },
          "ms": {
            "type": "number",
            "description": "Длительность сброса, мс"
          },
          "rows": {
            "type": "number",
            "description": "Восстановлено строк"
          }
        },
        "required": [
          "cID",
          "ms",
          "rows"
        ]
      },
      "Resp_user_archive-file": {
        "title": "Resp_user_archive-file",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "Resp_user_check": {
        "title": "Resp_user_check",
        "description": "ResponseData for user/check",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ]
      },
      "Resp_user_contact_code": {
        "title": "Resp_user_contact_code",
        "description": "ResponseData for user/contact/code",
        "type": "object",
        "properties": {
          "codeStatus": {
            "$ref": "#/components/schemas/AuthSignInCode_Status"
          }
        },
        "required": [
          "codeStatus"
        ]
      },
      "Resp_user_contact_confirm": {
        "title": "Resp_user_contact_confirm",
        "description": "ResponseData for user/contact/confirm",
        "type": "object",
        "properties": {
          "currentUser": {
            "$ref": "#/components/schemas/UserDto"
          }
        },
        "required": [
          "currentUser"
        ]
      },
      "Resp_user_contact_unlink": {
        "title": "Resp_user_contact_unlink",
        "description": "ResponseData for user/contact/unlink",
        "type": "object",
        "properties": {
          "currentUser": {
            "$ref": "#/components/schemas/UserDto"
          }
        },
        "required": [
          "currentUser"
        ]
      },
      "Resp_user_create": {
        "title": "Resp_user_create",
        "description": "ResponseData for user/create",
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          }
        },
        "required": [
          "user"
        ]
      },
      "Resp_user_passport-scan": {
        "title": "Resp_user_passport-scan",
        "description": "ResponseData for user/passport-scan",
        "type": "object",
        "properties": {
          "passport": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/User_DocumentPassport"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Resp_user_provider_complete": {
        "title": "Resp_user_provider_complete",
        "description": "ResponseData for user/provider/complete",
        "type": "object",
        "properties": {
          "currentUser": {
            "$ref": "#/components/schemas/UserDto"
          }
        },
        "required": [
          "currentUser"
        ]
      },
      "Resp_user_provider_link": {
        "title": "Resp_user_provider_link",
        "description": "ResponseData for user/provider/link",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Адрес провайдера: веб переходит на него в том же окне"
          }
        },
        "required": [
          "url"
        ]
      },
      "Resp_user_provider_unlink": {
        "title": "Resp_user_provider_unlink",
        "description": "ResponseData for user/provider/unlink",
        "type": "object",
        "properties": {
          "currentUser": {
            "$ref": "#/components/schemas/UserDto"
          }
        },
        "required": [
          "currentUser"
        ]
      },
      "Resp_user_search": {
        "title": "Resp_user_search",
        "description": "ResponseData for user/search",
        "type": "object",
        "properties": {
          "user": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserDto"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Resp_user_token_create": {
        "title": "Resp_user_token_create",
        "description": "ResponseData for user/token/create",
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Сырой токен - показывается ТОЛЬКО в этом ответе, дальше хранится лишь хэш"
          },
          "item": {
            "$ref": "#/components/schemas/ApiTokenDto"
          }
        },
        "required": [
          "token",
          "item"
        ]
      },
      "Resp_user_token_list": {
        "title": "Resp_user_token_list",
        "description": "ResponseData for user/token/list",
        "type": "object",
        "properties": {
          "list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          },
          "companies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Company"
            },
            "description": "#26809 Компании токенов списка и (в своём профиле) все компании с действующим доступом - для выпуска"
          }
        },
        "required": [
          "list",
          "companies"
        ]
      },
      "Resp_user_token_revoke": {
        "title": "Resp_user_token_revoke",
        "description": "ResponseData for user/token/revoke",
        "type": "object",
        "properties": {
          "item": {
            "$ref": "#/components/schemas/ApiTokenDto"
          }
        },
        "required": [
          "item"
        ]
      },
      "Resp_worklogs_roles": {
        "title": "Resp_worklogs_roles",
        "description": "ResponseData for worklogs/roles",
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataGroup"
            }
          },
          "timeSpent": {
            "type": "number"
          },
          "moneySpent": {
            "type": "number"
          },
          "lastDt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "groups",
          "timeSpent",
          "moneySpent",
          "lastDt"
        ]
      },
      "Resp_worklogs_status": {
        "title": "Resp_worklogs_status",
        "description": "ResponseData for worklogs/status",
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataGroup"
            }
          },
          "timeSpent": {
            "type": "number"
          },
          "moneySpent": {
            "type": "number"
          },
          "lastDt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "groups",
          "timeSpent",
          "moneySpent",
          "lastDt"
        ]
      },
      "Resp_worklogs_update": {
        "title": "Resp_worklogs_update",
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "Empty response object"
      },
      "UserDto": {
        "title": "UserDto",
        "description": "UserDto (DTO, based on User + extra fields at runtime)",
        "allOf": [
          {
            "$ref": "#/components/schemas/User"
          }
        ],
        "type": "object",
        "additionalProperties": true
      },
      "Privileges_Scheme": {
        "title": "Privileges_Scheme",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema Privileges_Scheme (inferred from ResponseData AST)"
      },
      "Privileges_UserSources": {
        "title": "Privileges_UserSources",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema Privileges_UserSources (inferred from ResponseData AST)"
      },
      "CurrencyService_ConvertResult": {
        "title": "CurrencyService_ConvertResult",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema CurrencyService_ConvertResult (inferred from ResponseData AST)"
      },
      "DesignMap": {
        "title": "DesignMap",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema DesignMap (inferred from ResponseData AST)"
      },
      "DesignFileCheck": {
        "title": "DesignFileCheck",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema DesignFileCheck (inferred from ResponseData AST)"
      },
      "LLMBugDuplicates_Result": {
        "title": "LLMBugDuplicates_Result",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema LLMBugDuplicates_Result (inferred from ResponseData AST)"
      },
      "LLMSemanticSearch_Result": {
        "title": "LLMSemanticSearch_Result",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema LLMSemanticSearch_Result (inferred from ResponseData AST)"
      },
      "OAuthConnectService_View": {
        "title": "OAuthConnectService_View",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema OAuthConnectService_View (inferred from ResponseData AST)"
      },
      "CostInfo": {
        "title": "CostInfo",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema CostInfo (inferred from ResponseData AST)"
      },
      "TaskWithSpentTime": {
        "title": "TaskWithSpentTime",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema TaskWithSpentTime (inferred from ResponseData AST)"
      },
      "Relation": {
        "title": "Relation",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema Relation (inferred from ResponseData AST)"
      },
      "EntityRelationsData": {
        "title": "EntityRelationsData",
        "type": "object",
        "additionalProperties": true,
        "description": "Schema EntityRelationsData (inferred from ResponseData AST)"
      },
      "WorklogsDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "WorklogsDeleteParams",
        "description": "Query/header params for `worklogs/delete`"
      },
      "WorklogsRolesParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/SystemEntityType"
          }
        },
        "required": [
          "ID",
          "type"
        ],
        "title": "WorklogsRolesParams",
        "description": "Query/header params for `worklogs/roles`"
      },
      "WorklogsStatusParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/SystemEntityType"
          }
        },
        "required": [
          "ID",
          "type"
        ],
        "title": "WorklogsStatusParams",
        "description": "Query/header params for `worklogs/status`"
      },
      "WorklogsUpdateParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "title": "WorklogsUpdateParams",
        "description": "Query/header params for `worklogs/update`"
      },
      "WorklogsUpdateBody": {
        "type": "object",
        "properties": {
          "select": {
            "type": "object",
            "properties": {
              "entityID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "entityType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SystemEntityType"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "worklogID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "startDk": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Day key (YYYYMMDD or internal day index)"
              },
              "endDk": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Day key (YYYYMMDD or internal day index)"
              },
              "roleType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UserRole_Type"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "update": {
            "type": "object",
            "properties": {
              "time": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "title": "WorklogsUpdateBody",
        "description": "Partial body (Valid.Patch) for `worklogs/update` — все поля опциональны"
      },
      "UserTokenCreateBody": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "expDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "scopes": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ApiToken_type"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "title"
        ],
        "title": "UserTokenCreateBody",
        "description": "JSON body for `user/token/create`"
      },
      "UserTokenListParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "title": "UserTokenListParams",
        "description": "Query/header params for `user/token/list`"
      },
      "UserTokenRevokeParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "UserTokenRevokeParams",
        "description": "Query/header params for `user/token/revoke`"
      },
      "UserProviderCompleteBody": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string"
          }
        },
        "required": [
          "ticket"
        ],
        "title": "UserProviderCompleteBody",
        "description": "JSON body for `user/provider/complete`"
      },
      "UserProviderLinkBody": {
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/User_Provider"
          }
        },
        "required": [
          "provider"
        ],
        "title": "UserProviderLinkBody",
        "description": "JSON body for `user/provider/link`"
      },
      "UserProviderUnlinkParams": {
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/User_Provider"
          }
        },
        "required": [
          "provider"
        ],
        "title": "UserProviderUnlinkParams",
        "description": "Query/header params for `user/provider/unlink`"
      },
      "user_contact_code_kind": {
        "type": "string",
        "enum": [
          "phone",
          "email"
        ],
        "x-enum-varnames": [
          "phone",
          "email"
        ],
        "title": "user_contact_code_kind",
        "description": "`phone` = \"phone\", `email` = \"email\""
      },
      "UserContactCodeParams": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/user_contact_code_kind"
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "value"
        ],
        "title": "UserContactCodeParams",
        "description": "Query/header params for `user/contact/code`"
      },
      "UserContactConfirmParams": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/user_contact_code_kind"
          },
          "value": {
            "type": "string"
          },
          "code": {
            "type": "integer"
          }
        },
        "required": [
          "kind",
          "value",
          "code"
        ],
        "title": "UserContactConfirmParams",
        "description": "Query/header params for `user/contact/confirm`"
      },
      "UserContactUnlinkParams": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/user_contact_code_kind"
          }
        },
        "required": [
          "kind"
        ],
        "title": "UserContactUnlinkParams",
        "description": "Query/header params for `user/contact/unlink`"
      },
      "user_archive_file_docsEmployment": {
        "type": "string",
        "enum": [
          "passportRf",
          "idCard",
          "voennyjBilet",
          "workPermit",
          "vnzh",
          "migrationCard"
        ],
        "x-enum-varnames": [
          "passportRf",
          "idCard",
          "voennyjBilet",
          "workPermit",
          "vnzh",
          "migrationCard"
        ],
        "title": "user_archive_file_docsEmployment",
        "description": "`passportRf` = \"passportRf\", `idCard` = \"idCard\", `voennyjBilet` = \"voennyjBilet\", `workPermit` = \"workPermit\", `vnzh` = \"vnzh\", `migrationCard` = \"migrationCard\""
      },
      "UserArchiveFileParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "docsEmployment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/user_archive_file_docsEmployment"
              },
              {
                "type": "null"
              }
            ]
          },
          "docsLibrary": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "UserArchiveFileParams",
        "description": "Query/header params for `user/archive-file`"
      },
      "UserCheckParams": {
        "type": "object",
        "properties": {
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "format": "email"
          },
          "zoomEmail": {
            "type": [
              "string",
              "null"
            ],
            "format": "email"
          }
        },
        "title": "UserCheckParams",
        "description": "Query/header params for `user/check`"
      },
      "UserCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "auth": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "avatarFID": {
            "type": "string",
            "format": "uuid"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "patronymic": {
            "type": [
              "string",
              "null"
            ]
          },
          "gender": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/User_gender"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactInfo": {
            "type": [
              "string",
              "null"
            ]
          },
          "dateOfBirth": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "address": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "streetAddress": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ]
          },
          "meetingInfo": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "zoomEmail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "position": {
            "type": [
              "string",
              "null"
            ]
          },
          "hourCost": {
            "type": "number"
          },
          "docsEmployment": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "docsLibrary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isDraft": {
            "type": "boolean"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "UserCreateBody",
        "description": "Partial body (Valid.Patch) for `user/create` — все поля опциональны"
      },
      "UserInfoParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "UserInfoParams",
        "description": "Query/header params for `user/info`"
      },
      "UserPassportScanParams": {
        "type": "object",
        "properties": {
          "firstPageFID": {
            "type": "string",
            "format": "uuid"
          },
          "secondPageFID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "firstPageFID",
          "secondPageFID"
        ],
        "title": "UserPassportScanParams",
        "description": "Query/header params for `user/passport-scan`"
      },
      "UserSearchParams": {
        "type": "object",
        "properties": {
          "phone": {
            "type": "string",
            "description": "Phone number"
          }
        },
        "required": [
          "phone"
        ],
        "title": "UserSearchParams",
        "description": "Query/header params for `user/search`"
      },
      "UserUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "UserUpdateParams",
        "description": "Query/header params for `user/update`"
      },
      "UserUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "auth": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "avatarFID": {
            "type": "string",
            "format": "uuid"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "patronymic": {
            "type": [
              "string",
              "null"
            ]
          },
          "gender": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/User_gender"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactInfo": {
            "type": [
              "string",
              "null"
            ]
          },
          "dateOfBirth": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "address": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "streetAddress": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ]
          },
          "meetingInfo": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "zoomEmail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "position": {
            "type": [
              "string",
              "null"
            ]
          },
          "hourCost": {
            "type": "number"
          },
          "docsEmployment": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "docsLibrary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isDraft": {
            "type": "boolean"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "UserUpdateBody",
        "description": "Partial body (Valid.Patch) for `user/update` — все поля опциональны"
      },
      "TestFixtureParams": {
        "type": "object",
        "properties": {
          "slot": {
            "type": "integer"
          }
        },
        "required": [
          "slot"
        ],
        "title": "TestFixtureParams",
        "description": "Query/header params for `test/fixture`"
      },
      "TestResetParams": {
        "type": "object",
        "properties": {
          "slot": {
            "type": "integer"
          }
        },
        "required": [
          "slot"
        ],
        "title": "TestResetParams",
        "description": "Query/header params for `test/reset`"
      },
      "TestSessionParams": {
        "type": "object",
        "properties": {
          "slot": {
            "type": "integer"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "slot"
        ],
        "title": "TestSessionParams",
        "description": "Query/header params for `test/session`"
      },
      "TeamTimeoffCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "roleID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "paid": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "sickLeaveID": {
            "type": [
              "string",
              "null"
            ]
          },
          "statementFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementOrgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementSentTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "year": {
            "type": "integer"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "daysCount": {
            "type": "integer"
          },
          "startWorkDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "userNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "userAvailable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "adminNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "adminUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "payment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserTimeOff_payment"
              },
              {
                "type": "null"
              }
            ]
          },
          "statement": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "TeamTimeoffCreateBody",
        "description": "Partial body (Valid.Patch) for `team/timeoff/create` — все поля опциональны"
      },
      "TeamTimeoffDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "TeamTimeoffDeleteParams",
        "description": "Query/header params for `team/timeoff/delete`"
      },
      "TeamTimeoffListParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "daykey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          }
        },
        "title": "TeamTimeoffListParams",
        "description": "Query/header params for `team/timeoff/list`"
      },
      "TeamTimeoffPaidDaysLeftParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "daykey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          }
        },
        "required": [
          "userID",
          "daykey"
        ],
        "title": "TeamTimeoffPaidDaysLeftParams",
        "description": "Query/header params for `team/timeoff/paid-days-left`"
      },
      "team_timeoff_start_work_day_type": {
        "type": "string",
        "enum": [
          "vacation",
          "sick"
        ],
        "x-enum-varnames": [
          "vacation",
          "sick"
        ],
        "title": "team_timeoff_start_work_day_type",
        "description": "`vacation` = \"vacation\", `sick` = \"sick\""
      },
      "TeamTimeoffStartWorkDayParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "daysCount": {
            "type": "integer"
          },
          "type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/team_timeoff_start_work_day_type"
              },
              {
                "type": "null"
              }
            ],
            "default": "vacation"
          }
        },
        "required": [
          "userID",
          "startDayKey",
          "daysCount"
        ],
        "title": "TeamTimeoffStartWorkDayParams",
        "description": "Query/header params for `team/timeoff/start-work-day`"
      },
      "TeamTimeoffStatementMetaParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/team_timeoff_start_work_day_type"
          },
          "paid": {
            "type": "boolean"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          }
        },
        "required": [
          "userID",
          "type",
          "paid",
          "startDayKey"
        ],
        "title": "TeamTimeoffStatementMetaParams",
        "description": "Query/header params for `team/timeoff/statement-meta`"
      },
      "team_timeoff_statement_pdf_type": {
        "type": "string",
        "enum": [
          "vacation"
        ],
        "x-enum-varnames": [
          "vacation"
        ],
        "title": "team_timeoff_statement_pdf_type",
        "description": "`vacation` = \"vacation\""
      },
      "TeamTimeoffStatementPdfParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/team_timeoff_statement_pdf_type"
          },
          "paid": {
            "type": "boolean"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "daysCount": {
            "type": "integer"
          }
        },
        "required": [
          "userID",
          "type",
          "paid",
          "startDayKey",
          "daysCount"
        ],
        "title": "TeamTimeoffStatementPdfParams",
        "description": "Query/header params for `team/timeoff/statement-pdf`"
      },
      "TeamTimeoffUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "TeamTimeoffUpdateParams",
        "description": "Query/header params for `team/timeoff/update`"
      },
      "TeamTimeoffUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "roleID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "paid": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "sickLeaveID": {
            "type": [
              "string",
              "null"
            ]
          },
          "statementFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementOrgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementSentTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "year": {
            "type": "integer"
          },
          "startDayKey": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "daysCount": {
            "type": "integer"
          },
          "startWorkDayKey": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "userNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "userAvailable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "adminNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "adminUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "payment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserTimeOff_payment"
              },
              {
                "type": "null"
              }
            ]
          },
          "statement": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "TeamTimeoffUpdateBody",
        "description": "Partial body (Valid.Patch) for `team/timeoff/update` — все поля опциональны"
      },
      "TeamRoleCreateParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "TeamRoleCreateParams",
        "description": "Query/header params for `team/role/create`"
      },
      "TeamRoleCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/UserRole_Type"
          },
          "level": {
            "$ref": "#/components/schemas/UserRole_Level"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "award": {
            "type": "integer"
          },
          "salary": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "startDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "trialEndDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "note": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "isMain": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "TeamRoleCreateBody",
        "description": "Partial body (Valid.Patch) for `team/role/create` — все поля опциональны"
      },
      "TeamRoleDeleteParams": {
        "type": "object",
        "properties": {
          "roleID": {
            "type": "string",
            "format": "uuid"
          },
          "endD": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "roleID"
        ],
        "title": "TeamRoleDeleteParams",
        "description": "Query/header params for `team/role/delete`"
      },
      "TeamRoleUpdateParams": {
        "type": "object",
        "properties": {
          "roleID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "roleID"
        ],
        "title": "TeamRoleUpdateParams",
        "description": "Query/header params for `team/role/update`"
      },
      "TeamRoleUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/UserRole_Type"
          },
          "level": {
            "$ref": "#/components/schemas/UserRole_Level"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "award": {
            "type": "integer"
          },
          "salary": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "startDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "trialEndDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "note": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "isMain": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "TeamRoleUpdateBody",
        "description": "Partial body (Valid.Patch) for `team/role/update` — все поля опциональны"
      },
      "team_payment_docs_download_kind": {
        "type": "string",
        "enum": [
          "advance",
          "monthShort",
          "monthFull",
          "awardOrder",
          "bonusOrder"
        ],
        "x-enum-varnames": [
          "advance",
          "monthShort",
          "monthFull",
          "awardOrder",
          "bonusOrder"
        ],
        "title": "team_payment_docs_download_kind",
        "description": "`advance` = \"advance\", `monthShort` = \"monthShort\", `monthFull` = \"monthFull\", `awardOrder` = \"awardOrder\", `bonusOrder` = \"bonusOrder\""
      },
      "TeamPaymentDocsDownloadParams": {
        "type": "object",
        "properties": {
          "monthDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "kind": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/team_payment_docs_download_kind"
              },
              {
                "type": "null"
              }
            ]
          },
          "statementTimeOffID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "title": "TeamPaymentDocsDownloadParams",
        "description": "Query/header params for `team/payment/docs/download`"
      },
      "TeamPaymentDocsListParams": {
        "type": "object",
        "properties": {
          "monthDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          }
        },
        "required": [
          "monthDK"
        ],
        "title": "TeamPaymentDocsListParams",
        "description": "Query/header params for `team/payment/docs/list`"
      },
      "TeamPaymentDocsSendBody": {
        "type": "object",
        "properties": {
          "monthDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "statementTimeOffID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "kind": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/team_payment_docs_download_kind"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "TeamPaymentDocsSendBody",
        "description": "JSON body for `team/payment/docs/send`"
      },
      "TeamPaymentAwardPartCreateBody": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/PaymentAwardPart_MANUAL_TYPES"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0.01
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 300
          },
          "monthDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "resource": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "worklogID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "entityID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "entityType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SystemEntityType"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "startDk": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Day key (YYYYMMDD or internal day index)"
              },
              "endDk": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Day key (YYYYMMDD or internal day index)"
              },
              "roleType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UserRole_Type"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "percent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 200
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          }
        },
        "required": [
          "userID",
          "type"
        ],
        "title": "TeamPaymentAwardPartCreateBody",
        "description": "JSON body for `team/payment/award-part/create`"
      },
      "TeamPaymentAwardPartDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "TeamPaymentAwardPartDeleteParams",
        "description": "Query/header params for `team/payment/award-part/delete`"
      },
      "TeamPaymentAwardPartPreviewBody": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "resource": {
            "type": "object",
            "properties": {
              "worklogID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "entityID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "entityType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SystemEntityType"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "startDk": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Day key (YYYYMMDD or internal day index)"
              },
              "endDk": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Day key (YYYYMMDD or internal day index)"
              },
              "roleType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UserRole_Type"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200
          }
        },
        "required": [
          "userID",
          "resource",
          "percent"
        ],
        "title": "TeamPaymentAwardPartPreviewBody",
        "description": "JSON body for `team/payment/award-part/preview`"
      },
      "TeamPaymentAwardPartUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "TeamPaymentAwardPartUpdateParams",
        "description": "Query/header params for `team/payment/award-part/update`"
      },
      "TeamPaymentAwardPartUpdateBody": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "minimum": 0.01
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200
          }
        },
        "title": "TeamPaymentAwardPartUpdateBody",
        "description": "Partial body (Valid.Patch) for `team/payment/award-part/update` — все поля опциональны"
      },
      "team_payment_create_Body_type": {
        "type": "integer",
        "enum": [
          30,
          40,
          50,
          10,
          20,
          15
        ],
        "x-enum-varnames": [
          "30",
          "40",
          "50",
          "10",
          "20",
          "15"
        ],
        "title": "team_payment_create_Body_type",
        "description": "`30` = 30, `40` = 40, `50` = 50, `10` = 10, `20` = 20, `15` = 15"
      },
      "TeamPaymentCreateBody": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/team_payment_create_Body_type"
          },
          "amountTotal": {
            "type": "number",
            "minimum": 0.01
          },
          "amountPaid": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "paid": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "userID",
          "type",
          "amountTotal"
        ],
        "title": "TeamPaymentCreateBody",
        "description": "JSON body for `team/payment/create`"
      },
      "TeamPaymentDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "TeamPaymentDeleteParams",
        "description": "Query/header params for `team/payment/delete`"
      },
      "TeamPaymentDisburseBody": {
        "type": "object",
        "properties": {
          "IDs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1
          }
        },
        "required": [
          "IDs"
        ],
        "title": "TeamPaymentDisburseBody",
        "description": "JSON body for `team/payment/disburse`"
      },
      "TeamPaymentListParams": {
        "type": "object",
        "properties": {
          "monthDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Payment_Type"
              },
              {
                "type": "null"
              }
            ]
          },
          "paid": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "noOrg": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "employmentType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Payment_employmentType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "TeamPaymentListParams",
        "description": "Query/header params for `team/payment/list`"
      },
      "TeamPaymentMonthUsersParams": {
        "type": "object",
        "properties": {
          "monthDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          }
        },
        "required": [
          "monthDK"
        ],
        "title": "TeamPaymentMonthUsersParams",
        "description": "Query/header params for `team/payment/month-users`"
      },
      "TeamPaymentMonthsParams": {
        "type": "object",
        "properties": {
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "title": "TeamPaymentMonthsParams",
        "description": "Query/header params for `team/payment/months`"
      },
      "TeamPaymentRecalcParams": {
        "type": "object",
        "properties": {
          "monthDK": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "monthDK"
        ],
        "title": "TeamPaymentRecalcParams",
        "description": "Query/header params for `team/payment/recalc`"
      },
      "TeamPaymentUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "TeamPaymentUpdateParams",
        "description": "Query/header params for `team/payment/update`"
      },
      "TeamPaymentUpdateBody": {
        "type": "object",
        "properties": {
          "amountTotal": {
            "type": "number"
          },
          "amountPaid": {
            "type": "number"
          },
          "paid": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "changeNote": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          }
        },
        "title": "TeamPaymentUpdateBody",
        "description": "Partial body (Valid.Patch) for `team/payment/update` — все поля опциональны"
      },
      "TeamUserProductsParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "TeamUserProductsParams",
        "description": "Query/header params for `team/user-products`"
      },
      "StatesEditorTaskDetailsParams": {
        "type": "object",
        "properties": {
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "category": {
            "type": [
              "integer",
              "null"
            ]
          },
          "taskID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "title": "StatesEditorTaskDetailsParams",
        "description": "Query/header params for `states/editor/task-details`"
      },
      "StatesEditorVersionParams": {
        "type": "object",
        "properties": {
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "productID"
        ],
        "title": "StatesEditorVersionParams",
        "description": "Query/header params for `states/editor/version`"
      },
      "states_activity_resTypeGroup": {
        "type": "string",
        "enum": [
          "project",
          "product",
          "version",
          "feature",
          "task",
          "bug",
          "meeting",
          "chat",
          "profile",
          "administration",
          "worklog"
        ],
        "x-enum-varnames": [
          "project",
          "product",
          "version",
          "feature",
          "task",
          "bug",
          "meeting",
          "chat",
          "profile",
          "administration",
          "worklog"
        ],
        "title": "states_activity_resTypeGroup",
        "description": "`project` = \"project\", `product` = \"product\", `version` = \"version\", `feature` = \"feature\", `task` = \"task\", `bug` = \"bug\", `meeting` = \"meeting\", `chat` = \"chat\", `profile` = \"profile\", `administration` = \"administration\", `worklog` = \"worklog\""
      },
      "states_activity_dtRange": {
        "type": "string",
        "enum": [
          "24h",
          "iteration",
          "month",
          "range"
        ],
        "x-enum-varnames": [
          "24h",
          "iteration",
          "month",
          "range"
        ],
        "title": "states_activity_dtRange",
        "description": "`24h` = \"24h\", `iteration` = \"iteration\", `month` = \"month\", `range` = \"range\""
      },
      "StatesActivityParams": {
        "type": "object",
        "properties": {
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "author": {
            "type": [
              "string",
              "null"
            ]
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "resID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "resTypeGroup": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/states_activity_resTypeGroup"
              },
              {
                "type": "null"
              }
            ]
          },
          "dtRange": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/states_activity_dtRange"
              },
              {
                "type": "null"
              }
            ],
            "default": "24h"
          },
          "startDt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finishDt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "title": "StatesActivityParams",
        "description": "Query/header params for `states/activity`"
      },
      "StatesDashboardPageParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "StatesDashboardPageParams",
        "description": "Query/header params for `states/dashboard-page`"
      },
      "states_entity_costs_type": {
        "type": "string",
        "enum": [
          "task",
          "bug",
          "feature"
        ],
        "x-enum-varnames": [
          "task",
          "bug",
          "feature"
        ],
        "title": "states_entity_costs_type",
        "description": "`task` = \"task\", `bug` = \"bug\", `feature` = \"feature\""
      },
      "StatesEntityCostsParams": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/states_entity_costs_type"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "iterationKey": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "type",
          "ID"
        ],
        "title": "StatesEntityCostsParams",
        "description": "Query/header params for `states/entity-costs`"
      },
      "StatesEntityPageParams": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "iterationKey": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "type",
          "ID"
        ],
        "title": "StatesEntityPageParams",
        "description": "Query/header params for `states/entity-page`"
      },
      "StatesKanbanPageParams": {
        "type": "object",
        "properties": {
          "iterationKey": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "title": "StatesKanbanPageParams",
        "description": "Query/header params for `states/kanban-page`"
      },
      "SigninProviderCompleteBody": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string"
          }
        },
        "required": [
          "ticket"
        ],
        "title": "SigninProviderCompleteBody",
        "description": "JSON body for `signin/provider/complete`"
      },
      "SigninProviderStartBody": {
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/User_Provider"
          }
        },
        "required": [
          "provider"
        ],
        "title": "SigninProviderStartBody",
        "description": "JSON body for `signin/provider/start`"
      },
      "SigninAuthParams": {
        "type": "object",
        "properties": {
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": "integer"
          }
        },
        "required": [
          "code"
        ],
        "title": "SigninAuthParams",
        "description": "Query/header params for `signin/auth`"
      },
      "SigninCodeParams": {
        "type": "object",
        "properties": {
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "SigninCodeParams",
        "description": "Query/header params for `signin/code`"
      },
      "SigninCompanyParams": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string"
          }
        },
        "required": [
          "cID"
        ],
        "title": "SigninCompanyParams",
        "description": "Query/header params for `signin/company`"
      },
      "SigninHandoffBody": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          }
        },
        "required": [
          "code"
        ],
        "title": "SigninHandoffBody",
        "description": "JSON body for `signin/handoff`"
      },
      "SigninMethodsParams": {
        "type": "object",
        "properties": {},
        "title": "SigninMethodsParams",
        "description": "Query/header params for `signin/methods`"
      },
      "SessionListParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "SessionListParams",
        "description": "Query/header params for `session/list`"
      },
      "RelationCreateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "fromID": {
            "type": "string",
            "format": "uuid"
          },
          "fromType": {
            "type": "string"
          },
          "toID": {
            "type": "string",
            "format": "uuid"
          },
          "toType": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/RelationType",
            "default": "related"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "RelationCreateBody",
        "description": "Partial body (Valid.Patch) for `relation/create` — все поля опциональны"
      },
      "RelationDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "RelationDeleteParams",
        "description": "Query/header params for `relation/delete`"
      },
      "relation_list_refType": {
        "type": "string",
        "enum": [
          "task",
          "bug",
          "meeting"
        ],
        "x-enum-varnames": [
          "task",
          "bug",
          "meeting"
        ],
        "title": "relation_list_refType",
        "description": "`task` = \"task\", `bug` = \"bug\", `meeting` = \"meeting\""
      },
      "RelationListParams": {
        "type": "object",
        "properties": {
          "refID": {
            "type": "string",
            "format": "uuid"
          },
          "refType": {
            "$ref": "#/components/schemas/relation_list_refType"
          }
        },
        "required": [
          "refID",
          "refType"
        ],
        "title": "RelationListParams",
        "description": "Query/header params for `relation/list`"
      },
      "RelationUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "RelationUpdateParams",
        "description": "Query/header params for `relation/update`"
      },
      "RelationUpdateBody": {
        "type": "object",
        "properties": {
          "type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RelationType"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "title": "RelationUpdateBody",
        "description": "JSON body for `relation/update`"
      },
      "ProjectsVersionCreateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "major": {
            "type": "integer"
          },
          "minor": {
            "type": "integer"
          },
          "build": {
            "type": [
              "integer",
              "null"
            ]
          },
          "resolvedBugs": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "notes": {
            "type": "string"
          },
          "isDone": {
            "type": "boolean"
          },
          "isPublished": {
            "type": "boolean"
          },
          "releaseDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "design": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "fileUrl": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updateDT": {
            "type": "string",
            "format": "date-time"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsVersionCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/version/create` — все поля опциональны"
      },
      "ProjectsVersionDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsVersionDeleteParams",
        "description": "Query/header params for `projects/version/delete`"
      },
      "ProjectsVersionTeamParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsVersionTeamParams",
        "description": "Query/header params for `projects/version/team`"
      },
      "ProjectsVersionUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsVersionUpdateParams",
        "description": "Query/header params for `projects/version/update`"
      },
      "ProjectsVersionUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "major": {
            "type": "integer"
          },
          "minor": {
            "type": "integer"
          },
          "build": {
            "type": [
              "integer",
              "null"
            ]
          },
          "resolvedBugs": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "notes": {
            "type": "string"
          },
          "isDone": {
            "type": "boolean"
          },
          "isPublished": {
            "type": "boolean"
          },
          "releaseDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "design": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "fileUrl": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updateDT": {
            "type": "string",
            "format": "date-time"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsVersionUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/version/update` — все поля опциональны"
      },
      "ProjectsTaskCreateBody": {
        "type": "object",
        "properties": {
          "fields": {
            "type": "object",
            "properties": {
              "cID": {
                "type": "string",
                "format": "uuid"
              },
              "projectID": {
                "type": "string",
                "format": "uuid"
              },
              "productID": {
                "type": "string",
                "format": "uuid"
              },
              "versionID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "featureID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "ID": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "$ref": "#/components/schemas/TaskStatus"
              },
              "state": {
                "$ref": "#/components/schemas/TaskState"
              },
              "category": {
                "$ref": "#/components/schemas/TaskCategory"
              },
              "type": {
                "$ref": "#/components/schemas/TaskType"
              },
              "priority": {
                "$ref": "#/components/schemas/TaskPriority"
              },
              "urgently": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "title": {
                "type": "string"
              },
              "searchTitle": {
                "type": "string"
              },
              "key": {
                "type": "integer"
              },
              "currentAssignee": {
                "type": "string"
              },
              "ord": {
                "type": "integer",
                "description": "Unix timestamp in milliseconds"
              },
              "spec": {
                "type": "string"
              },
              "gist": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "modules": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              },
              "components": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              },
              "approvalAssignee": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workAssignee": {
                "type": "string"
              },
              "workIterationKey": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "workTimePlan": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "workEvaluation": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "reviewAssignee": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "testAssignee": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "resolutionVersionID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "resolutionType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TaskResolutionType"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolutionNote": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "result": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "meta": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "git": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "createDT": {
                "type": "string",
                "format": "date-time"
              },
              "creatorUID": {
                "type": "string",
                "format": "uuid"
              },
              "stage": {
                "$ref": "#/components/schemas/TaskStageType"
              },
              "browser": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TaskBrowser"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bugType": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TaskBugType"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "build": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "devices": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {}
              },
              "labels": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {}
              },
              "fuzzy": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "updTS": {
                "type": "integer",
                "description": "Unix timestamp in milliseconds"
              },
              "isDeleted": {
                "type": [
                  "boolean",
                  "null"
                ],
                "default": false
              },
              "deletedTS": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "updUID": {
                "type": "string"
              },
              "rejectUID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rejectTS": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              }
            },
            "required": [
              "cID",
              "projectID",
              "productID",
              "ID",
              "status",
              "state",
              "category",
              "type",
              "priority",
              "title",
              "searchTitle",
              "key",
              "currentAssignee",
              "ord",
              "spec",
              "workAssignee",
              "createDT",
              "creatorUID",
              "stage",
              "updTS",
              "updUID"
            ]
          },
          "relations": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          }
        },
        "title": "ProjectsTaskCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/task/create` — все поля опциональны"
      },
      "ProjectsTaskDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsTaskDeleteParams",
        "description": "Query/header params for `projects/task/delete`"
      },
      "ProjectsTaskGetParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "key": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "title": "ProjectsTaskGetParams",
        "description": "Query/header params for `projects/task/get`"
      },
      "projects_task_list_sortBy": {
        "type": "string",
        "enum": [
          "ord",
          "createDT"
        ],
        "x-enum-varnames": [
          "ord",
          "createDT"
        ],
        "title": "projects_task_list_sortBy",
        "description": "`ord` = \"ord\", `createDT` = \"createDT\""
      },
      "ProjectsTaskListParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EntityType"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionVersionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "allNestedTasks": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "notClosed": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "category": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskCategory"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "components": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "currentAssignee": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^(any|[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12})$"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "sortBy": {
            "$ref": "#/components/schemas/projects_task_list_sortBy",
            "default": "ord"
          }
        },
        "title": "ProjectsTaskListParams",
        "description": "Query/header params for `projects/task/list`"
      },
      "ProjectsTaskReopenParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsTaskReopenParams",
        "description": "Query/header params for `projects/task/reopen`"
      },
      "ProjectsTaskReopenBody": {
        "type": "object",
        "properties": {
          "resolutionType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskResolutionType"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "workAssignee": {
            "type": "string"
          },
          "workIterationKey": {
            "type": "integer"
          },
          "workTimePlan": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "workAssignee",
          "workIterationKey"
        ],
        "title": "ProjectsTaskReopenBody",
        "description": "JSON body for `projects/task/reopen`"
      },
      "ProjectsTaskResolutesParams": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "type",
          "ID"
        ],
        "title": "ProjectsTaskResolutesParams",
        "description": "Query/header params for `projects/task/resolutes`"
      },
      "ProjectsTaskSearchParams": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "prjID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "sourceTaskID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "relationType": {
            "type": [
              "string",
              "null"
            ]
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 50
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskCategory"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "query"
        ],
        "title": "ProjectsTaskSearchParams",
        "description": "Query/header params for `projects/task/search`"
      },
      "ProjectsTaskSwitchParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "transition": {
            "$ref": "#/components/schemas/TaskTransition"
          },
          "resolutionType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskResolutionType"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ID",
          "transition"
        ],
        "title": "ProjectsTaskSwitchParams",
        "description": "Query/header params for `projects/task/switch`"
      },
      "ProjectsTaskSwitchBody": {
        "type": "object",
        "properties": {
          "comment": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "text": {
                "type": "string"
              },
              "mentioned": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "attachments": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {}
              }
            },
            "required": [
              "text"
            ]
          }
        },
        "title": "ProjectsTaskSwitchBody",
        "description": "JSON body for `projects/task/switch`"
      },
      "ProjectsTaskUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsTaskUpdateParams",
        "description": "Query/header params for `projects/task/update`"
      },
      "ProjectsTaskUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "state": {
            "$ref": "#/components/schemas/TaskState"
          },
          "category": {
            "$ref": "#/components/schemas/TaskCategory"
          },
          "type": {
            "$ref": "#/components/schemas/TaskType"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "urgently": {
            "type": [
              "integer",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "searchTitle": {
            "type": "string"
          },
          "key": {
            "type": "integer"
          },
          "currentAssignee": {
            "type": "string"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "spec": {
            "type": "string"
          },
          "gist": {
            "type": [
              "string",
              "null"
            ]
          },
          "modules": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "components": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "approvalAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "workAssignee": {
            "type": "string"
          },
          "workIterationKey": {
            "type": [
              "integer",
              "null"
            ]
          },
          "workTimePlan": {
            "type": [
              "integer",
              "null"
            ]
          },
          "workEvaluation": {
            "type": [
              "number",
              "null"
            ]
          },
          "reviewAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "testAssignee": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolutionVersionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "resolutionType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskResolutionType"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "git": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "creatorUID": {
            "type": "string",
            "format": "uuid"
          },
          "stage": {
            "$ref": "#/components/schemas/TaskStageType"
          },
          "browser": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskBrowser"
              },
              {
                "type": "null"
              }
            ]
          },
          "bugType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskBugType"
              },
              {
                "type": "null"
              }
            ]
          },
          "build": {
            "type": [
              "string",
              "null"
            ]
          },
          "devices": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "labels": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "fuzzy": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updUID": {
            "type": "string"
          },
          "rejectUID": {
            "type": [
              "string",
              "null"
            ]
          },
          "rejectTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        },
        "title": "ProjectsTaskUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/task/update` — все поля опциональны"
      },
      "ProjectsTaskWorkEvaluationBody": {
        "type": "object",
        "properties": {
          "taskID": {
            "type": "string",
            "format": "uuid"
          },
          "value": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "taskID"
        ],
        "title": "ProjectsTaskWorkEvaluationBody",
        "description": "JSON body for `projects/task/work-evaluation`"
      },
      "ProjectsTaskWorklogsParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsTaskWorklogsParams",
        "description": "Query/header params for `projects/task/worklogs`"
      },
      "ProjectsProjectRepositoryLinkParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          },
          "agentAccess": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProjectRepository_AgentAccess"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ID",
          "repositoryID"
        ],
        "title": "ProjectsProjectRepositoryLinkParams",
        "description": "Query/header params for `projects/project/repository/link`"
      },
      "ProjectsProjectRepositoryLinkBody": {
        "type": "object",
        "properties": {
          "agentAccess": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProjectRepository_AgentAccess"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "ProjectsProjectRepositoryLinkBody",
        "description": "JSON body for `projects/project/repository/link`"
      },
      "ProjectsProjectRepositoryListParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsProjectRepositoryListParams",
        "description": "Query/header params for `projects/project/repository/list`"
      },
      "ProjectsProjectRepositoryUnlinkParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID",
          "repositoryID"
        ],
        "title": "ProjectsProjectRepositoryUnlinkParams",
        "description": "Query/header params for `projects/project/repository/unlink`"
      },
      "ProjectsProjectCreateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsProjectCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/project/create` — все поля опциональны"
      },
      "ProjectsProjectDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsProjectDeleteParams",
        "description": "Query/header params for `projects/project/delete`"
      },
      "ProjectsProjectUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsProjectUpdateParams",
        "description": "Query/header params for `projects/project/update`"
      },
      "ProjectsProjectUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsProjectUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/project/update` — все поля опциональны"
      },
      "ProjectsProductCreateParams": {
        "type": "object",
        "properties": {
          "skipCreateContent": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          }
        },
        "title": "ProjectsProductCreateParams",
        "description": "Query/header params for `projects/product/create`"
      },
      "ProjectsProductCreateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "cardFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "analyticAssignee": {
            "type": "string"
          },
          "platform": {
            "$ref": "#/components/schemas/Product_Platform"
          },
          "title": {
            "type": "string"
          },
          "techStack": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "leadUID": {
            "type": "string",
            "format": "uuid"
          },
          "startD": {
            "type": "string",
            "format": "date-time"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isArchived": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "archivedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isDeployEnabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "team": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds"
            }
          },
          "git": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "design": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "fileUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "uiKitUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refUrls": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              }
            }
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "spec": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsProductCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/product/create` — все поля опциональны"
      },
      "ProjectsProductDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsProductDeleteParams",
        "description": "Query/header params for `projects/product/delete`"
      },
      "projects_product_filter_features_Body_mode": {
        "type": "string",
        "enum": [
          "or",
          "and"
        ],
        "x-enum-varnames": [
          "or",
          "and"
        ],
        "title": "projects_product_filter_features_Body_mode",
        "description": "`or` = \"or\", `and` = \"and\""
      },
      "ProjectsProductFilterFeaturesBody": {
        "type": "object",
        "properties": {
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "moduleIDs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "componentIDs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "mode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/projects_product_filter_features_Body_mode"
              },
              {
                "type": "null"
              }
            ],
            "default": "or"
          }
        },
        "required": [
          "productID"
        ],
        "title": "ProjectsProductFilterFeaturesBody",
        "description": "JSON body for `projects/product/filter-features`"
      },
      "ProjectsProductTeamParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsProductTeamParams",
        "description": "Query/header params for `projects/product/team`"
      },
      "ProjectsProductUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsProductUpdateParams",
        "description": "Query/header params for `projects/product/update`"
      },
      "ProjectsProductUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "cardFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "analyticAssignee": {
            "type": "string"
          },
          "platform": {
            "$ref": "#/components/schemas/Product_Platform"
          },
          "title": {
            "type": "string"
          },
          "techStack": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "leadUID": {
            "type": "string",
            "format": "uuid"
          },
          "startD": {
            "type": "string",
            "format": "date-time"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isArchived": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "archivedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "isDeployEnabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "team": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds"
            }
          },
          "git": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "design": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "fileUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "uiKitUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refUrls": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              }
            }
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "spec": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsProductUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/product/update` — все поля опциональны"
      },
      "ProjectsModuleCreateParams": {
        "type": "object",
        "properties": {
          "skipCreateContent": {
            "type": [
              "boolean",
              "null"
            ],
            "default": true
          }
        },
        "title": "ProjectsModuleCreateParams",
        "description": "Query/header params for `projects/module/create`"
      },
      "ProjectsModuleCreateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "parentID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "title": {
            "type": "string"
          },
          "desc": {
            "type": "string"
          },
          "components": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "ver": {
            "type": "integer"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "path": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "title"
            ]
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsModuleCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/module/create` — все поля опциональны"
      },
      "ProjectsModuleDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "path_key": {
            "type": "string"
          },
          "path_title": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "path_key",
          "path_title"
        ],
        "title": "ProjectsModuleDeleteParams",
        "description": "Query/header params for `projects/module/delete`"
      },
      "ProjectsModuleListBody": {
        "type": "object",
        "properties": {
          "IDs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "IDs"
        ],
        "title": "ProjectsModuleListBody",
        "description": "JSON body for `projects/module/list`"
      },
      "ProjectsModuleUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsModuleUpdateParams",
        "description": "Query/header params for `projects/module/update`"
      },
      "ProjectsModuleUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "parentID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "title": {
            "type": "string"
          },
          "desc": {
            "type": "string"
          },
          "components": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "ver": {
            "type": "integer"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "path": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "title"
            ]
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsModuleUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/module/update` — все поля опциональны"
      },
      "ProjectsFeatureStatusAcceptanceParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureStatusAcceptanceParams",
        "description": "Query/header params for `projects/feature/status/acceptance`"
      },
      "ProjectsFeatureStatusDevelopmentParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureStatusDevelopmentParams",
        "description": "Query/header params for `projects/feature/status/development`"
      },
      "ProjectsFeatureStatusDevelopmentBody": {
        "type": "object",
        "properties": {
          "comment": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "text": {
                "type": "string"
              },
              "mentioned": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "attachments": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {}
              }
            },
            "required": [
              "text"
            ]
          }
        },
        "title": "ProjectsFeatureStatusDevelopmentBody",
        "description": "JSON body for `projects/feature/status/development`"
      },
      "ProjectsFeatureStatusDoneParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureStatusDoneParams",
        "description": "Query/header params for `projects/feature/status/done`"
      },
      "ProjectsFeatureStatusTestingParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureStatusTestingParams",
        "description": "Query/header params for `projects/feature/status/testing`"
      },
      "ProjectsFeatureStatusTestingBody": {
        "type": "object",
        "properties": {
          "comment": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "text": {
                "type": "string"
              },
              "mentioned": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "attachments": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {}
              }
            },
            "required": [
              "text"
            ]
          }
        },
        "title": "ProjectsFeatureStatusTestingBody",
        "description": "JSON body for `projects/feature/status/testing`"
      },
      "ProjectsFeatureCreateParams": {
        "type": "object",
        "properties": {
          "skipCreateContent": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          }
        },
        "title": "ProjectsFeatureCreateParams",
        "description": "Query/header params for `projects/feature/create`"
      },
      "ProjectsFeatureCreateBody": {
        "type": "object",
        "properties": {
          "fields": {
            "type": "object",
            "properties": {
              "cID": {
                "type": "string",
                "format": "uuid"
              },
              "projectID": {
                "type": "string",
                "format": "uuid"
              },
              "productID": {
                "type": "string",
                "format": "uuid"
              },
              "versionID": {
                "type": "string",
                "format": "uuid"
              },
              "ID": {
                "type": "string",
                "format": "uuid"
              },
              "key": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "title": {
                "type": "string"
              },
              "status": {
                "type": "integer"
              },
              "spec": {
                "type": "string"
              },
              "gist": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "meta": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "analyticAssignee": {
                "type": "string"
              },
              "ord": {
                "type": "integer",
                "description": "Unix timestamp in milliseconds"
              },
              "isDeleted": {
                "type": [
                  "boolean",
                  "null"
                ],
                "default": false
              },
              "deletedTS": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "updTS": {
                "type": "integer",
                "description": "Unix timestamp in milliseconds"
              },
              "updUID": {
                "type": "string"
              }
            },
            "required": [
              "cID",
              "projectID",
              "productID",
              "versionID",
              "ID",
              "title",
              "status",
              "spec",
              "analyticAssignee",
              "ord",
              "updTS",
              "updUID"
            ]
          },
          "relations": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          }
        },
        "title": "ProjectsFeatureCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/feature/create` — все поля опциональны"
      },
      "ProjectsFeatureDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureDeleteParams",
        "description": "Query/header params for `projects/feature/delete`"
      },
      "ProjectsFeatureGetParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "ProjectsFeatureGetParams",
        "description": "Query/header params for `projects/feature/get`"
      },
      "ProjectsFeatureModulesParams": {
        "type": "object",
        "properties": {
          "featureID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "featureID"
        ],
        "title": "ProjectsFeatureModulesParams",
        "description": "Query/header params for `projects/feature/modules`"
      },
      "ProjectsFeatureStatusParams": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "type",
          "ID"
        ],
        "title": "ProjectsFeatureStatusParams",
        "description": "Query/header params for `projects/feature/status`"
      },
      "ProjectsFeatureTeamParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureTeamParams",
        "description": "Query/header params for `projects/feature/team`"
      },
      "ProjectsFeatureUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsFeatureUpdateParams",
        "description": "Query/header params for `projects/feature/update`"
      },
      "ProjectsFeatureUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "versionID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": [
              "integer",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "spec": {
            "type": "string"
          },
          "gist": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "analyticAssignee": {
            "type": "string"
          },
          "ord": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsFeatureUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/feature/update` — все поля опциональны"
      },
      "ProjectsComponentCreateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "ver": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "desc": {
            "type": "string"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsComponentCreateBody",
        "description": "Partial body (Valid.Patch) for `projects/component/create` — все поля опциональны"
      },
      "ProjectsComponentDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsComponentDeleteParams",
        "description": "Query/header params for `projects/component/delete`"
      },
      "ProjectsComponentListBody": {
        "type": "object",
        "properties": {
          "IDs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "IDs"
        ],
        "title": "ProjectsComponentListBody",
        "description": "JSON body for `projects/component/list`"
      },
      "ProjectsComponentUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ProjectsComponentUpdateParams",
        "description": "Query/header params for `projects/component/update`"
      },
      "ProjectsComponentUpdateBody": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "projectID": {
            "type": "string",
            "format": "uuid"
          },
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "ver": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "desc": {
            "type": "string"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "ProjectsComponentUpdateBody",
        "description": "Partial body (Valid.Patch) for `projects/component/update` — все поля опциональны"
      },
      "OauthConnectDecideParams": {
        "type": "object",
        "properties": {
          "request": {
            "type": "string",
            "format": "uuid"
          },
          "allow": {
            "type": "boolean"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "write": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "request",
          "allow"
        ],
        "title": "OauthConnectDecideParams",
        "description": "Query/header params for `oauth/connect/decide`"
      },
      "OauthConnectGetParams": {
        "type": "object",
        "properties": {
          "request": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "request"
        ],
        "title": "OauthConnectGetParams",
        "description": "Query/header params for `oauth/connect/get`"
      },
      "OauthConnectInfoParams": {
        "type": "object",
        "properties": {
          "request": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "request"
        ],
        "title": "OauthConnectInfoParams",
        "description": "Query/header params for `oauth/connect/info`"
      },
      "OauthClientCreateBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "redirectUri": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        },
        "required": [
          "name",
          "redirectUri"
        ],
        "title": "OauthClientCreateBody",
        "description": "JSON body for `oauth/client/create`"
      },
      "OauthClientDeleteBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "OauthClientDeleteBody",
        "description": "JSON body for `oauth/client/delete`"
      },
      "notification_list_group": {
        "type": "string",
        "enum": [
          "task",
          "Task",
          "meeting",
          "Meeting",
          "chatMessage",
          "Chat",
          "usertimeoff",
          "Timeoffs",
          "worklogs",
          "Worklogs",
          "user_events"
        ],
        "x-enum-varnames": [
          "Task",
          "task",
          "Meeting",
          "meeting",
          "Chat",
          "chatMessage",
          "Timeoffs",
          "usertimeoff",
          "Worklogs",
          "worklogs",
          "UserEvents"
        ],
        "title": "notification_list_group",
        "description": "`Task` = \"task\", `task` = \"Task\", `Meeting` = \"meeting\", `meeting` = \"Meeting\", `Chat` = \"chatMessage\", `chatMessage` = \"Chat\", `Timeoffs` = \"usertimeoff\", `usertimeoff` = \"Timeoffs\", `Worklogs` = \"worklogs\", `worklogs` = \"Worklogs\", `UserEvents` = \"user_events\""
      },
      "NotificationListParams": {
        "type": "object",
        "properties": {
          "group": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/notification_list_group"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        "title": "NotificationListParams",
        "description": "Query/header params for `notification/list`"
      },
      "MeetingParticipantUpdateParams": {
        "type": "object",
        "properties": {
          "meetingID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "meetingID",
          "userID"
        ],
        "title": "MeetingParticipantUpdateParams",
        "description": "Query/header params for `meeting/participant/update`"
      },
      "MeetingParticipantUpdateBody": {
        "type": "object",
        "properties": {
          "isAccepted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "position": {
            "type": [
              "string",
              "null"
            ]
          },
          "hourCost": {
            "type": [
              "number",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "isAdmin": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "title": "MeetingParticipantUpdateBody",
        "description": "JSON body for `meeting/participant/update`"
      },
      "MeetingCreateParams": {
        "type": "object",
        "properties": {
          "createIntegration": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          }
        },
        "title": "MeetingCreateParams",
        "description": "Query/header params for `meeting/create`"
      },
      "MeetingCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "entityType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Meeting_entityType"
              },
              {
                "type": "null"
              }
            ]
          },
          "entityID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "agenda": {
            "type": "string"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolution": {
            "type": "string"
          },
          "startDtEstimated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDtEstimated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "startDtFact": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDtFact": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/Meeting_Type"
          },
          "link": {
            "type": [
              "string",
              "null"
            ]
          },
          "participants": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "userID": {
                  "type": "string"
                },
                "userUpdTS": {
                  "type": "integer",
                  "description": "Unix timestamp in milliseconds"
                },
                "position": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hourCost": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "comment": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "isAdmin": {
                  "type": "boolean"
                },
                "isExternal": {
                  "type": "boolean"
                },
                "isAccepted": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "acceptedDT": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "acceptedUID": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "isActive": {
                  "type": "boolean"
                },
                "activeDT": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "activeUID": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "createdDT": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdUID": {
                  "type": "string",
                  "format": "uuid"
                },
                "inviteDT": {
                  "type": "string",
                  "format": "date-time"
                },
                "inviteUID": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updTS": {
                  "type": "integer",
                  "description": "Unix timestamp in milliseconds"
                },
                "updUID": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "userID",
                "userUpdTS",
                "isAdmin",
                "isExternal",
                "isActive",
                "createdDT",
                "createdUID",
                "inviteDT",
                "updTS",
                "updUID"
              ]
            }
          },
          "online": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "integrationID": {
                "type": "string"
              },
              "service": {
                "$ref": "#/components/schemas/Meeting_online_service"
              },
              "roomID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "callID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "passcode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "integrationID",
              "service"
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "MeetingCreateBody",
        "description": "Partial body (Valid.Patch) for `meeting/create` — все поля опциональны"
      },
      "MeetingDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingDeleteParams",
        "description": "Query/header params for `meeting/delete`"
      },
      "MeetingEntityWorklogsParams": {
        "type": "object",
        "properties": {
          "entityID": {
            "type": "string",
            "format": "uuid"
          },
          "entityType": {
            "$ref": "#/components/schemas/Meeting_entityType"
          }
        },
        "required": [
          "entityID",
          "entityType"
        ],
        "title": "MeetingEntityWorklogsParams",
        "description": "Query/header params for `meeting/entity-worklogs`"
      },
      "MeetingFinishParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingFinishParams",
        "description": "Query/header params for `meeting/finish`"
      },
      "MeetingGetParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingGetParams",
        "description": "Query/header params for `meeting/get`"
      },
      "MeetingJoinParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingJoinParams",
        "description": "Query/header params for `meeting/join`"
      },
      "MeetingJoinBody": {
        "type": "object",
        "properties": {
          "userIDs": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "userIDs"
        ],
        "title": "MeetingJoinBody",
        "description": "JSON body for `meeting/join`"
      },
      "MeetingLeaveParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingLeaveParams",
        "description": "Query/header params for `meeting/leave`"
      },
      "MeetingParticipantSuggestionsParams": {
        "type": "object",
        "properties": {
          "entityID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "entityType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Meeting_entityType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "MeetingParticipantSuggestionsParams",
        "description": "Query/header params for `meeting/participant-suggestions`"
      },
      "MeetingProposeRescheduleParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingProposeRescheduleParams",
        "description": "Query/header params for `meeting/propose-reschedule`"
      },
      "MeetingProposeRescheduleBody": {
        "type": "object",
        "properties": {
          "dt": {
            "type": "string",
            "format": "date-time"
          },
          "comment": {
            "type": "string"
          }
        },
        "required": [
          "dt",
          "comment"
        ],
        "title": "MeetingProposeRescheduleBody",
        "description": "JSON body for `meeting/propose-reschedule`"
      },
      "MeetingResolutionParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingResolutionParams",
        "description": "Query/header params for `meeting/resolution`"
      },
      "MeetingUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingUpdateParams",
        "description": "Query/header params for `meeting/update`"
      },
      "MeetingUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "versionID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "entityType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Meeting_entityType"
              },
              {
                "type": "null"
              }
            ]
          },
          "entityID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "agenda": {
            "type": "string"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolution": {
            "type": "string"
          },
          "startDtEstimated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDtEstimated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "startDtFact": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDtFact": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/Meeting_Type"
          },
          "link": {
            "type": [
              "string",
              "null"
            ]
          },
          "participants": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "userID": {
                  "type": "string"
                },
                "userUpdTS": {
                  "type": "integer",
                  "description": "Unix timestamp in milliseconds"
                },
                "position": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hourCost": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "comment": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "isAdmin": {
                  "type": "boolean"
                },
                "isExternal": {
                  "type": "boolean"
                },
                "isAccepted": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "acceptedDT": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "acceptedUID": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "isActive": {
                  "type": "boolean"
                },
                "activeDT": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "activeUID": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "createdDT": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdUID": {
                  "type": "string",
                  "format": "uuid"
                },
                "inviteDT": {
                  "type": "string",
                  "format": "date-time"
                },
                "inviteUID": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updTS": {
                  "type": "integer",
                  "description": "Unix timestamp in milliseconds"
                },
                "updUID": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "userID",
                "userUpdTS",
                "isAdmin",
                "isExternal",
                "isActive",
                "createdDT",
                "createdUID",
                "inviteDT",
                "updTS",
                "updUID"
              ]
            }
          },
          "online": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "integrationID": {
                "type": "string"
              },
              "service": {
                "$ref": "#/components/schemas/Meeting_online_service"
              },
              "roomID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "callID": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "passcode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "integrationID",
              "service"
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "MeetingUpdateBody",
        "description": "Partial body (Valid.Patch) for `meeting/update` — все поля опциональны"
      },
      "MeetingWorklogsParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "MeetingWorklogsParams",
        "description": "Query/header params for `meeting/worklogs`"
      },
      "LogoutTerminateAllParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "revokeAccess": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "userID"
        ],
        "title": "LogoutTerminateAllParams",
        "description": "Query/header params for `logout/terminate-all`"
      },
      "LogoutTerminateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "LogoutTerminateParams",
        "description": "Query/header params for `logout/terminate`"
      },
      "LlmVersionNotesBody": {
        "type": "object",
        "properties": {
          "versionID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "versionID"
        ],
        "title": "LlmVersionNotesBody",
        "description": "JSON body for `llm/version/notes`"
      },
      "LlmTaskEstimateBody": {
        "type": "object",
        "properties": {
          "taskID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "taskID"
        ],
        "title": "LlmTaskEstimateBody",
        "description": "JSON body for `llm/task/estimate`"
      },
      "LlmTaskEvaluateWorkBody": {
        "type": "object",
        "properties": {
          "taskID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "taskID"
        ],
        "title": "LlmTaskEvaluateWorkBody",
        "description": "JSON body for `llm/task/evaluate-work`"
      },
      "llm_search_semantic_Body_filters_types_item": {
        "type": "string",
        "enum": [
          "feature",
          "task"
        ],
        "x-enum-varnames": [
          "feature",
          "task"
        ],
        "title": "llm_search_semantic_Body_filters_types_item",
        "description": "`feature` = \"feature\", `task` = \"task\""
      },
      "llm_search_semantic_Body_filters_categories_item": {
        "type": "string",
        "enum": [
          "common",
          "dev",
          "qa",
          "bug"
        ],
        "x-enum-varnames": [
          "common",
          "dev",
          "qa",
          "bug"
        ],
        "title": "llm_search_semantic_Body_filters_categories_item",
        "description": "`common` = \"common\", `dev` = \"dev\", `qa` = \"qa\", `bug` = \"bug\""
      },
      "LlmSearchSemanticBody": {
        "type": "object",
        "properties": {
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "filters": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "types": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/llm_search_semantic_Body_filters_types_item"
                }
              },
              "categories": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/llm_search_semantic_Body_filters_categories_item"
                }
              },
              "versionID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "featureID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "includeClosed": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "closedWithinDays": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1,
                "maximum": 3650
              }
            }
          }
        },
        "required": [
          "productID",
          "query"
        ],
        "title": "LlmSearchSemanticBody",
        "description": "JSON body for `llm/search/semantic`"
      },
      "LlmMeetingResultBody": {
        "type": "object",
        "properties": {
          "meetingID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "meetingID"
        ],
        "title": "LlmMeetingResultBody",
        "description": "JSON body for `llm/meeting/result`"
      },
      "LlmFunctionsUpdateBody": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "launch": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LLMFunctionConnection_launch"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "key"
        ],
        "title": "LlmFunctionsUpdateBody",
        "description": "JSON body for `llm/functions/update`"
      },
      "LlmEntityGistBody": {
        "type": "object",
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/llm_search_semantic_Body_filters_types_item"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "entity",
          "ID"
        ],
        "title": "LlmEntityGistBody",
        "description": "JSON body for `llm/entity/gist`"
      },
      "LlmEditSpellcheckBody": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1
          },
          "entityType": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "text"
        ],
        "title": "LlmEditSpellcheckBody",
        "description": "JSON body for `llm/edit/spellcheck`"
      },
      "llm_create_title_Body_kind": {
        "type": "string",
        "enum": [
          "task",
          "bug",
          "feature",
          "meeting"
        ],
        "x-enum-varnames": [
          "task",
          "bug",
          "feature",
          "meeting"
        ],
        "title": "llm_create_title_Body_kind",
        "description": "`task` = \"task\", `bug` = \"bug\", `feature` = \"feature\", `meeting` = \"meeting\""
      },
      "LlmCreateTitleBody": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/llm_create_title_Body_kind",
            "default": "task"
          },
          "spec": {
            "type": "string",
            "minLength": 1
          },
          "featureID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "spec"
        ],
        "title": "LlmCreateTitleBody",
        "description": "JSON body for `llm/create/title`"
      },
      "LlmBugDuplicatesBody": {
        "type": "object",
        "properties": {
          "productID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "default": ""
          },
          "spec": {
            "type": "string",
            "default": ""
          }
        },
        "required": [
          "productID"
        ],
        "title": "LlmBugDuplicatesBody",
        "description": "JSON body for `llm/bug/duplicates`"
      },
      "llm_outcome_Body_outcome": {
        "type": "string",
        "enum": [
          "applied",
          "dismissed"
        ],
        "x-enum-varnames": [
          "applied",
          "dismissed"
        ],
        "title": "llm_outcome_Body_outcome",
        "description": "`applied` = \"applied\", `dismissed` = \"dismissed\""
      },
      "LlmOutcomeBody": {
        "type": "object",
        "properties": {
          "runID": {
            "type": "string",
            "format": "uuid"
          },
          "outcome": {
            "$ref": "#/components/schemas/llm_outcome_Body_outcome"
          }
        },
        "required": [
          "runID",
          "outcome"
        ],
        "title": "LlmOutcomeBody",
        "description": "JSON body for `llm/outcome`"
      },
      "IterationsListParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "margin": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "title": "IterationsListParams",
        "description": "Query/header params for `iterations/list`"
      },
      "IterationsStateParams": {
        "type": "object",
        "properties": {
          "iterationKey": {
            "type": [
              "integer",
              "null"
            ]
          },
          "userID": {
            "type": [
              "string",
              "null"
            ]
          },
          "margin": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "title": "IterationsStateParams",
        "description": "Query/header params for `iterations/state`"
      },
      "IterationGenerateParams": {
        "type": "object",
        "properties": {
          "year": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "title": "IterationGenerateParams",
        "description": "Query/header params for `iteration/generate`"
      },
      "IntegrationMeetingCreateParams": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "state"
        ],
        "title": "IntegrationMeetingCreateParams",
        "description": "Query/header params for `integration/meeting/create`"
      },
      "IntegrationMeetingCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/MeetingIntegration_Status",
            "default": 1
          },
          "type": {
            "$ref": "#/components/schemas/MeetingIntegration_type"
          },
          "account": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "accountId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "planType": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "email"
            ]
          },
          "credentials": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "accessToken": {
                "type": "string"
              },
              "refreshToken": {
                "type": "string"
              },
              "expirationTimeIso": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "syncTimeout": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "accessToken",
              "refreshToken",
              "expirationTimeIso",
              "scopes"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MeetingIntegration_ErrorCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "IntegrationMeetingCreateBody",
        "description": "Partial body (Valid.Patch) for `integration/meeting/create` — все поля опциональны"
      },
      "IntegrationMeetingDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "IntegrationMeetingDeleteParams",
        "description": "Query/header params for `integration/meeting/delete`"
      },
      "IntegrationGitWebhookGitlabSystemWebhookParams": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "cID"
        ],
        "title": "IntegrationGitWebhookGitlabSystemWebhookParams",
        "description": "Query/header params for `integration/git/webhook/gitlab/system-webhook`"
      },
      "IntegrationGitWebhookGitlabWebhookParams": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "cID"
        ],
        "title": "IntegrationGitWebhookGitlabWebhookParams",
        "description": "Query/header params for `integration/git/webhook/gitlab/webhook`"
      },
      "integration_git_passport_draft_Body_action": {
        "type": "string",
        "enum": [
          "accept",
          "reject"
        ],
        "x-enum-varnames": [
          "accept",
          "reject"
        ],
        "title": "integration_git_passport_draft_Body_action",
        "description": "`accept` = \"accept\", `reject` = \"reject\""
      },
      "IntegrationGitPassportDraftBody": {
        "type": "object",
        "properties": {
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "$ref": "#/components/schemas/integration_git_passport_draft_Body_action"
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "repositoryID",
          "action"
        ],
        "title": "IntegrationGitPassportDraftBody",
        "description": "JSON body for `integration/git/passport/draft`"
      },
      "IntegrationGitPassportGenerateBody": {
        "type": "object",
        "properties": {
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "repositoryID"
        ],
        "title": "IntegrationGitPassportGenerateBody",
        "description": "JSON body for `integration/git/passport/generate`"
      },
      "IntegrationGitPassportGetParams": {
        "type": "object",
        "properties": {
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "repositoryID"
        ],
        "title": "IntegrationGitPassportGetParams",
        "description": "Query/header params for `integration/git/passport/get`"
      },
      "IntegrationGitPassportSaveBody": {
        "type": "object",
        "properties": {
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "repositoryID",
          "text"
        ],
        "title": "IntegrationGitPassportSaveBody",
        "description": "JSON body for `integration/git/passport/save`"
      },
      "IntegrationGitCommitCommentListParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "IntegrationGitCommitCommentListParams",
        "description": "Query/header params for `integration/git/commit/comment-list`"
      },
      "IntegrationGitCommitLinesBackfillParams": {
        "type": "object",
        "properties": {
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "repositoryID"
        ],
        "title": "IntegrationGitCommitLinesBackfillParams",
        "description": "Query/header params for `integration/git/commit/lines-backfill`"
      },
      "IntegrationGitBranchCreateParams": {
        "type": "object",
        "properties": {
          "taskID": {
            "type": "string",
            "format": "uuid"
          },
          "repositoryID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "taskID",
          "repositoryID"
        ],
        "title": "IntegrationGitBranchCreateParams",
        "description": "Query/header params for `integration/git/branch/create`"
      },
      "IntegrationGitCommitListParams": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EntityType"
          },
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "type",
          "ID"
        ],
        "title": "IntegrationGitCommitListParams",
        "description": "Query/header params for `integration/git/commit-list`"
      },
      "IntegrationGitCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/GitIntegration_Type"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "params": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "host": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "port": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "requestTimeout": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "token": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "installationId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          },
          "autoProvisionUsers": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "adminActions": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "blockUsers": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "systemHook": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            }
          }
        },
        "required": [
          "type"
        ],
        "title": "IntegrationGitCreateBody",
        "description": "JSON body for `integration/git/create`"
      },
      "IntegrationGitDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "IntegrationGitDeleteParams",
        "description": "Query/header params for `integration/git/delete`"
      },
      "IntegrationGitUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "IntegrationGitUpdateParams",
        "description": "Query/header params for `integration/git/update`"
      },
      "IntegrationGitUpdateBody": {
        "type": "object",
        "properties": {
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "params": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "host": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "port": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "requestTimeout": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "token": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "users": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "autoProvisionUsers": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "adminActions": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "blockUsers": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "systemHook": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            }
          }
        },
        "title": "IntegrationGitUpdateBody",
        "description": "JSON body for `integration/git/update`"
      },
      "IntegrationGitUpdateRepoStatusParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/GitIntegration_Status"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "IntegrationGitUpdateRepoStatusParams",
        "description": "Query/header params for `integration/git/updateRepoStatus`"
      },
      "IntegrationGitUpdateStatusParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "IntegrationGitUpdateStatusParams",
        "description": "Query/header params for `integration/git/updateStatus`"
      },
      "IntegrationFigmaCreateParams": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "state"
        ],
        "title": "IntegrationFigmaCreateParams",
        "description": "Query/header params for `integration/figma/create`"
      },
      "IntegrationFigmaCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/MeetingIntegration_Status",
            "default": 1
          },
          "account": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "handle": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id"
            ]
          },
          "credentials": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "accessToken": {
                "type": "string"
              },
              "refreshToken": {
                "type": "string"
              },
              "expirationTimeIso": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "accessToken",
              "refreshToken",
              "expirationTimeIso",
              "scopes"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FigmaIntegration_ErrorCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdDT": {
            "type": "string",
            "format": "date-time"
          },
          "createdUID": {
            "type": "string",
            "format": "uuid"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "IntegrationFigmaCreateBody",
        "description": "Partial body (Valid.Patch) for `integration/figma/create` — все поля опциональны"
      },
      "IntegrationFigmaDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "IntegrationFigmaDeleteParams",
        "description": "Query/header params for `integration/figma/delete`"
      },
      "FileProxyDownloadParams": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "FileProxyDownloadParams",
        "description": "Query/header params for `file/proxy-download`"
      },
      "DesignFileCheckBody": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "DesignFileCheckBody",
        "description": "JSON body for `design/file/check`"
      },
      "DesignCreateBody": {
        "type": "object",
        "properties": {
          "entityID": {
            "type": "string",
            "format": "uuid"
          },
          "src": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "runID": {
            "type": [
              "string",
              "null"
            ]
          },
          "mainFrame": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "productID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "entityID",
          "src"
        ],
        "title": "DesignCreateBody",
        "description": "JSON body for `design/create`"
      },
      "DesignDeleteParams": {
        "type": "object",
        "properties": {
          "entityID": {
            "type": "string",
            "format": "uuid"
          },
          "designID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "mainFrame": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "entityID"
        ],
        "title": "DesignDeleteParams",
        "description": "Query/header params for `design/delete`"
      },
      "DesignEntityParams": {
        "type": "object",
        "properties": {
          "entityID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "entityID"
        ],
        "title": "DesignEntityParams",
        "description": "Query/header params for `design/entity`"
      },
      "DesignListBody": {
        "type": "object",
        "properties": {
          "IDs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 200
          }
        },
        "required": [
          "IDs"
        ],
        "title": "DesignListBody",
        "description": "JSON body for `design/list`"
      },
      "DesignPreviewBody": {
        "type": "object",
        "properties": {
          "src": {
            "type": "string"
          }
        },
        "required": [
          "src"
        ],
        "title": "DesignPreviewBody",
        "description": "JSON body for `design/preview`"
      },
      "DesignReloadBody": {
        "type": "object",
        "properties": {
          "designID": {
            "type": "string",
            "format": "uuid"
          },
          "runID": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "designID"
        ],
        "title": "DesignReloadBody",
        "description": "JSON body for `design/reload`"
      },
      "CurrencyConvertParams": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number"
          },
          "from": {
            "$ref": "#/components/schemas/Currency_Code"
          },
          "to": {
            "$ref": "#/components/schemas/Currency_Code"
          },
          "date": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "amount",
          "from",
          "to"
        ],
        "title": "CurrencyConvertParams",
        "description": "Query/header params for `currency/convert`"
      },
      "costs_entity_entityType": {
        "type": "string",
        "enum": [
          "task",
          "bug",
          "feature",
          "version",
          "product",
          "meeting"
        ],
        "x-enum-varnames": [
          "task",
          "bug",
          "feature",
          "version",
          "product",
          "meeting"
        ],
        "title": "costs_entity_entityType",
        "description": "`task` = \"task\", `bug` = \"bug\", `feature` = \"feature\", `version` = \"version\", `product` = \"product\", `meeting` = \"meeting\""
      },
      "CostsEntityParams": {
        "type": "object",
        "properties": {
          "entityType": {
            "$ref": "#/components/schemas/costs_entity_entityType"
          },
          "entityID": {
            "type": "string",
            "format": "uuid"
          },
          "iterationKey": {
            "type": [
              "integer",
              "null"
            ]
          },
          "margin": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "entityType",
          "entityID"
        ],
        "title": "CostsEntityParams",
        "description": "Query/header params for `costs/entity`"
      },
      "CostsUserCorrectionsParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "startDk": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "endDk": {
            "type": "integer",
            "description": "Day key (YYYYMMDD or internal day index)"
          }
        },
        "required": [
          "userID",
          "startDk",
          "endDk"
        ],
        "title": "CostsUserCorrectionsParams",
        "description": "Query/header params for `costs/user-corrections`"
      },
      "CompanyOrganizationCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/Company_OrganizationType"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "fullTitle": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "inn": {
            "type": "string",
            "minLength": 10,
            "maxLength": 12,
            "pattern": "^\\d+$"
          },
          "kpp": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 9,
            "maxLength": 9,
            "pattern": "^\\d+$"
          },
          "ogrn": {
            "type": "string",
            "minLength": 13,
            "maxLength": 15,
            "pattern": "^\\d+$"
          },
          "urAddress": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "factAddress": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "nds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "head": {
            "type": "object",
            "properties": {
              "fullName": {
                "type": "string",
                "maxLength": 300
              },
              "position": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 300
              }
            },
            "required": [
              "fullName"
            ]
          },
          "bank": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "bic": {
                "type": "string",
                "minLength": 9,
                "maxLength": 9,
                "pattern": "^\\d+$"
              },
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "corrAccount": {
                "type": "string",
                "maxLength": 20,
                "pattern": "^\\d*$"
              },
              "account": {
                "type": "string",
                "minLength": 20,
                "maxLength": 20,
                "pattern": "^\\d+$"
              }
            },
            "required": [
              "bic",
              "title",
              "corrAccount",
              "account"
            ]
          },
          "accountantEmails": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "docs": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "INN": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "requisites": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other1": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other2": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          }
        },
        "required": [
          "type",
          "title",
          "fullTitle",
          "inn",
          "ogrn",
          "urAddress",
          "head",
          "accountantEmails"
        ],
        "title": "CompanyOrganizationCreateBody",
        "description": "JSON body for `company/organization/create`"
      },
      "CompanyOrganizationDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyOrganizationDeleteParams",
        "description": "Query/header params for `company/organization/delete`"
      },
      "CompanyOrganizationUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyOrganizationUpdateParams",
        "description": "Query/header params for `company/organization/update`"
      },
      "CompanyOrganizationUpdateBody": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/Company_OrganizationType"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "fullTitle": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "inn": {
            "type": "string",
            "minLength": 10,
            "maxLength": 12,
            "pattern": "^\\d+$"
          },
          "kpp": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 9,
            "maxLength": 9,
            "pattern": "^\\d+$"
          },
          "ogrn": {
            "type": "string",
            "minLength": 13,
            "maxLength": 15,
            "pattern": "^\\d+$"
          },
          "urAddress": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "factAddress": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "nds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "head": {
            "type": "object",
            "properties": {
              "fullName": {
                "type": "string",
                "maxLength": 300
              },
              "position": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 300
              }
            },
            "required": [
              "fullName"
            ]
          },
          "bank": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "bic": {
                "type": "string",
                "minLength": 9,
                "maxLength": 9,
                "pattern": "^\\d+$"
              },
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "corrAccount": {
                "type": "string",
                "maxLength": 20,
                "pattern": "^\\d*$"
              },
              "account": {
                "type": "string",
                "minLength": 20,
                "maxLength": 20,
                "pattern": "^\\d+$"
              }
            },
            "required": [
              "bic",
              "title",
              "corrAccount",
              "account"
            ]
          },
          "accountantEmails": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "docs": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "INN": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "requisites": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other1": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other2": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          }
        },
        "title": "CompanyOrganizationUpdateBody",
        "description": "Partial body (Valid.Patch) for `company/organization/update` — все поля опциональны"
      },
      "CompanyControlUpdateParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyControlUpdateParams",
        "description": "Query/header params for `company/control/update`"
      },
      "CompanyControlUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "accessType": {
            "$ref": "#/components/schemas/AccessType"
          },
          "status": {
            "type": "string"
          },
          "statusDT": {
            "type": "string",
            "format": "date-time"
          },
          "statusUID": {
            "type": "string"
          },
          "hasActiveRole": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "allProductAccess": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "rolesStartDK": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Day key (YYYYMMDD or internal day index)"
          },
          "employment": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isOwner": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "params": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "productAccess": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer",
              "description": "Unix timestamp in milliseconds"
            }
          },
          "marginPercent": {
            "type": [
              "integer",
              "null"
            ]
          },
          "roles": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "department": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allowsSchemes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allows": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "allowsTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          }
        },
        "title": "CompanyControlUpdateBody",
        "description": "Partial body (Valid.Patch) for `company/control/update` — все поля опциональны"
      },
      "CompanyAllowsSchemeCreateBody": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "desc": {
            "type": [
              "string",
              "null"
            ]
          },
          "allows": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "title"
        ],
        "title": "CompanyAllowsSchemeCreateBody",
        "description": "JSON body for `company/allows/scheme-create`"
      },
      "CompanyAllowsSchemeDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "replaceKey": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyAllowsSchemeDeleteParams",
        "description": "Query/header params for `company/allows/scheme-delete`"
      },
      "CompanyAllowsSchemeUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyAllowsSchemeUpdateParams",
        "description": "Query/header params for `company/allows/scheme-update`"
      },
      "CompanyAllowsSchemeUpdateBody": {
        "type": "object",
        "properties": {
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "desc": {
            "type": [
              "string",
              "null"
            ]
          },
          "allows": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "title": "CompanyAllowsSchemeUpdateBody",
        "description": "JSON body for `company/allows/scheme-update`"
      },
      "CompanyAllowsUserParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAllowsUserParams",
        "description": "Query/header params for `company/allows/user`"
      },
      "company_access_block_reason": {
        "type": "string",
        "enum": [
          "self",
          "unfit",
          "discipline"
        ],
        "x-enum-varnames": [
          "self",
          "unfit",
          "discipline"
        ],
        "title": "company_access_block_reason",
        "description": "`self` = \"self\", `unfit` = \"unfit\", `discipline` = \"discipline\""
      },
      "CompanyAccessBlockParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/company_access_block_reason"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessBlockParams",
        "description": "Query/header params for `company/access/block`"
      },
      "CompanyAccessCheckUserParams": {
        "type": "object",
        "properties": {
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "CompanyAccessCheckUserParams",
        "description": "Query/header params for `company/access/check-user`"
      },
      "CompanyAccessCreateBody": {
        "type": "object",
        "properties": {
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone number"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "user": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "isAdmin": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          },
          "employmentType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Payment_employmentType"
              },
              {
                "type": "null"
              }
            ]
          },
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "marginPercent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000
          },
          "schemes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "roles": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "timeOffs": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "createPayments": {
            "type": [
              "boolean",
              "null"
            ],
            "default": true
          },
          "productAccess": {
            "type": [
              "string",
              "null"
            ]
          },
          "products": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "CompanyAccessCreateBody",
        "description": "JSON body for `company/access/create`"
      },
      "CompanyAccessDeleteParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessDeleteParams",
        "description": "Query/header params for `company/access/delete`"
      },
      "CompanyAccessGrantAdminParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessGrantAdminParams",
        "description": "Query/header params for `company/access/grant-admin`"
      },
      "CompanyAccessRevokeAdminParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessRevokeAdminParams",
        "description": "Query/header params for `company/access/revoke-admin`"
      },
      "CompanyAccessSetMarginParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "marginPercent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessSetMarginParams",
        "description": "Query/header params for `company/access/set-margin`"
      },
      "CompanyAccessSetPrivilegesParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessSetPrivilegesParams",
        "description": "Query/header params for `company/access/set-privileges`"
      },
      "CompanyAccessSetPrivilegesBody": {
        "type": "object",
        "properties": {
          "isAdmin": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "schemes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          }
        },
        "title": "CompanyAccessSetPrivilegesBody",
        "description": "JSON body for `company/access/set-privileges`"
      },
      "CompanyAccessUnblockParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyAccessUnblockParams",
        "description": "Query/header params for `company/access/unblock`"
      },
      "CompanyArchiveFileParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "orgID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyArchiveFileParams",
        "description": "Query/header params for `company/archive-file`"
      },
      "CompanyCheckRequisitesParams": {
        "type": "object",
        "properties": {
          "inn": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 10,
            "maxLength": 12,
            "pattern": "^\\d+$"
          },
          "bic": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 9,
            "maxLength": 9,
            "pattern": "^\\d+$"
          }
        },
        "title": "CompanyCheckRequisitesParams",
        "description": "Query/header params for `company/check-requisites`"
      },
      "CompanyCheckParams": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ],
        "title": "CompanyCheckParams",
        "description": "Query/header params for `company/check`"
      },
      "CompanyControlParams": {
        "type": "object",
        "properties": {
          "userID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "userID"
        ],
        "title": "CompanyControlParams",
        "description": "Query/header params for `company/control`"
      },
      "CompanyCreateParams": {
        "type": "object",
        "properties": {
          "skipCreateContent": {
            "type": [
              "boolean",
              "null"
            ],
            "default": false
          }
        },
        "title": "CompanyCreateParams",
        "description": "Query/header params for `company/create`"
      },
      "CompanyCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "foundationDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultMarginPercent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000
          },
          "demoSet": {
            "type": [
              "string",
              "null"
            ]
          },
          "testSlot": {
            "type": [
              "integer",
              "null"
            ]
          },
          "agentPrices": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "docs": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "INN": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other1": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other2": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "requisites": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          },
          "timeZone": {
            "type": "string",
            "default": "Europe/Moscow"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "activityType": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "activityDescription": {
            "type": [
              "string",
              "null"
            ]
          },
          "titleHash": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createUID": {
            "type": "string"
          }
        },
        "title": "CompanyCreateBody",
        "description": "Partial body (Valid.Patch) for `company/create` — все поля опциональны"
      },
      "CompanyDictionaryParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyDictionaryParams",
        "description": "Query/header params for `company/dictionary`"
      },
      "CompanyDictionaryBody": {
        "type": "object",
        "additionalProperties": true,
        "title": "CompanyDictionaryBody",
        "description": "JSON body for `company/dictionary`"
      },
      "CompanyInfoParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyInfoParams",
        "description": "Query/header params for `company/info`"
      },
      "CompanyUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "CompanyUpdateParams",
        "description": "Query/header params for `company/update`"
      },
      "CompanyUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "foundationDT": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultMarginPercent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000
          },
          "demoSet": {
            "type": [
              "string",
              "null"
            ]
          },
          "testSlot": {
            "type": [
              "integer",
              "null"
            ]
          },
          "agentPrices": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "docs": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "INN": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other1": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "other2": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "requisites": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              }
            }
          },
          "timeZone": {
            "type": "string",
            "default": "Europe/Moscow"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "activityType": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "activityDescription": {
            "type": [
              "string",
              "null"
            ]
          },
          "titleHash": {
            "type": "string"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "createUID": {
            "type": "string"
          }
        },
        "title": "CompanyUpdateBody",
        "description": "Partial body (Valid.Patch) for `company/update` — все поля опциональны"
      },
      "CiCurrentTaskParams": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          }
        },
        "required": [
          "email"
        ],
        "title": "CiCurrentTaskParams",
        "description": "Query/header params for `ci/current-task`"
      },
      "CiDeployedParams": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "cID"
        ],
        "title": "CiDeployedParams",
        "description": "Query/header params for `ci/deployed`"
      },
      "CiDeployedBody": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "issues"
        ],
        "title": "CiDeployedBody",
        "description": "JSON body for `ci/deployed`"
      },
      "CiResolveParams": {
        "type": "object",
        "properties": {
          "cID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "cID"
        ],
        "title": "CiResolveParams",
        "description": "Query/header params for `ci/resolve`"
      },
      "CiResolveBody": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "issues"
        ],
        "title": "CiResolveBody",
        "description": "JSON body for `ci/resolve`"
      },
      "ChatMessageCreateParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatMessageCreateParams",
        "description": "Query/header params for `chat/message/create`"
      },
      "ChatMessageCreateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "dt": {
            "type": "string",
            "format": "date-time"
          },
          "text": {
            "type": "string"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "replied": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ID": {
                "type": "string",
                "format": "uuid"
              },
              "text": {
                "type": "string"
              },
              "authorUID": {
                "type": "string",
                "format": "uuid"
              },
              "attachmentFID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "attachmentCount": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "ID",
              "text",
              "authorUID"
            ]
          },
          "mentioned": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "forwarded": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "chatID": {
                "type": "string",
                "format": "uuid"
              },
              "messageID": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "chatID",
              "messageID"
            ]
          }
        },
        "title": "ChatMessageCreateBody",
        "description": "Partial body (Valid.Patch) for `chat/message/create` — все поля опциональны"
      },
      "ChatMessageDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ChatMessageDeleteParams",
        "description": "Query/header params for `chat/message/delete`"
      },
      "ChatMessageReactionParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "reaction": {
            "type": "string"
          },
          "dt": {
            "type": [
              "string",
              "null"
            ]
          },
          "replace": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ID",
          "reaction"
        ],
        "title": "ChatMessageReactionParams",
        "description": "Query/header params for `chat/message/reaction`"
      },
      "ChatMessageUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "ChatMessageUpdateParams",
        "description": "Query/header params for `chat/message/update`"
      },
      "ChatMessageUpdateBody": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {}
          },
          "mentioned": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "title": "ChatMessageUpdateBody",
        "description": "Partial body (Valid.Patch) for `chat/message/update` — все поля опциональны"
      },
      "ChatMessageViewedBody": {
        "type": "object",
        "additionalProperties": true,
        "title": "ChatMessageViewedBody",
        "description": "JSON body for `chat/message/viewed`"
      },
      "ChatAdminParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": "string",
            "format": "uuid"
          },
          "isAdmin": {
            "type": "boolean"
          }
        },
        "required": [
          "chatID",
          "userID",
          "isAdmin"
        ],
        "title": "ChatAdminParams",
        "description": "Query/header params for `chat/admin`"
      },
      "ChatCreateBody": {
        "type": "object",
        "properties": {
          "chatFields": {
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/Chat_Type"
              },
              "logoFID": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "type"
            ]
          },
          "memberUserIDs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "chatFields"
        ],
        "title": "ChatCreateBody",
        "description": "JSON body for `chat/create`"
      },
      "ChatDeleteParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatDeleteParams",
        "description": "Query/header params for `chat/delete`"
      },
      "ChatJoinParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatJoinParams",
        "description": "Query/header params for `chat/join`"
      },
      "ChatLeaveParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          },
          "userID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatLeaveParams",
        "description": "Query/header params for `chat/leave`"
      },
      "ChatNotificationsParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatNotificationsParams",
        "description": "Query/header params for `chat/notifications`"
      },
      "ChatOpenParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          },
          "fromTS": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatOpenParams",
        "description": "Query/header params for `chat/open`"
      },
      "ChatUpdateParams": {
        "type": "object",
        "properties": {
          "chatID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "chatID"
        ],
        "title": "ChatUpdateParams",
        "description": "Query/header params for `chat/update`"
      },
      "ChatUpdateBody": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "cID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/Chat_Type"
          },
          "logoFID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "createDT": {
            "type": "string",
            "format": "date-time"
          },
          "updTS": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "updUID": {
            "type": "string"
          },
          "isDeleted": {
            "type": "boolean",
            "default": false
          },
          "deletedTS": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix timestamp in milliseconds"
          }
        },
        "title": "ChatUpdateBody",
        "description": "Partial body (Valid.Patch) for `chat/update` — все поля опциональны"
      },
      "AgentMemoryCreateBody": {
        "type": "object",
        "properties": {
          "level": {
            "$ref": "#/components/schemas/AgentMemory_Level"
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "repositoryID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "load": {
            "$ref": "#/components/schemas/AgentMemory_Load"
          },
          "jobs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AgentMemory_Job"
            }
          },
          "title": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "level",
          "load",
          "title",
          "text"
        ],
        "title": "AgentMemoryCreateBody",
        "description": "JSON body for `agent-memory/create`"
      },
      "AgentMemoryDeleteParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          }
        },
        "required": [
          "ID",
          "version"
        ],
        "title": "AgentMemoryDeleteParams",
        "description": "Query/header params for `agent-memory/delete`"
      },
      "agent_memory_list_sort": {
        "type": "string",
        "enum": [
          "usage"
        ],
        "x-enum-varnames": [
          "usage"
        ],
        "title": "agent_memory_list_sort",
        "description": "`usage` = \"usage\""
      },
      "AgentMemoryListParams": {
        "type": "object",
        "properties": {
          "IDs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "level": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentMemory_Level"
              },
              {
                "type": "null"
              }
            ]
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "repositoryID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "load": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentMemory_Load"
              },
              {
                "type": "null"
              }
            ]
          },
          "jobs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AgentMemory_Job"
            }
          },
          "verified": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "shared": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "authorUID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "query": {
            "type": [
              "string",
              "null"
            ]
          },
          "unusedDays": {
            "type": [
              "integer",
              "null"
            ]
          },
          "sort": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/agent_memory_list_sort"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "AgentMemoryListParams",
        "description": "Query/header params for `agent-memory/list`"
      },
      "AgentMemoryUpdateParams": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "ID"
        ],
        "title": "AgentMemoryUpdateParams",
        "description": "Query/header params for `agent-memory/update`"
      },
      "AgentMemoryUpdateBody": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds"
          },
          "level": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentMemory_Level"
              },
              {
                "type": "null"
              }
            ]
          },
          "projectID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "repositoryID": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "load": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentMemory_Load"
              },
              {
                "type": "null"
              }
            ]
          },
          "jobs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AgentMemory_Job"
            }
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "shared": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "version"
        ],
        "title": "AgentMemoryUpdateBody",
        "description": "JSON body for `agent-memory/update`"
      },
      "SSEAppStateEvent": {
        "title": "SSEAppStateEvent",
        "type": "object",
        "description": "Одно SSE-сообщение канала app-state (JSON в data:)",
        "required": [
          "event"
        ],
        "properties": {
          "event": {
            "$ref": "#/components/schemas/SSEMessageEvent"
          },
          "code": {
            "type": "integer",
            "description": "Опциональный HTTP-like code (напр. 401 invalidate)"
          },
          "data": {
            "description": "Payload зависит от event (см. x-sse-payloads)",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {}
              }
            ]
          },
          "ts": {
            "type": "integer",
            "description": "Server timestamp ms"
          }
        },
        "x-sse-payloads": {
          "onConnect": {
            "description": "Соединение установлено",
            "data": {
              "type": "object"
            }
          },
          "session-user": {
            "description": "Current user DTO + session context",
            "schema": {
              "$ref": "#/components/schemas/UserDto"
            }
          },
          "company-state": {
            "description": "Company info + dictionaries",
            "schema": {
              "$ref": "#/components/schemas/Company"
            }
          },
          "work-state": {
            "description": "Work / kanban / activity state patch",
            "schema": {
              "type": "object"
            }
          },
          "notification": {
            "description": "Notification entity",
            "schema": {
              "$ref": "#/components/schemas/Notification"
            }
          },
          "team": {
            "description": "Team / roles patch",
            "schema": {
              "type": "object"
            }
          },
          "chat-state": {
            "description": "Chat list/state",
            "schema": {
              "$ref": "#/components/schemas/Chat"
            }
          },
          "chat-message": {
            "description": "Chat message",
            "schema": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "chat-member": {
            "description": "Chat member",
            "schema": {
              "$ref": "#/components/schemas/ChatMember"
            }
          }
        }
      },
      "AgentMemoryService_RepositoryRef": {
        "title": "AgentMemoryService_RepositoryRef",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref AgentMemoryService_RepositoryRef (from ResponseData AST)"
      },
      "ResolvedTask": {
        "title": "ResolvedTask",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref ResolvedTask (from ResponseData AST)"
      },
      "DefaultAllowSchemaKey": {
        "title": "DefaultAllowSchemaKey",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref DefaultAllowSchemaKey (from ResponseData AST)"
      },
      "AllowsSet": {
        "title": "AllowsSet",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref AllowsSet (from ResponseData AST)"
      },
      "OrganizationRequisites": {
        "title": "OrganizationRequisites",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref OrganizationRequisites (from ResponseData AST)"
      },
      "BankRequisites": {
        "title": "BankRequisites",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref BankRequisites (from ResponseData AST)"
      },
      "AuthSession": {
        "title": "AuthSession",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref AuthSession (from ResponseData AST)"
      },
      "CostsRow": {
        "title": "CostsRow",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref CostsRow (from ResponseData AST)"
      },
      "CostsWorklog": {
        "title": "CostsWorklog",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref CostsWorklog (from ResponseData AST)"
      },
      "TaskGit_Type": {
        "title": "TaskGit_Type",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref TaskGit_Type (from ResponseData AST)"
      },
      "GitComment": {
        "title": "GitComment",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref GitComment (from ResponseData AST)"
      },
      "GitRepositoryWithIntegrationTypeDTO": {
        "title": "GitRepositoryWithIntegrationTypeDTO",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref GitRepositoryWithIntegrationTypeDTO (from ResponseData AST)"
      },
      "CommitsGroup": {
        "title": "CommitsGroup",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref CommitsGroup (from ResponseData AST)"
      },
      "GitIntegrationExtended": {
        "title": "GitIntegrationExtended",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref GitIntegrationExtended (from ResponseData AST)"
      },
      "GitRepositoryPassport_Type": {
        "title": "GitRepositoryPassport_Type",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref GitRepositoryPassport_Type (from ResponseData AST)"
      },
      "GistService_View": {
        "title": "GistService_View",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref GistService_View (from ResponseData AST)"
      },
      "LLMFunctionView": {
        "title": "LLMFunctionView",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref LLMFunctionView (from ResponseData AST)"
      },
      "EntityMeetingsByYears": {
        "title": "EntityMeetingsByYears",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref EntityMeetingsByYears (from ResponseData AST)"
      },
      "NotificationItem": {
        "title": "NotificationItem",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref NotificationItem (from ResponseData AST)"
      },
      "OAuthClientsServiceDto": {
        "title": "OAuthClientsServiceDto",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref OAuthClientsServiceDto (from ResponseData AST)"
      },
      "OAuthConnectService_Company": {
        "title": "OAuthConnectService_Company",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref OAuthConnectService_Company (from ResponseData AST)"
      },
      "DataGroup": {
        "title": "DataGroup",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref DataGroup (from ResponseData AST)"
      },
      "Product_Team": {
        "title": "Product_Team",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref Product_Team (from ResponseData AST)"
      },
      "ProjectRepositoryDTO": {
        "title": "ProjectRepositoryDTO",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref ProjectRepositoryDTO (from ResponseData AST)"
      },
      "TaskSearchItem": {
        "title": "TaskSearchItem",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref TaskSearchItem (from ResponseData AST)"
      },
      "TaskMeta_WorkCorrection": {
        "title": "TaskMeta_WorkCorrection",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref TaskMeta_WorkCorrection (from ResponseData AST)"
      },
      "Company_Dictionary": {
        "title": "Company_Dictionary",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref Company_Dictionary (from ResponseData AST)"
      },
      "CompanyItem": {
        "title": "CompanyItem",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref CompanyItem (from ResponseData AST)"
      },
      "OrgDocs": {
        "title": "OrgDocs",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref OrgDocs (from ResponseData AST)"
      },
      "PaymentMonthNorms": {
        "title": "PaymentMonthNorms",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref PaymentMonthNorms (from ResponseData AST)"
      },
      "PaymentMonthUser": {
        "title": "PaymentMonthUser",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref PaymentMonthUser (from ResponseData AST)"
      },
      "PaymentMonthStat": {
        "title": "PaymentMonthStat",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref PaymentMonthStat (from ResponseData AST)"
      },
      "DataProduct": {
        "title": "DataProduct",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref DataProduct (from ResponseData AST)"
      },
      "User_DocumentPassport": {
        "title": "User_DocumentPassport",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref User_DocumentPassport (from ResponseData AST)"
      },
      "ApiTokenDto": {
        "title": "ApiTokenDto",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref ApiTokenDto (from ResponseData AST)"
      },
      "Item": {
        "title": "Item",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref Item (from ResponseData AST)"
      },
      "DevID": {
        "title": "DevID",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref DevID (from ResponseData AST)"
      },
      "Tz": {
        "title": "Tz",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref Tz (from ResponseData AST)"
      },
      "App": {
        "title": "App",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref App (from ResponseData AST)"
      },
      "AppVer": {
        "title": "AppVer",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref AppVer (from ResponseData AST)"
      },
      "RKey": {
        "title": "RKey",
        "type": "object",
        "additionalProperties": true,
        "description": "Stub schema for unresolved $ref RKey (from ResponseData AST)"
      }
    }
  }
}