import type { ApplyGlobalResponse } from 'hono/client'; import type { JwtVariables } from 'hono/jwt'; type FinanceCurrency = "ruble" | "dollar" | "euro"; type FinanceTransactionType = "refund" | "income" | "expense" | "transfer"; type GrowthDirection = "positive" | "negative" | "none"; type Variables = JwtVariables; /** Shared error body for middleware / HTTPException responses (typed into AppType). */ export type ApiError = { success: false; error: string; }; declare const routes: import("hono/hono-base").HonoBase<{ Variables: Variables; }, ({ "/swagger-ui": { $get: { input: {}; output: {}; outputFormat: string; status: import("hono/utils/http-status").StatusCode; }; }; } & { "/openapi.json": { $get: { input: {}; output: { readonly openapi: "3.0.3"; readonly info: { readonly title: "Auth Service API"; readonly version: "1.5.12"; readonly description: "OpenAPI specification for the Auth, Integrations, Workspace, Payments, Analytics, Tasks, Templates, Tags, Failure Reasons, Comments, Assignees, Chat, Events, CInvoices, Customer History, Files, Finance, and Notifications endpoints exposed by the k3-core platform. Unhandled HTTPException and unexpected errors are normalized by the global error handler to `{ success: false, error: string }` (status preserved for HTTPException; 500 otherwise)."; }; readonly servers: readonly [ { readonly url: "https://api.mestra.chat/"; readonly description: "Production"; }, { readonly url: "http://localhost:3001/"; readonly description: "Local development"; } ]; readonly tags: readonly [ { readonly name: "System"; readonly description: "Service level endpoints"; }, { readonly name: "Auth"; readonly description: "Authentication and session management"; }, { readonly name: "Integrations"; readonly description: "Google Calendar OAuth and app calendar; list/disconnect; calendar CRUD and month listing (bearer token and linked integration only); list-assignees requires workspace access and crm::calendar write."; }, { readonly name: "Workspace"; readonly description: "Workspace management endpoints"; }, { readonly name: "Payments"; readonly description: "Workspace subscription invoices, YooKassa checkout, renewals, and upgrades."; }, { readonly name: "Analytics"; readonly description: "Read-only CRM analytics for a workspace. Requires workspace access and crm::analytics read access."; }, { readonly name: "Tasks"; readonly description: "Task management endpoints"; }, { readonly name: "Templates"; readonly description: "Task message template list, create, and delete; requires workspace access and crm::tasks read or write."; }, { readonly name: "Tags"; readonly description: "Workspace tag CRUD and assignment to tasks, real-estate customers, or services; list/create accept crm::tasks, crm::customers, or crm::services access; update/delete require crm::general write."; }, { readonly name: "Failure Reasons"; readonly description: "Workspace failure-reason CRUD and assignment to tasks. Requires workspace access and crm::tasks read or write."; }, { readonly name: "Comments"; readonly description: "Comment create, list, edit, and delete on tasks; create requires crm::tasks read, edit/delete require write."; }, { readonly name: "Assignees"; readonly description: "Task assignee management endpoints"; }, { readonly name: "Services"; readonly description: "Workspace service management endpoints"; }, { readonly name: "Customers"; readonly description: "Category-specific customer CRUD. Real-estate workspaces persist leads on customer_real_estates."; }, { readonly name: "Events"; readonly description: "Server-Sent Events (SSE) streaming endpoints"; }, { readonly name: "CInvoices"; readonly description: "Customer invoice management for real-estate workspaces. Requires workspace access and crm::customers access. Seller finance account, customer, and service must belong to the workspace. Invoice creators can list finance accounts for seller selection without crm::finance access or private account fields."; }, { readonly name: "Customer History"; readonly description: "Customer service-history CRUD for real-estate workspaces. Requires workspace access and crm::customers access. Customer and service must belong to the workspace."; }, { readonly name: "Files"; readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), optional nested folder destination under `{workspace}/folders/{path}/`, profile and workspace picture upload/confirm/delete, comment attachment upload/confirm, list task comment files with download URLs, service file upload/confirm/delete, list service files with download URLs, customer file upload/confirm/delete, finance receipt upload/confirm/delete, folder create/delete (nested paths), list (includes pin metadata; excludes `.tmp` objects), storage usage, pin/unpin, download by relative path, move, and file delete. General uploads accept JPEG/PNG/WebP/PDF; profile/workspace pictures accept JPEG/PNG only (0.5 MB). Workspace file routes require active collaborator status and crm::files access; comment attachments require crm::tasks write/read; service files require crm::services write/read; customer files require crm::customers write/read; finance receipts require crm::finance write/read."; }, { readonly name: "Chat"; readonly description: "Matrix (Synapse) chat session bootstrap and chat-tenant collaborator listing; owners get an `owner_` username prefix; caches Matrix access tokens. Requires workspace access and crm::chats read."; }, { readonly name: "Notifications"; readonly description: "Cursor-based incremental notification sync, plus mark-read / archive (single or all). Clients store the sync cursor and pass it on the next call; mutations bump updated_at so changes propagate via sync."; }, { readonly name: "Finance"; readonly description: "Workspace finance accounts (ordered cards with name, color, currency, opening balance, and optional company/bank details), ledger transactions (income, expense, refund, transfer), and a numbers-visibility toggle for the default finance view. Requires workspace access and crm::finance read or write."; } ]; readonly components: { readonly securitySchemes: { readonly bearerAuth: { readonly type: "http"; readonly scheme: "bearer"; readonly bearerFormat: "JWT"; readonly description: "Short-lived access token (iss: access). Claims include email and userId."; }; readonly bearerRefresh: { readonly type: "http"; readonly scheme: "bearer"; readonly bearerFormat: "JWT"; readonly description: "Long-lived refresh token (iss: refresh). Claims include email and userId."; }; readonly billingAdminToken: { readonly type: "http"; readonly scheme: "bearer"; readonly description: "Operations-only token configured as BILLING_ADMIN_TOKEN. Never expose this token to a browser client."; }; }; readonly schemas: { readonly OtpRequestSuccess: { readonly type: "object"; readonly required: readonly [ "success", "expiresAt" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly expiresAt: { readonly type: "string"; readonly format: "date-time"; readonly description: "ISO timestamp when the one-time password expires"; readonly example: "2025-01-20T10:30:00.000Z"; }; }; }; readonly OtpRequestFailure: { readonly type: "object"; readonly required: readonly [ "success" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly expiresAt: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Existing OTP expiration if still valid."; readonly example: "2025-01-20T10:30:00.000Z"; }; readonly error: { readonly nullable: true; readonly description: "Validation details (object) or a linking error string such as Phone already in use."; readonly oneOf: readonly [ { readonly type: "object"; readonly additionalProperties: true; }, { readonly type: "string"; readonly enum: readonly [ "User not found", "Phone is already verified", "Email is already verified", "Phone already in use", "Email already in use", "An active OTP already exists" ]; } ]; }; }; }; readonly VerifyOtpSuccess: { readonly type: "object"; readonly required: readonly [ "success", "accessToken", "refreshToken" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly accessToken: { readonly type: "string"; readonly description: "JWT access token (expires in 15 minutes). Claims include email and userId."; }; readonly refreshToken: { readonly type: "string"; readonly description: "JWT refresh token (expires in 7 days, or 30 days when keepSignIn is true). Claims include email and userId."; }; }; }; readonly VerifyOtpFailure: { readonly type: "object"; readonly required: readonly [ "success" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly accessToken: { readonly type: "string"; readonly nullable: true; readonly description: "Null when verification fails."; readonly example: null; }; readonly refreshToken: { readonly type: "string"; readonly nullable: true; readonly description: "Null when verification fails."; readonly example: null; }; readonly error: { readonly nullable: true; readonly description: "Validation details (object) or a linking error string."; readonly oneOf: readonly [ { readonly type: "object"; readonly additionalProperties: true; }, { readonly type: "string"; readonly enum: readonly [ "User not found", "Invalid or expired OTP", "Phone is already verified", "Email is already verified", "Phone already in use", "Email already in use" ]; } ]; }; }; }; readonly SimpleSuccess: { readonly type: "object"; readonly required: readonly [ "success" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; }; }; readonly NotificationType: { readonly type: "string"; readonly enum: readonly [ "info", "warning", "success", "failure" ]; readonly default: "info"; readonly description: "Notification severity (`notification_type` Postgres enum)."; }; readonly Notification: { readonly type: "object"; readonly required: readonly [ "id", "userId", "key", "data", "type", "read", "archive", "created_at" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly userId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Workspace this notification belongs to. Null for account-level notices (e.g. first registration)."; }; readonly key: { readonly type: "string"; readonly enum: readonly [ "account.welcome", "workspace.created", "workspace.left", "workspace.removed", "workspace.joined", "task.assigned", "task.unassigned", "legacy.custom" ]; readonly description: "Locale-neutral notification event key. Clients render it from their translation catalog."; }; readonly data: { readonly type: "object"; readonly additionalProperties: true; readonly description: "Interpolation data for the notification key, such as `taskSubject`."; }; readonly title: { readonly type: "string"; readonly maxLength: 256; readonly nullable: true; readonly description: "Legacy pre-rendered title. Use only when key is `legacy.custom`."; }; readonly message: { readonly type: "string"; readonly maxLength: 256; readonly nullable: true; readonly description: "Legacy pre-rendered message. Use only when key is `legacy.custom`."; }; readonly type: { readonly $ref: "#/components/schemas/NotificationType"; }; readonly read: { readonly type: "boolean"; }; readonly archive: { readonly type: "boolean"; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Set when the notification is marked read or archived."; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly verified_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly suspended_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly NotificationSyncSuccess: { readonly type: "object"; readonly required: readonly [ "success", "notifications", "cursor", "hasMore" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly notifications: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Notification"; }; readonly description: "Notifications created or updated after the request cursor, oldest change first."; }; readonly cursor: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Newest change timestamp in this page. Store it and pass it as `cursor` on the next sync. Null only when no cursor was sent and no notifications exist."; }; readonly hasMore: { readonly type: "boolean"; readonly description: "True when more changes remain; call again immediately with the returned cursor."; }; }; }; readonly CreateWorkspaceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspace", "name", "invoiceId", "subscriptionStatus" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; }; readonly invoiceId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Pending first-payment invoice for Economy, Standard, or Professional. Null for Free trial."; }; readonly subscriptionStatus: { readonly type: "string"; readonly enum: readonly [ "trialing", "pending", "active" ]; }; }; }; readonly ErrorResponse: { readonly type: "object"; readonly required: readonly [ "success", "error" ]; readonly description: "Standard API error body. Route handlers and the global HTTPException handler return this shape. Validation failures may put Valibot details in `error` instead of a string."; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly error: { readonly description: "Human-readable message, or Valibot validation details for invalid payloads."; readonly oneOf: readonly [ { readonly type: "string"; }, { readonly type: "object"; readonly additionalProperties: true; } ]; }; readonly code: { readonly type: "string"; readonly description: "Optional stable machine-readable error code."; readonly example: "CHECKOUT_PENDING"; }; readonly link: { readonly type: "string"; readonly format: "uri"; readonly nullable: true; readonly description: "Optional documentation link (used by the global 404 handler)."; readonly example: "https://api.mestra.chat/docs"; }; }; }; readonly NotificationIdRequest: { readonly type: "object"; readonly required: readonly [ "notificationId" ]; readonly properties: { readonly notificationId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Notification identifier belonging to the authenticated user."; }; }; }; readonly GoogleCalendarAuthorizeResponse: { readonly type: "object"; readonly required: readonly [ "success", "url" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "Google OAuth 2.0 authorization URL (PKCE) including userinfo and Calendar scopes as configured by the connect endpoint."; }; }; }; readonly IntegrationItem: { readonly type: "object"; readonly required: readonly [ "scope", "status" ]; readonly properties: { readonly scope: { readonly type: "string"; readonly description: "Granted OAuth scopes for the stored integration token."; }; readonly status: { readonly type: "string"; readonly description: "Integration status. `pending` while background calendar/watch setup is running after the OAuth callback, `active` once setup completed, `error` if setup failed."; readonly enum: readonly [ "pending", "active", "error" ]; readonly example: "active"; }; }; }; readonly IntegrationListResponse: { readonly type: "object"; readonly required: readonly [ "success", "integrations", "user" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly integrations: { readonly $ref: "#/components/schemas/IntegrationItem"; }; readonly user: { readonly type: "string"; readonly format: "email"; readonly description: "Google account email from OAuth2 v2 userinfo (using the stored integration tokens)."; }; }; }; readonly CalendarEventAttendee: { readonly type: "object"; readonly required: readonly [ "email" ]; readonly properties: { readonly email: { readonly type: "string"; readonly format: "email"; }; }; }; readonly CalendarReminderOverride: { readonly type: "object"; readonly required: readonly [ "method", "minutes" ]; readonly properties: { readonly method: { readonly type: "string"; readonly enum: readonly [ "email", "popup" ]; }; readonly minutes: { readonly type: "integer"; readonly description: "Minutes before the event start."; }; }; }; readonly CreateCalendarEventRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "title", "startDate", "endDate", "timeZone" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace context for the request."; }; readonly title: { readonly type: "string"; }; readonly description: { readonly type: "string"; readonly description: "Optional event description."; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "event", "conference", "booking", "meeting" ]; readonly default: "event"; readonly description: "Event classification. When conferenceData is true, this value is stored on the calendar event as extendedProperties.private.type."; }; readonly startDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Event start in ISO 8601; interpreted with timeZone."; }; readonly endDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Event end in ISO 8601; interpreted with timeZone."; }; readonly timeZone: { readonly type: "string"; readonly description: "IANA time zone id for start/end (e.g. Europe/Amsterdam)."; readonly example: "Europe/Amsterdam"; }; readonly attendees: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CalendarEventAttendee"; }; readonly description: "Guest emails; server sends calendar updates to attendees."; }; readonly conferenceData: { readonly type: "boolean"; readonly description: "When true, requests a Google Meet conference and sets extendedProperties.private.type from the type field."; }; readonly reminders: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CalendarReminderOverride"; }; readonly description: "Custom reminder overrides; omit to rely on calendar defaults where applicable."; }; }; }; readonly CreateCalendarEventResponse: { readonly type: "object"; readonly required: readonly [ "success", "event" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly event: { readonly type: "object"; readonly description: "Google Calendar API v3 event resource returned by events.insert."; readonly additionalProperties: true; }; }; }; readonly CalendarMonthEventsListResponse: { readonly type: "object"; readonly required: readonly [ "success", "events" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly events: { readonly type: "array"; readonly nullable: true; readonly items: { readonly type: "object"; readonly description: "Google Calendar API v3 event resource."; readonly additionalProperties: true; }; readonly description: "events.list items for the requested window (may be empty or null)."; }; }; }; readonly UpdateCalendarEventRequest: { readonly type: "object"; readonly required: readonly [ "eventId", "workspace" ]; readonly properties: { readonly eventId: { readonly type: "string"; readonly description: "Google Calendar event id (opaque string from Google)."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace context for the request."; }; readonly title: { readonly type: "string"; readonly description: "Maps to Calendar summary when set."; }; readonly description: { readonly type: "string"; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "event", "conference", "booking", "meeting" ]; readonly default: "event"; readonly description: "Stored as extendedProperties.private.type when set."; }; readonly startDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Requires timeZone when updating start."; }; readonly endDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Requires timeZone when updating end."; }; readonly timeZone: { readonly type: "string"; readonly description: "IANA time zone; used with startDate/endDate when those are sent."; }; readonly attendees: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CalendarEventAttendee"; }; }; readonly conferenceData: { readonly type: "boolean"; readonly description: "When true, requests Meet conference data (patch with conferenceDataVersion 1)."; }; readonly reminders: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CalendarReminderOverride"; }; }; }; }; readonly IntegrationCalendarEventIdRequest: { readonly type: "object"; readonly required: readonly [ "eventId", "workspace" ]; readonly properties: { readonly eventId: { readonly type: "string"; readonly description: "Google Calendar event id to remove or cancel."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace context for the request."; }; }; }; readonly IntegrationCalendarAssignee: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "role", "email" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; }; readonly role: { readonly type: "string"; readonly description: "Collaborator role in the workspace."; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; readonly email: { readonly type: "string"; readonly format: "email"; }; }; }; readonly ListIntegrationCalendarAssigneesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "assignees" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly assignees: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/IntegrationCalendarAssignee"; }; readonly description: "Workspace collaborators joined with user profile fields for attendee pickers."; }; }; }; readonly User: { readonly type: "object"; readonly required: readonly [ "id", "emailVerified", "phoneVerified" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly email: { readonly type: "string"; readonly format: "email"; readonly nullable: true; }; readonly phone: { readonly type: "string"; readonly nullable: true; }; readonly emailVerified: { readonly type: "boolean"; }; readonly phoneVerified: { readonly type: "boolean"; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; readonly description: "Presigned profile avatar URL (7-day expiry, refreshed periodically); empty string when unset."; }; }; }; readonly WorkspaceCategory: { readonly type: "string"; readonly enum: readonly [ "real estate and property", "construction and home improvement", "healthcare and medical", "beauty and wellness", "fitness and sports", "education", "recruitment and hr", "legal and professional services", "consulting", "marketing and creative agencies", "migration and study abroad", "hospitality and events", "tourism and travel", "restaurants and food service", "retail and e-commerce", "wholesale and distribution", "manufacturing and industrial", "automotive", "technology and saas", "customer support and contact centers", "home services", "franchise and multi-branch businesses", "general" ]; readonly description: "Workspace vertical or use-case category."; readonly default: "general"; }; readonly WorkspaceMaxCollaborators: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 10000; readonly description: "Number of billable seats reserved for the workspace."; }; readonly WorkspaceResourceAccess: { readonly type: "object"; readonly required: readonly [ "name", "action" ]; readonly properties: { readonly name: { readonly type: "string"; readonly description: "Resource identifier (e.g. crm::general)."; readonly example: "crm::general"; }; readonly action: { readonly type: "string"; readonly enum: readonly [ "read", "write" ]; readonly description: "Granted access level for the resource."; }; }; }; readonly Workspace: { readonly type: "object"; readonly required: readonly [ "id", "name", "maxCollaborators", "hasPaid" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; }; readonly maxCollaborators: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly hasPaid: { readonly type: "boolean"; }; readonly category: { readonly $ref: "#/components/schemas/WorkspaceCategory"; }; readonly picture: { readonly type: "string"; readonly nullable: true; readonly description: "Presigned workspace avatar URL (7-day expiry, refreshed periodically); empty string when unset."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly WorkspaceSummary: { readonly type: "object"; readonly required: readonly [ "workspaceId", "workspaceName", "workspaceCategory", "role", "maxCollaborators", "hasPaid", "status", "planCode", "subscriptionStatus", "trialEndsAt", "isOwner", "resources" ]; readonly properties: { readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceName: { readonly type: "string"; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; readonly description: "Presigned workspace avatar URL from `workspaces.picture` (7-day expiry); null or empty when unset."; }; readonly workspaceCategory: { readonly $ref: "#/components/schemas/WorkspaceCategory"; }; readonly role: { readonly type: "string"; readonly example: "owner"; }; readonly maxCollaborators: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly hasPaid: { readonly type: "boolean"; }; readonly status: { readonly type: "string"; readonly description: "Collaborator status for the workspace (e.g., active, pending)."; }; readonly planCode: { readonly type: "string"; readonly nullable: true; readonly description: "Current workspace plan code from the subscription when present (including pending unpaid), else `workspaces.plan_id` (e.g. free, economy, standard, professional, or a private enterprise code). Null only for legacy workspaces that predate billing plans."; readonly example: "free"; }; readonly subscriptionStatus: { readonly type: "string"; readonly nullable: true; readonly enum: readonly [ "trialing", "pending", "active", "past_due", "frozen", "canceled" ]; readonly description: "Current billing subscription status. Null for legacy workspaces that predate subscriptions."; }; readonly trialEndsAt: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Free-trial expiration time. Null for non-trial and legacy workspaces."; }; readonly token: { readonly type: "string"; readonly nullable: true; readonly description: "Invitation token; null after activation."; }; readonly isOwner: { readonly type: "boolean"; readonly description: "Indicates whether the user is the owner of the workspace."; }; readonly resources: { readonly type: "array"; readonly description: "Resources the current user can access in this workspace."; readonly items: { readonly $ref: "#/components/schemas/WorkspaceResourceAccess"; }; }; }; }; readonly WorkspacePolicy: { readonly type: "object"; readonly required: readonly [ "id", "subjectId", "resourceId", "workspaceId" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly subjectId: { readonly type: "string"; readonly format: "uuid"; }; readonly resourceId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; }; }; readonly WorkspacePolicyCollaborator: { readonly type: "object"; readonly required: readonly [ "email", "role", "collaboratorId", "status", "resources", "isOwner", "isCurrentUser" ]; readonly properties: { readonly firstName: { readonly type: "string"; }; readonly lastName: { readonly type: "string"; }; readonly email: { readonly type: "string"; readonly format: "email"; }; readonly role: { readonly type: "string"; readonly description: "Collaborator role within the workspace."; }; readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Collaborator row ID (`collaborators.id`). Use this for policy, role, and remove-collaborator mutations."; }; readonly status: { readonly type: "string"; readonly description: "Collaborator status (e.g. active, pending)."; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; readonly resources: { readonly type: "array"; readonly description: "Resources granted to this collaborator."; readonly items: { readonly $ref: "#/components/schemas/WorkspaceResourceAccess"; }; }; readonly isOwner: { readonly type: "boolean"; readonly description: "True when this collaborator is the workspace owner."; }; readonly isCurrentUser: { readonly type: "boolean"; readonly description: "True when this row is the authenticated user."; }; }; }; readonly WorkspaceResource: { readonly type: "object"; readonly required: readonly [ "id", "name", "action", "description" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; }; readonly action: { readonly type: "string"; readonly description: "Action identifier bundled with the resource."; readonly example: "crm::general::write"; }; readonly description: { readonly type: "string"; }; }; }; readonly WorkspaceCalculatorPlan: { readonly type: "object"; readonly required: readonly [ "price", "maxCollaborators" ]; readonly properties: { readonly price: { readonly type: "number"; readonly format: "float"; readonly minimum: 0; readonly description: "Price in USD for the plan."; }; readonly maxCollaborators: { readonly type: "integer"; readonly minimum: 1; readonly description: "Maximum collaborators covered by the plan."; }; }; }; readonly WorkspaceCalculatorResponse: { readonly type: "object"; readonly required: readonly [ "success", "plans", "price" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly plans: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/WorkspacePlan"; }; }; readonly price: { readonly type: "array"; readonly items: { readonly type: "object"; readonly required: readonly [ "code", "amountKopecks" ]; readonly properties: { readonly code: { readonly type: "string"; }; readonly amountKopecks: { readonly type: "integer"; readonly description: "Monthly total for the requested seat count, in kopecks."; }; }; }; }; }; }; readonly Task: { readonly type: "object"; readonly required: readonly [ "id", "subject", "workspaceId", "created_by" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly subject: { readonly type: "string"; }; readonly description: { readonly type: "string"; readonly nullable: true; }; readonly phaseId: { readonly type: "string"; readonly nullable: true; readonly format: "uuid"; readonly description: "Identifier of this task's workspace phase."; }; readonly phaseName: { readonly type: "string"; readonly nullable: true; readonly description: "Current phase name."; }; readonly phaseSortOrder: { readonly type: "integer"; readonly nullable: true; readonly description: "Current phase order within the workspace."; }; readonly dueDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly priority: { readonly type: "string"; readonly enum: readonly [ "low", "medium", "high" ]; readonly nullable: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Customer identifier associated with the task, if any."; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; readonly description: "Profile picture URL of the task creator."; }; readonly firstName: { readonly type: "string"; readonly nullable: true; readonly description: "First name of the task creator."; }; readonly lastName: { readonly type: "string"; readonly nullable: true; readonly description: "Last name of the task creator."; }; readonly visibility: { readonly type: "string"; readonly enum: readonly [ "public", "private" ]; readonly nullable: true; readonly description: "Task visibility. Public tasks are visible to all workspace members with read access; private tasks only to assignees."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly comments_count: { readonly type: "integer"; readonly minimum: 0; readonly nullable: true; readonly description: "Total number of comments attached to the task."; }; readonly tags: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TagListItem"; }; readonly description: "Tags assigned to the task (id, name, description)."; }; }; }; readonly TaskPhase: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "name", "sortOrder", "isBuiltin" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; readonly maxLength: 64; }; readonly sortOrder: { readonly type: "integer"; readonly minimum: 0; }; readonly isBuiltin: { readonly type: "boolean"; readonly description: "Whether this phase is built-in and cannot be renamed or deleted."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly CreateTaskSuccess: { readonly type: "object"; readonly required: readonly [ "success", "task" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly task: { readonly $ref: "#/components/schemas/Task"; }; }; }; readonly Tag: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "name" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace the tag belongs to."; }; readonly name: { readonly type: "string"; readonly description: "Tag label."; }; readonly description: { readonly type: "string"; readonly nullable: true; readonly description: "Optional tag description."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly verified_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly suspended_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly TagListItem: { readonly type: "object"; readonly required: readonly [ "id", "name" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; readonly name: { readonly type: "string"; readonly description: "Tag label."; }; readonly description: { readonly type: "string"; readonly nullable: true; readonly description: "Tag description when set."; }; }; readonly description: "Tag fields returned on list endpoints (id, name, description)."; }; readonly CreateTagSuccess: { readonly type: "object"; readonly required: readonly [ "success", "tag" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly tag: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Tag"; }; readonly description: "Created tag row(s) from insert (Drizzle returning)."; }; }; }; readonly TagUpdateSuccess: { readonly type: "object"; readonly required: readonly [ "success", "tag" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly tag: { readonly type: "object"; readonly additionalProperties: true; readonly description: "Database driver result from the update statement (not the full tag row)."; }; }; }; readonly ListTagsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "tags" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly tags: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TagListItem"; }; readonly description: "Tags in the workspace (id, name, and description)."; }; }; }; readonly FailureReason: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "title" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly description: "Failure reason identifier."; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace the failure reason belongs to."; }; readonly title: { readonly type: "string"; readonly description: "Failure reason title."; }; readonly description: { readonly type: "string"; readonly nullable: true; readonly description: "Optional failure reason description."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly verified_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly suspended_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly ListFailureReasonsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "reasons" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly reasons: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/FailureReason"; }; readonly description: "Failure reasons in the workspace."; }; }; }; readonly FailureReasonSuccess: { readonly type: "object"; readonly required: readonly [ "success", "reason" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly reason: { readonly $ref: "#/components/schemas/FailureReason"; }; }; }; readonly S3FileObject: { readonly type: "object"; readonly properties: { readonly key: { readonly type: "string"; readonly nullable: true; readonly description: "S3 object key."; }; readonly size: { readonly type: "integer"; readonly nullable: true; readonly description: "Object size in bytes."; }; readonly lastModified: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Last modified timestamp from S3."; }; readonly pin: { readonly type: "boolean"; readonly description: "True when S3 object user metadata `pin` is `\"true\"`."; }; }; }; readonly FileContentType: { readonly type: "string"; readonly enum: readonly [ "image/jpeg", "image/png", "image/webp", "application/pdf" ]; readonly description: "Allowed MIME type for general and comment file uploads."; }; readonly ProfileImageContentType: { readonly type: "string"; readonly enum: readonly [ "image/jpeg", "image/png" ]; readonly description: "Allowed MIME type declared for temporary profile or workspace picture uploads."; }; readonly UploadFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "contentType", "contentLength", "workspace" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe leaf file name (no path separators, not `.tmp`)."; readonly example: "invoice-2026.pdf"; }; readonly contentType: { readonly $ref: "#/components/schemas/FileContentType"; }; readonly contentLength: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 15728640; readonly description: "Exact file byte length. The S3 upload policy rejects a different size."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly folder: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 800; readonly description: "Optional nested folder path under `{workspace}/folders/` (e.g. `a/b`). Each segment is a safe name; max depth 10. The folder marker must already exist via `/files/create-folder`. Omitting uploads to the workspace root."; readonly example: "contracts/2026"; }; }; }; readonly ConfirmFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Original leaf file name used for `/files/upload` (without the `.tmp` suffix)."; readonly example: "invoice-2026.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly folder: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 800; readonly description: "Same optional nested folder path passed to `/files/upload`."; readonly example: "contracts/2026"; }; }; }; readonly ConfirmFileSuccess: { readonly type: "object"; readonly required: readonly [ "success", "key" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly key: { readonly type: "string"; readonly description: "Final S3 object key after promotion (`{workspace}/{filename}` or `{workspace}/folders/{folder}/{filename}`)."; readonly example: "550e8400-e29b-41d4-a716-446655440000/folders/contracts/2026/invoice-2026.pdf"; }; }; }; readonly PresignedUploadSuccess: { readonly type: "object"; readonly required: readonly [ "url", "fields", "key", "maxSize" ]; readonly properties: { readonly url: { readonly type: "string"; readonly description: "S3 presigned POST URL."; }; readonly fields: { readonly type: "object"; readonly additionalProperties: { readonly type: "string"; }; readonly description: "Form fields to include in the multipart upload POST."; }; readonly key: { readonly type: "string"; readonly description: "Temporary S3 object key (`.tmp` suffix). Call `/files/confirm` after upload. Root: `{workspace}/{filename}.tmp`. Folder: `{workspace}/folders/{folder}/{filename}.tmp`."; readonly example: "550e8400-e29b-41d4-a716-446655440000/folders/contracts/2026/invoice-2026.pdf.tmp"; }; readonly maxSize: { readonly type: "integer"; readonly description: "Exact requested upload size in bytes; it cannot exceed 15 MB."; readonly example: 15728640; }; }; }; readonly UploadToCommentRequest: { readonly type: "object"; readonly required: readonly [ "filename", "contentType", "contentLength", "workspace", "taskId", "commentId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "receipt.pdf"; }; readonly contentType: { readonly $ref: "#/components/schemas/FileContentType"; }; readonly contentLength: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 15728640; readonly description: "Exact file byte length. The S3 upload policy rejects a different size."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task the comment belongs to."; }; readonly commentId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Comment to attach the file to."; }; }; }; readonly UploadToCommentSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url", "fields", "key", "maxSize" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "S3 presigned POST URL."; }; readonly fields: { readonly type: "object"; readonly additionalProperties: { readonly type: "string"; }; readonly description: "Form fields to include in the multipart upload POST."; }; readonly key: { readonly type: "string"; readonly description: "Temporary S3 object key (`{workspace}_comments/{taskId}/{commentId}/{filename}.tmp`). Call `/files/confirm-comment-file` after upload."; readonly example: "550e8400-e29b-41d4-a716-446655440000_comments/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/ffffffff-1111-2222-3333-444444444444/receipt.pdf.tmp"; }; readonly maxSize: { readonly type: "integer"; readonly description: "Exact requested upload size in bytes; it cannot exceed 15 MB."; readonly example: 15728640; }; }; }; readonly ConfirmCommentFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "taskId", "commentId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Original file name used for `/files/upload-to-comment` (without the `.tmp` suffix)."; readonly example: "receipt.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task the comment belongs to."; }; readonly commentId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Comment the file is attached to."; }; }; }; readonly DeleteCommentFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "taskId", "commentId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "receipt.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task the comment belongs to."; }; readonly commentId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Comment the file is attached to."; }; }; }; readonly UploadToCustomerRequest: { readonly type: "object"; readonly required: readonly [ "filename", "contentType", "contentLength", "workspace", "customerId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "contract.pdf"; }; readonly contentType: { readonly $ref: "#/components/schemas/FileContentType"; }; readonly contentLength: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 15728640; readonly description: "Exact file byte length."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer the file is attached to."; }; }; }; readonly UploadToCustomerSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url", "fields", "key", "maxSize" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "S3 presigned POST URL."; }; readonly fields: { readonly type: "object"; readonly additionalProperties: { readonly type: "string"; }; readonly description: "Form fields to include in the multipart upload POST."; }; readonly key: { readonly type: "string"; readonly description: "Temporary S3 object key (`{workspace}_customers/{customerId}/{filename}.tmp`)."; }; readonly maxSize: { readonly type: "integer"; readonly description: "Exact requested upload size in bytes."; }; }; }; readonly ConfirmCustomerFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "customerId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Original file name used for `/files/upload-to-customer`."; readonly example: "contract.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer the file is attached to."; }; }; }; readonly DeleteCustomerFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "customerId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "contract.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer the file is attached to."; }; }; }; readonly UploadToServiceRequest: { readonly type: "object"; readonly required: readonly [ "filename", "contentType", "contentLength", "workspace", "serviceId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "floor-plan.pdf"; }; readonly contentType: { readonly $ref: "#/components/schemas/FileContentType"; }; readonly contentLength: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 15728640; readonly description: "Exact file byte length. The S3 upload policy rejects a different size."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service the file is attached to."; }; }; }; readonly UploadToServiceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url", "fields", "key", "maxSize" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "S3 presigned POST URL."; }; readonly fields: { readonly type: "object"; readonly additionalProperties: { readonly type: "string"; }; readonly description: "Form fields to include in the multipart upload POST."; }; readonly key: { readonly type: "string"; readonly description: "Temporary S3 object key (`{workspace}_services/{serviceId}/{filename}.tmp`). Call `/files/confirm-service-file` after upload."; readonly example: "550e8400-e29b-41d4-a716-446655440000_services/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/floor-plan.pdf.tmp"; }; readonly maxSize: { readonly type: "integer"; readonly description: "Exact requested upload size in bytes; it cannot exceed 15 MB."; readonly example: 15728640; }; }; }; readonly ConfirmServiceFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "serviceId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Original file name used for `/files/upload-to-service` (without the `.tmp` suffix)."; readonly example: "floor-plan.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service the file is attached to."; }; }; }; readonly DeleteServiceFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "serviceId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "floor-plan.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service the file is attached to."; }; }; }; readonly TaskCommentFile: { readonly type: "object"; readonly required: readonly [ "key", "filename", "commentId", "size", "downloadUrl" ]; readonly properties: { readonly key: { readonly type: "string"; readonly description: "Full S3 object key."; }; readonly filename: { readonly type: "string"; readonly description: "File name segment after the comment id prefix."; }; readonly commentId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Comment id parsed from the object key."; }; readonly size: { readonly type: "integer"; readonly description: "Object size in bytes."; }; readonly lastModified: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Last modified timestamp from S3 (ISO string)."; }; readonly downloadUrl: { readonly type: "string"; readonly description: "Presigned GET URL (5-minute expiry)."; }; }; }; readonly ListTaskCommentFilesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "files" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly files: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TaskCommentFile"; }; readonly description: "All non-prefix objects under `{workspace}_comments/{taskId}/`."; }; }; }; readonly ServiceFile: { readonly type: "object"; readonly required: readonly [ "key", "filename", "size", "downloadUrl" ]; readonly properties: { readonly key: { readonly type: "string"; readonly description: "Full S3 object key (`{workspace}_services/{serviceId}/{filename}`)."; }; readonly filename: { readonly type: "string"; readonly description: "File name under `{workspace}_services/{serviceId}/`."; }; readonly size: { readonly type: "integer"; readonly description: "Object size in bytes."; }; readonly lastModified: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Last modified timestamp from S3 (ISO string)."; }; readonly downloadUrl: { readonly type: "string"; readonly description: "Presigned GET URL (5-minute expiry)."; }; }; }; readonly ListServiceFilesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "files" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly files: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/ServiceFile"; }; readonly description: "All non-prefix, non-`.tmp` objects under `{workspace}_services/{serviceId}/`."; }; }; }; readonly CustomerFile: { readonly type: "object"; readonly required: readonly [ "key", "filename", "size", "downloadUrl" ]; readonly properties: { readonly key: { readonly type: "string"; readonly description: "Full S3 object key (`{workspace}_customers/{customerId}/{filename}`)."; }; readonly filename: { readonly type: "string"; readonly description: "File name under `{workspace}_customers/{customerId}/`."; }; readonly size: { readonly type: "integer"; readonly description: "Object size in bytes."; }; readonly lastModified: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Last modified timestamp from S3 (ISO string)."; }; readonly downloadUrl: { readonly type: "string"; readonly description: "Presigned GET URL (5-minute expiry)."; }; }; }; readonly ListCustomerFilesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "files" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly files: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CustomerFile"; }; readonly description: "All non-prefix, non-`.tmp` objects under `{workspace}_customers/{customerId}/`."; }; }; }; readonly UploadToFinanceRequest: { readonly type: "object"; readonly required: readonly [ "filename", "contentType", "contentLength", "workspace", "transactionId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "receipt.pdf"; }; readonly contentType: { readonly $ref: "#/components/schemas/FileContentType"; }; readonly contentLength: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 15728640; readonly description: "Exact file byte length."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly transactionId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Finance transaction the receipt is attached to."; }; }; }; readonly UploadToFinanceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url", "fields", "key", "maxSize" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "S3 presigned POST URL."; }; readonly fields: { readonly type: "object"; readonly additionalProperties: { readonly type: "string"; }; readonly description: "Form fields to include in the multipart upload POST."; }; readonly key: { readonly type: "string"; readonly description: "Temporary S3 object key (`{workspace}_finance/{transactionId}/{filename}.tmp`)."; }; readonly maxSize: { readonly type: "integer"; readonly description: "Exact requested upload size in bytes."; }; }; }; readonly ConfirmFinanceFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "transactionId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Original file name used for `/files/upload-to-finance`."; readonly example: "receipt.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly transactionId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Finance transaction the receipt is attached to."; }; }; }; readonly DeleteFinanceFileRequest: { readonly type: "object"; readonly required: readonly [ "filename", "workspace", "transactionId" ]; readonly properties: { readonly filename: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 200; readonly description: "Safe file name (no path separators, not `.tmp`)."; readonly example: "receipt.pdf"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly transactionId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Finance transaction the receipt is attached to."; }; }; }; readonly FinanceFile: { readonly type: "object"; readonly required: readonly [ "key", "filename", "size", "downloadUrl" ]; readonly properties: { readonly key: { readonly type: "string"; readonly description: "Full S3 object key (`{workspace}_finance/{transactionId}/{filename}`)."; }; readonly filename: { readonly type: "string"; readonly description: "File name under `{workspace}_finance/{transactionId}/`."; }; readonly size: { readonly type: "integer"; readonly description: "Object size in bytes."; }; readonly lastModified: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Last modified timestamp from S3 (ISO string)."; }; readonly downloadUrl: { readonly type: "string"; readonly description: "Presigned GET URL (5-minute expiry)."; }; }; }; readonly ListFinanceFilesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "files" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly files: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/FinanceFile"; }; readonly description: "All non-prefix, non-`.tmp` objects under `{workspace}_finance/{transactionId}/`."; }; }; }; readonly UploadProfilePictureRequest: { readonly type: "object"; readonly required: readonly [ "contentType" ]; readonly properties: { readonly contentType: { readonly $ref: "#/components/schemas/ProfileImageContentType"; }; }; }; readonly ConfirmProfilePictureSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "Presigned GET URL for `profiles/clients/{userId}/avatar.webp` (WebP response content type, 7-day expiry). Also saved on the user profile."; }; }; }; readonly DeleteProfilePictureSuccess: { readonly type: "object"; readonly required: readonly [ "success", "message" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly enum: readonly [ "Profile picture deleted successfully", "Profile picture already deleted" ]; }; }; }; readonly UploadWorkspacePictureRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "contentType" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly contentType: { readonly $ref: "#/components/schemas/ProfileImageContentType"; }; }; }; readonly WorkspacePictureWorkspaceRequest: { readonly type: "object"; readonly required: readonly [ "workspace" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; readonly ConfirmWorkspacePictureSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "Presigned GET URL for `profiles/workspaces/{workspace}/avatar.webp` (WebP response content type, 7-day expiry). Also saved on the workspace."; }; }; }; readonly DeleteWorkspacePictureSuccess: { readonly type: "object"; readonly required: readonly [ "success", "message" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly enum: readonly [ "Workspace picture deleted successfully", "Workspace picture already deleted" ]; }; }; }; readonly CreateFolderRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "name" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly name: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 800; readonly description: "Nested folder path under `{workspace}/folders/` (e.g. `contracts` or `contracts/2026`). Each segment is a safe name; max depth 10."; readonly example: "contracts/2026"; }; }; }; readonly WorkspaceRelativeFilePath: { readonly type: "string"; readonly minLength: 1; readonly maxLength: 800; readonly description: "Path after `{workspace}/`. Root file: `invoice.pdf`. Folder file: `folders/contracts/2026/invoice.pdf`. Not a full S3 key; no leading slash; not `.tmp`."; readonly example: "folders/contracts/2026/invoice-2026.pdf"; }; readonly PinFileRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "path", "pin" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier (used for access check)."; }; readonly path: { readonly $ref: "#/components/schemas/WorkspaceRelativeFilePath"; }; readonly pin: { readonly type: "boolean"; readonly description: "When true, sets object metadata `pin=true`; when false, sets `pin=false`."; }; }; }; readonly PinFileSuccess: { readonly type: "object"; readonly required: readonly [ "success", "message" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly enum: readonly [ "Pin enabled", "Pin disabled" ]; readonly description: "Result message reflecting the requested pin state."; }; }; }; readonly CreateFolderSuccess: { readonly type: "object"; readonly required: readonly [ "success", "message", "key" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly example: "Folder created successfully"; }; readonly key: { readonly type: "string"; readonly description: "S3 prefix key for the empty folder (`{workspace}/folders/{name}/`)."; readonly example: "550e8400-e29b-41d4-a716-446655440000/folders/contracts/2026/"; }; }; }; readonly DeleteFolderSuccess: { readonly type: "object"; readonly required: readonly [ "success", "message" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly example: "Folder deleted successfully"; }; }; }; readonly ListFilesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "files" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly files: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/S3FileObject"; }; readonly description: "Objects under the workspace prefix (up to 50)."; }; readonly nextToken: { readonly type: "string"; readonly nullable: true; readonly description: "S3 continuation token when more results exist."; }; }; }; readonly StorageUsageSuccess: { readonly type: "object"; readonly required: readonly [ "success", "usedBytes", "filesBytes", "commentsBytes", "customerBytes", "servicesBytes", "financeBytes", "limitBytes" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly usedBytes: { readonly type: "integer"; readonly description: "Total finalized storage in bytes (`filesBytes` + `commentsBytes` + `customerBytes` + `servicesBytes` + `financeBytes`). Excludes `.tmp` objects."; readonly example: 348320; }; readonly filesBytes: { readonly type: "integer"; readonly description: "Finalized workspace file storage under `{workspace}/` (root files and folders). Excludes `.tmp`."; readonly example: 248320; }; readonly commentsBytes: { readonly type: "integer"; readonly description: "Finalized comment attachment storage under `{workspace}_comments/`. Excludes `.tmp`."; readonly example: 100000; }; readonly customerBytes: { readonly type: "integer"; readonly description: "Finalized customer file storage under `{workspace}_customers/`. Excludes `.tmp`."; readonly example: 50000; }; readonly servicesBytes: { readonly type: "integer"; readonly description: "Finalized service file storage under `{workspace}_services/`. Excludes `.tmp`."; readonly example: 50000; }; readonly financeBytes: { readonly type: "integer"; readonly description: "Finalized finance receipt storage under `{workspace}_finance/`. Excludes `.tmp`."; readonly example: 25000; }; readonly limitBytes: { readonly type: "integer"; readonly nullable: true; readonly description: "Plan storage limit in bytes for this workspace, or null when no subscription/limit is configured. Applies to the combined total."; readonly example: 1073741824; }; }; }; readonly DownloadFileSuccess: { readonly type: "object"; readonly required: readonly [ "success", "url", "expiresIn" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly url: { readonly type: "string"; readonly description: "Presigned GET URL for the object."; }; readonly expiresIn: { readonly type: "integer"; readonly description: "URL lifetime in seconds."; readonly example: 300; }; }; }; readonly DeleteFileRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "path" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier (used for access check)."; }; readonly path: { readonly $ref: "#/components/schemas/WorkspaceRelativeFilePath"; }; }; }; readonly DeleteFileSuccess: { readonly type: "object"; readonly required: readonly [ "success", "message", "key" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly example: "File deleted successfully"; }; readonly key: { readonly type: "string"; readonly description: "S3 object key that was deleted."; }; }; }; readonly DeleteFileFailure: { readonly type: "object"; readonly required: readonly [ "success", "message", "key" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly message: { readonly type: "string"; readonly enum: readonly [ "File not found", "Delete failed" ]; }; readonly key: { readonly type: "string"; readonly description: "S3 object key that was requested for deletion."; }; }; }; readonly MoveFileRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "from", "to" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly from: { readonly $ref: "#/components/schemas/WorkspaceRelativeFilePath"; }; readonly to: { readonly $ref: "#/components/schemas/WorkspaceRelativeFilePath"; }; }; }; readonly MoveFileSuccess: { readonly type: "object"; readonly required: readonly [ "success", "from", "to" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly from: { readonly type: "string"; readonly description: "Source full S3 object key."; }; readonly to: { readonly type: "string"; readonly description: "Destination full S3 object key."; }; }; }; readonly MatrixLoginResponse: { readonly type: "object"; readonly description: "Raw Matrix login payload returned directly (not wrapped). Existing tenants are looked up by JWT `userId` + workspace. On first login, Synapse `/login` response is returned and the access token is persisted on the tenant. On subsequent calls, a cached payload is synthesized from the stored token with `device_id` `MESTRA_{tenantId}` and `well_known.m.homeserver.base_url`. Workspace owners use Matrix localpart `owner_{emailLocalPart}-{workspaceId}`; other collaborators use `{emailLocalPart}-{workspaceId}`."; readonly properties: { readonly access_token: { readonly type: "string"; readonly description: "Bearer token for Matrix API calls."; }; readonly device_id: { readonly type: "string"; readonly description: "Stable device id (`MESTRA_{tenantId}`) used for login and cached responses."; }; readonly user_id: { readonly type: "string"; readonly description: "Fully qualified Matrix user id. Owners: `@owner_{localPart}-{workspace}:aio.mestra.chat`. Others: `@{localPart}-{workspace}:aio.mestra.chat`."; readonly example: "@owner_jane-550e8400-e29b-41d4-a716-446655440000:aio.mestra.chat"; }; readonly home_server: { readonly type: "string"; readonly description: "Homeserver domain (e.g. aio.mestra.chat)."; }; readonly well_known: { readonly type: "object"; readonly description: "Present on cached-token responses."; readonly properties: { readonly "m.homeserver": { readonly type: "object"; readonly properties: { readonly base_url: { readonly type: "string"; readonly example: "https://aio.mestra.chat/"; }; }; }; }; }; }; readonly additionalProperties: true; }; readonly ChatTenantCollaborator: { readonly type: "object"; readonly required: readonly [ "id", "username", "email", "role" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly description: "Chat tenant identifier."; }; readonly username: { readonly type: "string"; readonly description: "Fully qualified Matrix user ID. Owners use an `owner_`-prefixed localpart."; readonly example: "@owner_jane-550e8400-e29b-41d4-a716-446655440000:aio.mestra.chat"; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; readonly email: { readonly type: "string"; readonly format: "email"; }; readonly role: { readonly type: "string"; readonly description: "Collaborator role in the workspace."; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; }; }; readonly ListChatCollaboratorsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "collaborators" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly collaborators: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/ChatTenantCollaborator"; }; readonly description: "Chat tenants joined with collaborator and user profile fields."; }; }; }; readonly ChatStartFailure: { readonly type: "object"; readonly required: readonly [ "success", "error" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly error: { readonly type: "string"; readonly example: "Failed to create Matrix user"; }; readonly details: { readonly type: "string"; readonly description: "Raw error body from the Synapse admin API when user provisioning fails."; }; }; }; readonly UpdateCustomerSuccess: { readonly type: "object"; readonly required: readonly [ "success", "customer" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly customer: { readonly $ref: "#/components/schemas/Customer"; }; }; }; readonly Template: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "title", "content", "created_by" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly description: "Template identifier."; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace the template belongs to."; }; readonly title: { readonly type: "string"; readonly description: "Template title."; }; readonly content: { readonly type: "string"; readonly description: "Template body text."; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; readonly description: "User who created the template."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly TemplateListItem: { readonly type: "object"; readonly required: readonly [ "id", "title", "content", "created_by" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly description: "Template identifier."; }; readonly title: { readonly type: "string"; readonly description: "Template title."; }; readonly content: { readonly type: "string"; readonly description: "Template body text."; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; readonly description: "User who created the template."; }; }; readonly description: "Shape returned by list-by-workspace."; }; readonly CreateTemplateSuccess: { readonly type: "object"; readonly required: readonly [ "success", "template" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly template: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Template"; }; readonly description: "Created template row(s) from insert (Drizzle returning)."; }; }; }; readonly ListTemplatesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "templates" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly templates: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TemplateListItem"; }; }; }; }; readonly TaskCollaborator: { readonly type: "object"; readonly required: readonly [ "id" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; }; }; readonly ListTasksSuccess: { readonly type: "object"; readonly required: readonly [ "success", "tasks", "collaborators" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly tasks: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Task"; }; }; readonly collaborators: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TaskCollaborator"; }; readonly description: "List of collaborators in the workspace."; }; }; }; readonly TaskCreator: { readonly type: "object"; readonly required: readonly [ "first_name", "last_name", "profilePicture" ]; readonly properties: { readonly first_name: { readonly type: "string"; readonly nullable: true; }; readonly last_name: { readonly type: "string"; readonly nullable: true; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; }; }; readonly GetTaskSuccess: { readonly type: "object"; readonly required: readonly [ "success", "task", "collaborators" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly task: { readonly $ref: "#/components/schemas/Task"; }; readonly collaborators: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TaskCollaborator"; }; readonly description: "List of collaborators in the workspace."; }; readonly customer: { readonly nullable: true; readonly description: "Customer associated with the task, if any. Real-estate workspaces return the customer_real_estates lead."; readonly allOf: readonly [ { readonly $ref: "#/components/schemas/Customer"; } ]; }; readonly failureReasons: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/FailureReason"; }; readonly description: "Failure reasons linked to the task."; }; }; }; readonly Comment: { readonly type: "object"; readonly required: readonly [ "id", "taskId", "workspaceId", "content", "created_by" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly content: { readonly type: "string"; readonly maxLength: 512; }; readonly reply: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Identifier of the comment this one is replying to."; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly verified_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly suspended_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly CreateCommentSuccess: { readonly type: "object"; readonly required: readonly [ "success" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; }; }; readonly ListCommentsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "comments" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly comments: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Comment"; }; }; }; }; readonly AssigneeCollaborator: { readonly type: "object"; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; }; }; readonly Assignee: { readonly type: "object"; readonly properties: { readonly assigneeId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; }; readonly startDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly endDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly description: { readonly type: "string"; readonly nullable: true; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; }; }; readonly ListAssigneesByWorkspaceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "collaborators" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly collaborators: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/AssigneeCollaborator"; }; }; }; }; readonly ListAssigneesByTaskSuccess: { readonly type: "object"; readonly required: readonly [ "success", "assignees" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly assignees: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Assignee"; }; }; }; }; readonly CreateAssigneeSuccess: { readonly type: "object"; readonly required: readonly [ "success", "assignee" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly assignee: { readonly $ref: "#/components/schemas/Assignee"; }; }; }; readonly UpdateAssigneeSuccess: { readonly type: "object"; readonly required: readonly [ "success", "result" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly result: { readonly $ref: "#/components/schemas/Assignee"; }; }; }; readonly CreatedByUser: { readonly type: "object"; readonly nullable: true; readonly description: "User who created the record. Present on get/list when `created_by` is set; null when unset or the user is missing."; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; }; readonly firstName: { readonly type: "string"; readonly nullable: true; }; readonly lastName: { readonly type: "string"; readonly nullable: true; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; }; }; }; readonly Customer: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "name" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "User id of the creator. Set automatically from the bearer token on create."; }; readonly createdBy: { readonly $ref: "#/components/schemas/CreatedByUser"; }; readonly type: { readonly type: "string"; readonly nullable: true; readonly enum: readonly [ "buyer", "seller", "tenant", "landlord", "investor", "agent" ]; }; readonly name: { readonly type: "string"; }; readonly companyName: { readonly type: "string"; readonly nullable: true; }; readonly phone: { readonly type: "string"; readonly nullable: true; readonly description: "E.164 phone number."; }; readonly telegram: { readonly type: "string"; readonly nullable: true; }; readonly whatsapp: { readonly type: "string"; readonly nullable: true; }; readonly instagram: { readonly type: "string"; readonly nullable: true; }; readonly vk: { readonly type: "string"; readonly nullable: true; }; readonly igSynapseId: { readonly type: "string"; readonly nullable: true; readonly description: "Matrix (Synapse) user identifier for Instagram chat."; }; readonly waSynapseId: { readonly type: "string"; readonly nullable: true; readonly description: "Matrix (Synapse) user identifier for WhatsApp chat."; }; readonly tgSynapseId: { readonly type: "string"; readonly nullable: true; readonly description: "Matrix (Synapse) user identifier for Telegram chat."; }; readonly vkSynapseId: { readonly type: "string"; readonly nullable: true; readonly description: "Matrix (Synapse) user identifier for VK chat."; }; readonly email: { readonly type: "string"; readonly format: "email"; readonly nullable: true; }; readonly leadSource: { readonly type: "string"; readonly nullable: true; readonly enum: readonly [ "cian", "avito", "vk", "instagram", "whatsapp", "telegram", "max", "yandex", "website", "referral", "walk_in" ]; }; readonly budgetMin: { readonly type: "integer"; readonly nullable: true; }; readonly budgetMax: { readonly type: "integer"; readonly nullable: true; }; readonly fullPayment: { readonly type: "boolean"; readonly nullable: true; }; readonly mortgagePayment: { readonly type: "boolean"; readonly nullable: true; }; readonly installmentPayment: { readonly type: "boolean"; readonly nullable: true; }; readonly fullPaymentAmount: { readonly type: "integer"; readonly nullable: true; }; readonly mortgagePaymentAmount: { readonly type: "integer"; readonly nullable: true; }; readonly installmentPaymentAmount: { readonly type: "integer"; readonly nullable: true; }; readonly minArea: { readonly type: "integer"; readonly nullable: true; }; readonly maxArea: { readonly type: "integer"; readonly nullable: true; }; readonly roomsCount: { readonly type: "integer"; readonly nullable: true; }; readonly preferredDistricts: { readonly type: "array"; readonly nullable: true; readonly items: { readonly type: "string"; }; }; readonly propertyType: { readonly type: "string"; readonly nullable: true; }; readonly housingType: { readonly type: "string"; readonly nullable: true; readonly description: "Housing type preference."; }; readonly housingTypeNew: { readonly type: "boolean"; readonly nullable: true; readonly description: "Whether the customer is interested in newly built housing."; }; readonly housingTypeResale: { readonly type: "boolean"; readonly nullable: true; readonly description: "Whether the customer is interested in resale housing."; }; readonly commercialType: { readonly type: "string"; readonly nullable: true; }; readonly landType: { readonly type: "string"; readonly nullable: true; }; readonly maxMetroDistance: { readonly type: "integer"; readonly nullable: true; }; readonly dealStatus: { readonly type: "string"; readonly nullable: true; readonly enum: readonly [ "just_browsing", "serious_buyer", "mortgage_approved", "signed_contract", "closed_deal" ]; }; readonly preferredPaymentMethod: { readonly type: "string"; readonly nullable: true; readonly enum: readonly [ "full_payment", "mortgage", "installment" ]; }; readonly childrenCount: { readonly type: "integer"; readonly nullable: true; }; readonly hasPets: { readonly type: "boolean"; readonly nullable: true; }; readonly carsCount: { readonly type: "integer"; readonly nullable: true; }; readonly birthDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly notes: { readonly type: "string"; readonly nullable: true; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly verified_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly suspended_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly tags: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TagListItem"; }; readonly description: "Tags assigned to the customer (id, name, description)."; }; }; }; readonly CreateCustomerSuccess: { readonly type: "object"; readonly required: readonly [ "success", "customer" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly customer: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Customer"; }; readonly description: "Created customer(s) from insert returning."; }; }; }; readonly ListCustomersSuccess: { readonly type: "object"; readonly required: readonly [ "success", "customers" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly customers: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Customer"; }; }; }; }; readonly GetCustomerSuccess: { readonly type: "object"; readonly required: readonly [ "success", "customer" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly customer: { readonly $ref: "#/components/schemas/Customer"; }; }; }; readonly Service: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "title" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "User id of the creator. Set automatically from the bearer token on create."; }; readonly createdBy: { readonly $ref: "#/components/schemas/CreatedByUser"; }; readonly title: { readonly type: "string"; }; readonly active: { readonly type: "boolean"; readonly nullable: true; readonly description: "Whether the listing is active. Defaults to true."; }; readonly type: { readonly type: "string"; readonly nullable: true; }; readonly currency: { readonly type: "string"; readonly nullable: true; readonly enum: readonly [ "USD", "EUR", "RUB" ]; }; readonly description: { readonly type: "string"; readonly nullable: true; }; readonly price: { readonly type: "integer"; readonly nullable: true; }; readonly propertyType: { readonly type: "string"; readonly nullable: true; }; readonly propertyStatus: { readonly type: "string"; readonly nullable: true; }; readonly commercialType: { readonly type: "string"; readonly nullable: true; }; readonly commercialClass: { readonly type: "string"; readonly nullable: true; }; readonly landType: { readonly type: "string"; readonly nullable: true; }; readonly ownershipType: { readonly type: "string"; readonly nullable: true; }; readonly loadingDockAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly waterAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly electricityAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly gasAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly sewageAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly internetAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly elevaorAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly seprateEntrance: { readonly type: "boolean"; readonly nullable: true; }; readonly furnishedType: { readonly type: "string"; readonly nullable: true; }; readonly parkingType: { readonly type: "string"; readonly nullable: true; }; readonly balconyAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly loggiaAccess: { readonly type: "boolean"; readonly nullable: true; }; readonly otherFeatures: { readonly type: "string"; readonly nullable: true; }; readonly fullPayment: { readonly type: "boolean"; readonly nullable: true; }; readonly mortgagePayment: { readonly type: "boolean"; readonly nullable: true; }; readonly installmentPayment: { readonly type: "boolean"; readonly nullable: true; }; readonly fullPaymentAmount: { readonly type: "integer"; readonly nullable: true; }; readonly mortgagePaymentAmount: { readonly type: "integer"; readonly nullable: true; }; readonly installmentPaymentAmount: { readonly type: "integer"; readonly nullable: true; }; readonly pricePerSquareMeter: { readonly type: "integer"; readonly nullable: true; }; readonly alternativeEURCurrency: { readonly type: "boolean"; readonly nullable: true; }; readonly alternativeRUBCurrency: { readonly type: "boolean"; readonly nullable: true; }; readonly alternativeUSDCurrency: { readonly type: "boolean"; readonly nullable: true; }; readonly estimatedDeliveryDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly roomsCount: { readonly type: "integer"; readonly nullable: true; }; readonly bathroomsCount: { readonly type: "integer"; readonly nullable: true; }; readonly bedroomsCount: { readonly type: "integer"; readonly nullable: true; }; readonly totalArea: { readonly type: "integer"; readonly nullable: true; }; readonly livingArea: { readonly type: "integer"; readonly nullable: true; }; readonly ceilingHeight: { readonly type: "integer"; readonly nullable: true; }; readonly floor: { readonly type: "integer"; readonly nullable: true; }; readonly totalFloors: { readonly type: "integer"; readonly nullable: true; }; readonly yearBuilt: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly renovation: { readonly type: "string"; readonly nullable: true; }; readonly developerName: { readonly type: "string"; readonly nullable: true; }; readonly city: { readonly type: "string"; readonly nullable: true; }; readonly district: { readonly type: "string"; readonly nullable: true; }; readonly nearestMetroStation: { readonly type: "string"; readonly nullable: true; }; readonly fullAddress: { readonly type: "string"; readonly nullable: true; }; readonly latitude: { readonly type: "string"; readonly nullable: true; readonly description: "Decimal degrees as a numeric string."; }; readonly longitude: { readonly type: "string"; readonly nullable: true; readonly description: "Decimal degrees as a numeric string."; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly tags: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TagListItem"; }; readonly description: "Tags assigned to the service (id, name, description)."; }; }; }; readonly CreateServiceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "service" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly service: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Service"; }; readonly description: "Created service(s) from insert returning."; }; }; }; readonly UpdateServiceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "service" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly service: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Service"; }; readonly description: "Updated service(s) from update returning."; }; }; }; readonly ListServicesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "services" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly services: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/Service"; }; }; }; }; readonly GetServiceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "service" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly service: { readonly $ref: "#/components/schemas/Service"; }; }; }; readonly Billing: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "country", "companyName", "inn", "kpp", "bankBranch", "bankAccountNumber", "bankBik", "bankKc", "vat", "vatRate" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly country: { readonly type: "string"; readonly enum: readonly [ "RU" ]; }; readonly companyName: { readonly type: "string"; }; readonly inn: { readonly type: "string"; }; readonly kpp: { readonly type: "string"; }; readonly bankBranch: { readonly type: "string"; }; readonly bankAccountNumber: { readonly type: "string"; }; readonly bankBik: { readonly type: "string"; }; readonly bankKc: { readonly type: "string"; }; readonly vat: { readonly type: "boolean"; readonly description: "Whether VAT applies."; }; readonly vatRate: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; readonly description: "VAT rate (0-100) when vat is true."; }; readonly active: { readonly type: "boolean"; readonly nullable: true; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly CInvoice: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "invoiceId", "serviceId", "SellerFinanceAccountId", "customerId", "date", "language", "currency", "vatOption", "status", "unitName", "unitPrice", "unitQuantity", "created_by" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly invoiceId: { readonly type: "string"; readonly description: "User-facing invoice number."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate service identifier (service_real_estates)."; }; readonly SellerFinanceAccountId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Seller finance account identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate customer identifier (customer_real_estates)."; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; readonly language: { readonly type: "string"; readonly enum: readonly [ "ru", "en" ]; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "RUB", "USD", "EUR" ]; }; readonly vatOption: { readonly type: "string"; readonly enum: readonly [ "vat_included", "vat_excluded" ]; }; readonly vatRate: { readonly type: "integer"; readonly nullable: true; readonly minimum: 0; readonly maximum: 100; }; readonly status: { readonly type: "string"; readonly enum: readonly [ "pending", "paid", "canceled", "refunded" ]; }; readonly paidAt: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; readonly description: "Server-set timestamp when the invoice was marked paid."; }; readonly buyerInn: { readonly type: "string"; readonly nullable: true; }; readonly buyerKpp: { readonly type: "string"; readonly nullable: true; }; readonly unitName: { readonly type: "string"; }; readonly unitPrice: { readonly type: "integer"; readonly minimum: 0; }; readonly unitQuantity: { readonly type: "integer"; readonly minimum: 1; }; readonly notes: { readonly type: "string"; readonly nullable: true; }; readonly discount: { readonly type: "integer"; readonly nullable: true; readonly minimum: 0; }; readonly fullPayment: { readonly type: "boolean"; readonly nullable: true; }; readonly installment: { readonly type: "boolean"; readonly nullable: true; }; readonly subscription: { readonly type: "boolean"; readonly nullable: true; }; readonly subscriptionStartDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly subscriptionEndDate: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly paymentMethod: { readonly type: "string"; readonly nullable: true; readonly maxLength: 50; readonly description: "How the invoice is paid."; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly CreateCInvoiceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "cinvoice" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly cinvoice: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CInvoice"; }; readonly description: "Created invoice(s) from insert returning."; }; }; }; readonly ListCInvoicesSuccess: { readonly type: "object"; readonly required: readonly [ "success", "cinvoices" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly cinvoices: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CInvoice"; }; }; }; }; readonly CInvoiceFinanceAccountOption: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "order", "name", "cardColor", "currency", "active", "created_at" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly order: { readonly type: "integer"; readonly minimum: 1; readonly description: "1-based display order."; }; readonly name: { readonly type: "string"; }; readonly cardColor: { readonly type: "string"; readonly example: "#A1B2C3"; readonly description: "Normalized 6-digit hex color including #."; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "ruble", "dollar", "euro" ]; }; readonly country: { readonly type: "string"; readonly nullable: true; }; readonly companyName: { readonly type: "string"; readonly nullable: true; }; readonly companyAccountNumber: { readonly type: "string"; readonly nullable: true; }; readonly companyInn: { readonly type: "string"; readonly nullable: true; }; readonly companyKpp: { readonly type: "string"; readonly nullable: true; }; readonly companyOgrn: { readonly type: "string"; readonly nullable: true; }; readonly bankName: { readonly type: "string"; readonly nullable: true; }; readonly bankBik: { readonly type: "string"; readonly nullable: true; }; readonly bankKc: { readonly type: "string"; readonly nullable: true; }; readonly bankInn: { readonly type: "string"; readonly nullable: true; }; readonly bankKpp: { readonly type: "string"; readonly nullable: true; }; readonly vatRate: { readonly type: "integer"; readonly nullable: true; readonly minimum: 0; readonly maximum: 100; }; readonly active: { readonly type: "boolean"; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly ListCInvoiceFinanceAccountsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "accounts" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly accounts: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CInvoiceFinanceAccountOption"; }; }; }; }; readonly UpdateCInvoiceSuccess: { readonly type: "object"; readonly required: readonly [ "success", "cinvoice" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly cinvoice: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CInvoice"; }; }; }; }; readonly GrowthMetric: { readonly type: "object"; readonly required: readonly [ "previousValue", "growthPercentage", "direction" ]; readonly properties: { readonly previousValue: { readonly type: "number"; readonly description: "Metric value in the immediately previous period of the same duration."; }; readonly growthPercentage: { readonly type: "number"; readonly nullable: true; readonly description: "((current \u2212 previous) / previous) \u00D7 100, rounded to two decimal places. Zero when both values are 0. Null when previous is 0 and current is not, to avoid division by zero."; }; readonly direction: { readonly type: "string"; readonly enum: readonly [ "positive", "negative", "none" ]; readonly description: "positive when current > previous, negative when current < previous, none when they are equal."; }; }; }; readonly RevenueTotalGrowth: { readonly type: "object"; readonly required: readonly [ "amountMinor", "invoiceCount" ]; readonly properties: { readonly amountMinor: { readonly $ref: "#/components/schemas/GrowthMetric"; }; readonly invoiceCount: { readonly $ref: "#/components/schemas/GrowthMetric"; }; }; }; readonly RevenueTotal: { readonly type: "object"; readonly required: readonly [ "currency", "amountMinor", "invoiceCount", "growth" ]; readonly properties: { readonly currency: { readonly type: "string"; readonly description: "Invoice currency."; }; readonly amountMinor: { readonly type: "integer"; readonly description: "Revenue in the currency's minor units after discount, excluding VAT."; }; readonly invoiceCount: { readonly type: "integer"; readonly description: "Number of paid invoices included in the total."; }; readonly growth: { readonly allOf: readonly [ { readonly $ref: "#/components/schemas/RevenueTotalGrowth"; } ]; readonly nullable: true; readonly description: "Comparison against the previous period. Null when from or to is omitted, so no previous window can be derived."; }; }; }; readonly PaidRevenueAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "previousPeriod", "totals" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly previousPeriod: { readonly type: "object"; readonly nullable: true; readonly required: readonly [ "from", "to" ]; readonly description: "The immediately previous window of the same duration as period, adjacent and non-overlapping (from inclusive, to exclusive). Null when from or to is omitted."; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; }; readonly to: { readonly type: "string"; readonly format: "date-time"; }; }; }; readonly totals: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/RevenueTotal"; }; readonly description: "Totals grouped by invoice currency, including currencies that only appeared in the previous period (with current values of 0). Empty when neither period has paid invoices."; }; }; }; readonly LeadSourceTotal: { readonly type: "object"; readonly required: readonly [ "leadSource", "leadCount" ]; readonly properties: { readonly leadSource: { readonly type: "string"; readonly enum: readonly [ "cian", "avito", "vk", "instagram", "whatsapp", "telegram", "max", "yandex", "website", "referral", "walk_in", "unattributed" ]; readonly description: "Lead acquisition source, or unattributed when no source was recorded."; }; readonly leadCount: { readonly type: "integer"; readonly description: "Number of leads from this source."; }; }; }; readonly LeadSourceAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "sources" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly sources: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/LeadSourceTotal"; }; readonly description: "Lead totals grouped by acquisition source. Empty when no leads match the period."; }; }; }; readonly ChannelPerformanceTotal: { readonly type: "object"; readonly required: readonly [ "leadSource", "currency", "paidAmountMinor", "paidInvoiceCount", "pendingAmountMinor", "pendingInvoiceCount" ]; readonly properties: { readonly leadSource: { readonly type: "string"; readonly enum: readonly [ "cian", "avito", "vk", "instagram", "whatsapp", "telegram", "max", "yandex", "website", "referral", "walk_in", "unattributed" ]; readonly description: "Lead acquisition source, or unattributed when no source was recorded."; }; readonly currency: { readonly type: "string"; readonly description: "Invoice currency."; }; readonly paidAmountMinor: { readonly type: "integer"; readonly description: "Paid invoice revenue in minor units after discount, excluding VAT."; }; readonly paidInvoiceCount: { readonly type: "integer"; readonly description: "Number of paid invoices included in the total."; }; readonly pendingAmountMinor: { readonly type: "integer"; readonly description: "Pending invoice value in minor units after discount, excluding VAT."; }; readonly pendingInvoiceCount: { readonly type: "integer"; readonly description: "Number of pending invoices included in the total."; }; }; }; readonly ChannelPerformanceAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "channels" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly channels: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/ChannelPerformanceTotal"; }; readonly description: "Revenue grouped by lead source and invoice currency. Empty when no paid or pending invoices match the period."; }; }; }; readonly ConversionRateAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "paidInvoiceCount", "customerCount", "conversionRate" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly paidInvoiceCount: { readonly type: "integer"; readonly description: "Paid CInvoices included in the period."; }; readonly customerCount: { readonly type: "integer"; readonly description: "Non-deleted real-estate customers created in the period."; }; readonly conversionRate: { readonly type: "number"; readonly description: "Paid CInvoices divided by real-estate customers, expressed as a percentage. Zero when no customers match the period."; }; }; }; readonly EmployeeConversionRate: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "userId", "firstName", "lastName", "profilePicture", "status", "assignedCustomerCount", "convertedCustomerCount", "conversionRate" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace collaborator identifier."; }; readonly userId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Underlying user identifier."; }; readonly firstName: { readonly type: "string"; readonly nullable: true; readonly description: "Collaborator first name."; }; readonly lastName: { readonly type: "string"; readonly nullable: true; readonly description: "Collaborator last name."; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; readonly description: "Collaborator profile image URL."; }; readonly status: { readonly type: "string"; readonly description: "Collaborator status, including active or inactive states."; }; readonly assignedCustomerCount: { readonly type: "integer"; readonly description: "Distinct non-deleted customers linked to this collaborator's qualifying tasks."; }; readonly convertedCustomerCount: { readonly type: "integer"; readonly description: "Assigned customers with at least one qualifying paid CInvoice."; }; readonly conversionRate: { readonly type: "number"; readonly description: "Converted customers divided by assigned customers, expressed as a percentage."; }; }; }; readonly EmployeeConversionRateAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "employees" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly employees: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/EmployeeConversionRate"; }; readonly description: "Active and inactive collaborators with at least one task linked to a customer."; }; }; }; readonly WorkloadDistributionEmployee: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "userId", "firstName", "lastName", "profilePicture", "status", "taskCount" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace collaborator identifier."; }; readonly userId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Underlying user identifier."; }; readonly firstName: { readonly type: "string"; readonly nullable: true; readonly description: "Collaborator first name."; }; readonly lastName: { readonly type: "string"; readonly nullable: true; readonly description: "Collaborator last name."; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; readonly description: "Collaborator profile image URL."; }; readonly status: { readonly type: "string"; readonly description: "Collaborator status, including active or inactive states."; }; readonly taskCount: { readonly type: "integer"; readonly description: "Distinct tasks assigned to this collaborator in the reporting period."; }; }; }; readonly WorkloadDistributionAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "employees" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly employees: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/WorkloadDistributionEmployee"; }; readonly description: "All workspace collaborators, ordered by assigned task count descending."; }; }; }; readonly ForecastRevenueTotal: { readonly type: "object"; readonly required: readonly [ "currency", "pendingRevenueMinor", "pendingInvoiceCount", "averageDealSizeMinor", "projectedPipelineMinor", "forecastRevenueMinor" ]; readonly properties: { readonly currency: { readonly type: "string"; readonly description: "Invoice currency. Forecasts are not combined across currencies."; }; readonly pendingRevenueMinor: { readonly type: "integer"; readonly description: "Pending invoice value due in the period, after discount and excluding VAT."; }; readonly pendingInvoiceCount: { readonly type: "integer"; readonly description: "Number of pending invoices due in the period."; }; readonly averageDealSizeMinor: { readonly type: "number"; readonly description: "Average paid invoice value in the period, after discount and excluding VAT."; }; readonly projectedPipelineMinor: { readonly type: "integer"; readonly description: "Projected revenue: period leads \u00D7 conversion rate \u00D7 average deal size."; }; readonly forecastRevenueMinor: { readonly type: "integer"; readonly description: "Pending revenue plus projected pipeline revenue."; }; }; }; readonly ForecastRevenueAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "leadCount", "averageDailyLeads", "paidInvoiceCount", "conversionRate", "forecasts" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly leadCount: { readonly type: "integer"; readonly description: "Non-deleted real-estate leads created in the period."; }; readonly averageDailyLeads: { readonly type: "number"; readonly nullable: true; readonly description: "Lead count divided by the reporting period duration in days; null without both period bounds."; }; readonly paidInvoiceCount: { readonly type: "integer"; readonly description: "Paid CInvoices included in the period."; }; readonly conversionRate: { readonly type: "number"; readonly description: "Paid CInvoices divided by real-estate leads, expressed as a percentage."; }; readonly forecasts: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/ForecastRevenueTotal"; }; readonly description: "Forecast totals grouped by currency. Empty when the period has neither pending nor paid invoices."; }; }; }; readonly TaskPhaseFunnelItem: { readonly type: "object"; readonly required: readonly [ "phaseId", "phaseName", "sortOrder", "taskCount", "visitCount", "averageDurationDays", "averageCurrentDurationDays" ]; readonly properties: { readonly phaseId: { readonly type: "string"; readonly format: "uuid"; }; readonly phaseName: { readonly type: "string"; readonly description: "Workspace-defined task phase name."; }; readonly sortOrder: { readonly type: "integer"; readonly description: "Phase position in the workspace funnel."; }; readonly taskCount: { readonly type: "integer"; readonly description: "Tasks currently in this phase, optionally limited to tasks created in the reporting period."; }; readonly visitCount: { readonly type: "integer"; readonly description: "Recorded entries into this phase in the reporting period."; }; readonly averageDurationDays: { readonly type: "number"; readonly nullable: true; readonly description: "Average elapsed days for recorded phase visits. Active visits end at now, or at the to timestamp when supplied."; }; readonly averageCurrentDurationDays: { readonly type: "number"; readonly nullable: true; readonly description: "Average days that tasks currently in this phase have been there. Null when no tracked task is currently in the phase."; }; }; }; readonly TaskPhaseFunnelAnalysisSuccess: { readonly type: "object"; readonly required: readonly [ "success", "workspaceId", "category", "period", "phases" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly category: { readonly type: "string"; readonly description: "Workspace category."; }; readonly period: { readonly type: "object"; readonly required: readonly [ "from", "to" ]; readonly properties: { readonly from: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly to: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly phases: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/TaskPhaseFunnelItem"; }; }; }; }; readonly CHistory: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "customerId", "serviceId", "date", "created_by" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate customer identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate service identifier."; }; readonly notes: { readonly type: "string"; readonly nullable: true; readonly maxLength: 256; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; readonly created_by: { readonly type: "string"; readonly format: "uuid"; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly deleted_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly CreateCHistorySuccess: { readonly type: "object"; readonly required: readonly [ "success", "history" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly history: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CHistory"; }; readonly description: "Created history entry returned from the insert."; }; }; }; readonly ListCHistorySuccess: { readonly type: "object"; readonly required: readonly [ "success", "history" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly history: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CHistory"; }; }; }; }; readonly UpdateCHistorySuccess: { readonly type: "object"; readonly required: readonly [ "success", "history" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly history: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/CHistory"; }; }; }; }; readonly BillingInterval: { readonly type: "string"; readonly enum: readonly [ "monthly", "yearly" ]; readonly description: "Yearly prices represent 10 monthly payments (two months free)."; }; readonly BillingCycles: { readonly type: "integer"; readonly minimum: 1; readonly description: "Number of prepaid billing units (integer \u2265 1). Interval-specific caps are enforced by billing: monthly 1\u201311 months; yearly exactly 1 year."; }; readonly WorkspacePlan: { readonly type: "object"; readonly required: readonly [ "id", "code", "name", "kind", "sortOrder", "prices", "limits" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly code: { readonly type: "string"; readonly example: "economy"; }; readonly name: { readonly type: "string"; readonly example: "Economy"; }; readonly kind: { readonly type: "string"; readonly enum: readonly [ "trial", "public", "enterprise" ]; }; readonly sortOrder: { readonly type: "integer"; }; readonly prices: { readonly type: "object"; readonly additionalProperties: { readonly type: "integer"; }; readonly description: "Price per seat in kopecks, keyed by billing interval. Free trial has no prices."; readonly example: { readonly monthly: 39000; readonly yearly: 390000; }; }; readonly limits: { readonly type: "object"; readonly additionalProperties: { readonly type: "integer"; readonly format: "int64"; }; readonly description: "Included limits keyed by tasks, comments, customers, services, and storage_bytes."; }; }; }; readonly WorkspaceSubscription: { readonly type: "object"; readonly required: readonly [ "id", "status", "seats", "planId", "planCode", "planName" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly status: { readonly type: "string"; readonly enum: readonly [ "trialing", "pending", "active", "past_due", "frozen", "canceled" ]; }; readonly seats: { readonly type: "integer"; }; readonly interval: { readonly $ref: "#/components/schemas/BillingInterval"; readonly nullable: true; }; readonly billingCycles: { readonly $ref: "#/components/schemas/BillingCycles"; }; readonly trialEndsAt: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly periodEnd: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; readonly planId: { readonly type: "string"; readonly format: "uuid"; }; readonly planCode: { readonly type: "string"; }; readonly planName: { readonly type: "string"; }; }; }; readonly BillingHistoryInvoice: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "workspaceName", "seats", "planId", "planCode", "planName", "interval", "billingCycles", "createdAt", "subtotalKopecks", "discountKopecks", "amountKopecks", "currency", "status" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceName: { readonly type: "string"; }; readonly seats: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly planId: { readonly type: "string"; readonly format: "uuid"; }; readonly planCode: { readonly type: "string"; }; readonly planName: { readonly type: "string"; }; readonly interval: { readonly $ref: "#/components/schemas/BillingInterval"; }; readonly billingCycles: { readonly $ref: "#/components/schemas/BillingCycles"; }; readonly createdAt: { readonly type: "string"; readonly format: "date-time"; }; readonly subtotalKopecks: { readonly type: "integer"; readonly description: "Price before the coupon discount, in kopecks."; }; readonly discountKopecks: { readonly type: "integer"; readonly description: "Applied coupon discount, in kopecks."; }; readonly couponCode: { readonly type: "string"; readonly nullable: true; }; readonly amountKopecks: { readonly type: "integer"; readonly description: "Payable invoice amount after any coupon discount, in kopecks."; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "RUB" ]; }; readonly status: { readonly type: "string"; readonly enum: readonly [ "pending", "paid", "canceled", "failed" ]; }; }; }; readonly BillingInvoice: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "planId", "planCode", "planName", "status", "kind", "seats", "interval", "billingCycles", "subtotalKopecks", "discountKopecks", "amountKopecks", "currency" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly planId: { readonly type: "string"; readonly format: "uuid"; }; readonly planCode: { readonly type: "string"; }; readonly planName: { readonly type: "string"; }; readonly status: { readonly type: "string"; readonly enum: readonly [ "pending", "paid", "canceled", "failed" ]; }; readonly kind: { readonly type: "string"; readonly enum: readonly [ "initial", "upgrade", "renewal" ]; }; readonly seats: { readonly type: "integer"; }; readonly interval: { readonly $ref: "#/components/schemas/BillingInterval"; }; readonly billingCycles: { readonly $ref: "#/components/schemas/BillingCycles"; }; readonly subtotalKopecks: { readonly type: "integer"; readonly description: "Price before the coupon discount, in kopecks."; }; readonly discountKopecks: { readonly type: "integer"; readonly description: "Applied coupon discount, in kopecks."; }; readonly couponCode: { readonly type: "string"; readonly nullable: true; }; readonly amountKopecks: { readonly type: "integer"; readonly description: "Payable invoice amount after any coupon discount, in kopecks."; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "RUB" ]; }; readonly paymentUrl: { readonly type: "string"; readonly format: "uri"; readonly nullable: true; }; readonly paidAt: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly BillingRecommendations: { readonly type: "object"; readonly required: readonly [ "usage", "plans" ]; readonly description: "Returned only for a frozen Free-trial workspace."; readonly properties: { readonly usage: { readonly type: "object"; readonly required: readonly [ "tasks", "comments", "customers", "services", "seats", "storage_bytes" ]; readonly additionalProperties: { readonly type: "integer"; readonly format: "int64"; }; }; readonly plans: { readonly type: "array"; readonly items: { readonly allOf: readonly [ { readonly $ref: "#/components/schemas/WorkspacePlan"; }, { readonly type: "object"; readonly required: readonly [ "fits", "overLimit" ]; readonly properties: { readonly fits: { readonly type: "boolean"; }; readonly overLimit: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; }; } ]; }; }; }; }; readonly UpgradeWorkspacePlanRequest: { readonly type: "object"; readonly required: readonly [ "workspace" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly plan: { readonly type: "string"; readonly description: "Target public or workspace-granted Enterprise plan code. Required when choosing a plan."; }; readonly seats: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly billingInterval: { readonly $ref: "#/components/schemas/BillingInterval"; readonly description: "Required when converting a frozen Free trial to a paid plan."; }; readonly billingCycles: { readonly $ref: "#/components/schemas/BillingCycles"; readonly description: "Prepaid billing units (integer \u2265 1). Defaults to 1. Interval-specific caps apply after validation."; }; }; }; readonly CreateEnterprisePlanRequest: { readonly type: "object"; readonly required: readonly [ "workspace", "email", "code", "name", "monthlyAmountKopecks", "yearlyAmountKopecks", "limits" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly email: { readonly type: "string"; readonly format: "email"; readonly description: "Email of the workspace owner who may see and select this private plan."; }; readonly code: { readonly type: "string"; readonly pattern: "^[a-z0-9_-]+$"; readonly example: "enterprise-acme"; }; readonly name: { readonly type: "string"; readonly example: "Acme Enterprise"; }; readonly monthlyAmountKopecks: { readonly type: "integer"; readonly minimum: 1; }; readonly yearlyAmountKopecks: { readonly type: "integer"; readonly minimum: 1; }; readonly limits: { readonly type: "array"; readonly minItems: 1; readonly items: { readonly type: "object"; readonly required: readonly [ "metric", "limitValue" ]; readonly properties: { readonly metric: { readonly type: "string"; readonly enum: readonly [ "tasks", "comments", "customers", "services", "storage_bytes" ]; }; readonly limitValue: { readonly type: "integer"; readonly minimum: 1; }; }; }; }; }; }; readonly FinanceAccount: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "order", "name", "cardColor", "currency", "openingBalance", "active", "created_at" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly order: { readonly type: "integer"; readonly minimum: 1; readonly description: "1-based display order for the frontend account list."; }; readonly name: { readonly type: "string"; }; readonly cardColor: { readonly type: "string"; readonly example: "#A1B2C3"; readonly description: "Normalized 6-digit hex color including #."; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "ruble", "dollar", "euro" ]; }; readonly openingBalance: { readonly type: "number"; readonly description: "Opening balance in the account currency."; }; readonly country: { readonly type: "string"; readonly nullable: true; }; readonly companyName: { readonly type: "string"; readonly nullable: true; }; readonly companyAccountNumber: { readonly type: "string"; readonly nullable: true; }; readonly companyInn: { readonly type: "string"; readonly nullable: true; }; readonly companyKpp: { readonly type: "string"; readonly nullable: true; }; readonly companyOgrn: { readonly type: "string"; readonly nullable: true; }; readonly bankName: { readonly type: "string"; readonly nullable: true; }; readonly bankBik: { readonly type: "string"; readonly nullable: true; }; readonly bankKc: { readonly type: "string"; readonly nullable: true; }; readonly bankInn: { readonly type: "string"; readonly nullable: true; }; readonly bankKpp: { readonly type: "string"; readonly nullable: true; }; readonly vatRate: { readonly type: "integer"; readonly nullable: true; readonly minimum: 0; readonly maximum: 100; }; readonly active: { readonly type: "boolean"; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly FinanceAccountSuccess: { readonly type: "object"; readonly required: readonly [ "success", "account" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly account: { readonly $ref: "#/components/schemas/FinanceAccount"; }; }; }; readonly ListFinanceAccountsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "accounts" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly accounts: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/FinanceAccount"; }; }; }; }; readonly FinanceVisibilitySuccess: { readonly type: "object"; readonly required: readonly [ "success", "visibility" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly visibility: { readonly type: "boolean"; readonly description: "When true, the frontend should disclose account numbers in the default finance view."; }; }; }; readonly FinanceTransaction: { readonly type: "object"; readonly required: readonly [ "id", "workspaceId", "type", "amount", "date", "created_at" ]; readonly properties: { readonly id: { readonly type: "string"; readonly format: "uuid"; }; readonly workspaceId: { readonly type: "string"; readonly format: "uuid"; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "refund", "income", "expense", "transfer" ]; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; }; readonly accountId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Source account. Required for transfers."; }; readonly destinationAccountId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Destination account. Required for transfers; omitted for other types."; }; readonly paymentMethod: { readonly type: "string"; readonly nullable: true; }; readonly amount: { readonly type: "number"; readonly minimum: 0.01; readonly description: "Positive amount. Direction is implied by type."; }; readonly description: { readonly type: "string"; readonly nullable: true; }; readonly date: { readonly type: "string"; readonly format: "date-time"; readonly description: "Transaction date; defaults to now on create when omitted."; }; readonly vat: { readonly type: "integer"; readonly nullable: true; readonly minimum: 0; readonly maximum: 100; readonly description: "VAT rate 0-100."; }; readonly reason: { readonly type: "string"; readonly nullable: true; }; readonly created_at: { readonly type: "string"; readonly format: "date-time"; }; readonly updated_at: { readonly type: "string"; readonly format: "date-time"; readonly nullable: true; }; }; }; readonly FinanceTransactionSuccess: { readonly type: "object"; readonly required: readonly [ "success", "transaction" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly transaction: { readonly $ref: "#/components/schemas/FinanceTransaction"; }; }; }; readonly ListFinanceTransactionsSuccess: { readonly type: "object"; readonly required: readonly [ "success", "transactions" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly transactions: { readonly type: "array"; readonly items: { readonly $ref: "#/components/schemas/FinanceTransaction"; }; }; }; }; }; }; readonly paths: { readonly "/health": { readonly get: { readonly tags: readonly [ "System" ]; readonly summary: "Service health check"; readonly responses: { readonly 200: { readonly description: "Service is healthy"; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "status" ]; readonly properties: { readonly status: { readonly type: "string"; readonly example: "ok"; }; }; }; }; }; }; }; }; }; readonly "/auth/vk": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Start VK ID OAuth"; readonly description: "Redirects the browser to VK ID authorization. A PKCE code verifier is stored in Redis under the returned state parameter."; readonly responses: { readonly 302: { readonly description: "Redirect to VK ID authorize URL."; readonly headers: { readonly Location: { readonly schema: { readonly type: "string"; }; readonly description: "VK ID authorization URL."; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/vk/callback": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "VK ID OAuth callback"; readonly description: "Completes VK ID login; on success sets access (15 min) and refresh (7 days) cookies and redirects to the web app."; readonly parameters: readonly [ { readonly name: "code"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "Authorization code from VK ID."; }, { readonly name: "state"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "State value used to look up the PKCE code verifier."; }, { readonly name: "device_id"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "Device identifier required by VK token exchange."; } ]; readonly responses: { readonly 302: { readonly description: "Redirect to web app with session cookies set."; readonly headers: { readonly "Set-Cookie": { readonly schema: { readonly type: "string"; }; readonly description: "access-token and refresh-token cookies (domain .mestra.chat)."; }; }; }; readonly 400: { readonly description: "Missing query parameters, invalid verifier, or user info failure."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to issue tokens."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/google": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Start Google OAuth (sign-in)"; readonly description: "Redirects to Google OAuth consent for email and profile scopes (offline access)."; readonly responses: { readonly 302: { readonly description: "Redirect to Google authorization URL."; readonly headers: { readonly Location: { readonly schema: { readonly type: "string"; }; readonly description: "Google OAuth 2.0 authorization URL."; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/google/callback": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Google OAuth callback (sign-in)"; readonly description: "Exchanges the code, creates or loads the user, sets access (15 min) and refresh (7 days) session cookies, and redirects to the web app."; readonly parameters: readonly [ { readonly name: "code"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "Authorization code from Google."; } ]; readonly responses: { readonly 302: { readonly description: "Redirect to web app with session cookies set."; readonly headers: { readonly "Set-Cookie": { readonly schema: { readonly type: "string"; }; readonly description: "access-token and refresh-token cookies (domain .mestra.chat)."; }; }; }; readonly 400: { readonly description: "Missing `code`, or Google token exchange failed. `error` is a string such as Google's `error_description` (e.g. missing client_secret / invalid_request)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "`GOOGLE_CLIENT_SECRET is not configured`, or failed to issue session tokens after a successful Google exchange."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/google/connect": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Begin Google Calendar integration OAuth (PKCE)"; readonly description: "Returns a Google OAuth URL with userinfo (email, profile) and Calendar scopes, plus PKCE. Stores the verifier in Redis and sets an httpOnly state cookie."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Authorization URL ready for the client to open."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/GoogleCalendarAuthorizeResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/google/callback": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Google Calendar integration OAuth callback"; readonly description: "Exchanges Google code for tokens (including userinfo scopes from connect) and stores the integration with status `pending`, replacing any previous integration for the user. The remaining setup \u2014 creating the dedicated secondary calendar (\"Mestra App Calendar\") and registering a push channel on it \u2014 completes asynchronously after the response; the integration status then becomes `active` (or `error` if setup fails). Poll `/integrations/list` to observe the final status. Requires a matching state cookie from the connect endpoint."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "code"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "Authorization code returned by Google."; }, { readonly name: "state"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "State value used to validate the PKCE flow."; } ]; readonly responses: { readonly 200: { readonly description: "Tokens exchanged and integration stored with status `pending`; calendar creation and watch registration continue in the background."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "`Missing code or state`, `Invalid state`, `Invalid or expired state`, or Google token exchange failure (`error` string from Google / OAuth helper)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "`GOOGLE_CLIENT_SECRET is not configured`, or persisting the pending integration failed. Calendar creation / watch registration failures no longer surface here; they mark the integration status `error` instead."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/list": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "List integrations for authenticated user"; readonly description: "Returns stored integration rows plus the Google account email (`user`) from OAuth2 v2 userinfo using the saved tokens."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Integrations and linked Google account email in the `user` field."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/IntegrationListResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Integration list empty or not found (when applicable)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/google/disconnect": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Disconnect Google Calendar integration"; readonly description: "Revokes stored Google OAuth tokens with Google, deletes the dedicated app calendar when possible, then removes the integration row from the database."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Integration disconnected successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Integration not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/create-event": { readonly post: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Create Google Calendar event"; readonly description: "Creates an event on the linked \"Mestra App Calendar\" (stored integration calendar_id). Requires a valid access token and an active Google Calendar integration for the authenticated user. Workspace RBAC is not enforced on this route."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCalendarEventRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Event created in Google Calendar."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCalendarEventResponse"; }; }; }; }; readonly 400: { readonly description: "Invalid JSON body, invalid workspace in body, or event payload validation failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "No Google Calendar integration linked to the account."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/{workspace}/get-event": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Get a single Google Calendar event"; readonly description: "Loads one event from the linked Mestra app calendar via Calendar API events.get. Requires a valid access token, linked Google Calendar integration, and eventId query parameter. Path workspace is present for routing but workspace RBAC is not enforced."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace id in the URL path (UUID)."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "eventId"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "string"; }; readonly description: "Google Calendar event id returned by create or list operations."; } ]; readonly responses: { readonly 200: { readonly description: "Event resource from Google Calendar API v3."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCalendarEventResponse"; }; }; }; }; readonly 400: { readonly description: "eventId query parameter is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "No Google Calendar integration linked to the account."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/update-event": { readonly post: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Patch a Google Calendar event"; readonly description: "Partially updates an event on the linked calendar (events.patch). Body must include workspace and eventId. Requires a valid access token and linked Google Calendar integration. Only fields present in the body are sent to Google; Meet and extendedProperties are applied when conferenceData / type are set. Workspace RBAC is not enforced."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpdateCalendarEventRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Updated event from Google Calendar."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCalendarEventResponse"; }; }; }; }; readonly 400: { readonly description: "Invalid JSON body, invalid workspace in body, or update payload validation failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "No Google Calendar integration linked to the account."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/remove-event": { readonly post: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Delete a Google Calendar event"; readonly description: "Permanently deletes an event (events.delete) with sendUpdates=all. JSON body must include workspace and eventId. Requires a valid access token and linked Google Calendar integration. Workspace RBAC is not enforced."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/IntegrationCalendarEventIdRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Event deleted."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid JSON body, invalid workspace in body, or remove payload validation failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "No Google Calendar integration linked to the account."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/cancel-event": { readonly post: { readonly tags: readonly [ "Integrations" ]; readonly summary: "Cancel a Google Calendar event"; readonly description: "Sets the event status to cancelled (events.patch) with sendUpdates=all. JSON body must include workspace and eventId. Requires a valid access token and linked Google Calendar integration. Workspace RBAC is not enforced."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/IntegrationCalendarEventIdRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Event marked cancelled."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid JSON body, invalid workspace in body, or cancel payload validation failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "No Google Calendar integration linked to the account."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/{workspace}/list-events-by-month": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "List Google Calendar events for a month window"; readonly description: "Calls Google Calendar events.list on the linked integration calendar. Requires a valid access token and linked Google Calendar integration. The window is UTC from the first instant of the given calendar month through the first instant of the next month (same bounds as Date.UTC(year, month - 1, 1) to Date.UTC(year, month, 1) on the server). Workspace RBAC is not enforced."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace id in the URL path (UUID)."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "year"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "integer"; readonly example: 2026; }; readonly description: "Four-digit calendar year. Defaults to the current year when omitted."; }, { readonly name: "month"; readonly in: "query"; readonly required: true; readonly schema: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 12; readonly example: 5; }; readonly description: "Calendar month (1 = January through 12 = December)."; } ]; readonly responses: { readonly 200: { readonly description: "Events returned for the requested window."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CalendarMonthEventsListResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "No Google Calendar integration linked to the account."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/integrations/calendar/list-assignees-by-workspace/{workspace}": { readonly get: { readonly tags: readonly [ "Integrations" ]; readonly summary: "List workspace collaborators for calendar"; readonly description: "Returns all collaborators in the workspace with user email and names, for calendar attendee selection. Requires JWT, path workspace as a valid UUID, active collaborator status, and write access to the crm::calendar resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace id (UUID)."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Collaborators for the workspace."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListIntegrationCalendarAssigneesSuccess"; }; }; }; }; readonly 400: { readonly description: "Workspace path parameter is not a valid UUID."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Collaborator invite not accepted, user lacks crm::calendar resource access, or user lacks write permission for calendar."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "User is not a collaborator in this workspace (surfaced as workspace not found)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/request-otp": { readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Request a one-time password"; readonly description: "Without a bearer token this starts email login/signup. With an access token it links an email to the current account (for users who signed in with SMS)."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "email" ]; readonly properties: { readonly email: { readonly type: "string"; readonly format: "email"; readonly description: "Must be a supported provider domain (e.g. gmail.com, yandex.ru, mail.ru, outlook.com, vk.com)."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "OTP generated and sent successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/OtpRequestSuccess"; }; }; }; }; readonly 400: { readonly description: "Validation failed, an active OTP already exists, or linking was rejected (email already verified / in use)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/OtpRequestFailure"; }; }; }; }; readonly 401: { readonly description: "Authorization header was sent but the access token is missing, invalid, or expired."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/verify-otp": { readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Verify a one-time password"; readonly description: "Without a bearer token this completes email login/signup and returns tokens. With an access token it verifies and attaches an email to the current account."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "email", "otp" ]; readonly properties: { readonly email: { readonly type: "string"; readonly format: "email"; readonly description: "Must be a supported provider domain (e.g. gmail.com, yandex.ru, mail.ru, outlook.com, vk.com)."; }; readonly otp: { readonly type: "string"; readonly pattern: "^[0-9]{6}$"; readonly description: "6-digit OTP code."; }; readonly keepSignIn: { readonly type: "boolean"; readonly description: "Login only. Extend refresh token validity to 30 days when true (default 7 days). Ignored when linking a contact."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Login returns tokens. Linking an email to the current account returns success only (no new tokens)."; readonly content: { readonly "application/json": { readonly schema: { readonly oneOf: readonly [ { readonly $ref: "#/components/schemas/VerifyOtpSuccess"; }, { readonly $ref: "#/components/schemas/SimpleSuccess"; } ]; }; }; }; }; readonly 400: { readonly description: "Validation failed, OTP is invalid/expired, or linking was rejected."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/VerifyOtpFailure"; }; }; }; }; readonly 401: { readonly description: "Authorization header was sent but the access token is missing, invalid, or expired."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/request-sms-otp": { readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Request a one-time password by SMS"; readonly description: "Without a bearer token this starts SMS login/signup. With an access token it links a phone to the current account (for users who signed in with email). SMS is sent via REDSMS only when dialCode is +7. Dial code +98 does not send SMS; the OTP is always 987321 for testing."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "dialCode", "number" ]; readonly properties: { readonly dialCode: { readonly type: "string"; readonly description: "International dial code, with or without a leading +."; readonly example: "+7"; }; readonly number: { readonly type: "string"; readonly description: "National phone number without the dial code."; readonly example: "9197286223"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "OTP generated and sent successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/OtpRequestSuccess"; }; }; }; }; readonly 400: { readonly description: "Validation failed, an active OTP already exists, or linking was rejected (phone already verified / in use)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/OtpRequestFailure"; }; }; }; }; readonly 401: { readonly description: "Authorization header was sent but the access token is missing, invalid, or expired."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/verify-sms-otp": { readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Verify an SMS one-time password"; readonly description: "Without a bearer token this completes SMS login/signup and returns tokens. With an access token it verifies and attaches a phone to the current account."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "dialCode", "number", "otp" ]; readonly properties: { readonly dialCode: { readonly type: "string"; readonly description: "International dial code, with or without a leading +."; readonly example: "+7"; }; readonly number: { readonly type: "string"; readonly description: "National phone number without the dial code."; readonly example: "9197286223"; }; readonly otp: { readonly type: "string"; readonly pattern: "^[0-9]{6}$"; readonly description: "6-digit OTP code."; }; readonly keepSignIn: { readonly type: "boolean"; readonly description: "Login only. Extend refresh token validity to 30 days when true (default 7 days). Ignored when linking a contact."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Login returns tokens. Linking a phone to the current account returns success only (no new tokens)."; readonly content: { readonly "application/json": { readonly schema: { readonly oneOf: readonly [ { readonly $ref: "#/components/schemas/VerifyOtpSuccess"; }, { readonly $ref: "#/components/schemas/SimpleSuccess"; } ]; }; }; }; }; readonly 400: { readonly description: "Validation failed, OTP is invalid/expired, or linking was rejected."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/VerifyOtpFailure"; }; }; }; }; readonly 401: { readonly description: "Authorization header was sent but the access token is missing, invalid, or expired."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/request-voice-otp": { readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Request a one-time password by voice call"; readonly description: "Without a bearer token this starts voice-call login/signup. With an access token it links a phone to the current account. Voice calls are sent through REDSMS only when dialCode is +7."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "dialCode", "number" ]; readonly properties: { readonly dialCode: { readonly type: "string"; readonly description: "International dial code, with or without a leading +."; readonly example: "+7"; }; readonly number: { readonly type: "string"; readonly description: "National phone number without the dial code."; readonly example: "9197286223"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "OTP generated and voice call queued successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/OtpRequestSuccess"; }; }; }; }; readonly 400: { readonly description: "Validation failed, an active OTP already exists, or linking was rejected (phone already verified / in use)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/OtpRequestFailure"; }; }; }; }; readonly 401: { readonly description: "Authorization header was sent but the access token is missing, invalid, or expired."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/verify-voice-otp": { readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Verify a voice-call one-time password"; readonly description: "Without a bearer token this completes voice-call login/signup and returns tokens. With an access token it verifies and attaches a phone to the current account."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "dialCode", "number", "otp" ]; readonly properties: { readonly dialCode: { readonly type: "string"; readonly description: "International dial code, with or without a leading +."; readonly example: "+7"; }; readonly number: { readonly type: "string"; readonly description: "National phone number without the dial code."; readonly example: "9197286223"; }; readonly otp: { readonly type: "string"; readonly pattern: "^[0-9]{6}$"; readonly description: "6-digit OTP code."; }; readonly keepSignIn: { readonly type: "boolean"; readonly description: "Login only. Extend refresh token validity to 30 days when true (default 7 days). Ignored when linking a contact."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Login returns tokens. Linking a phone to the current account returns success only (no new tokens)."; readonly content: { readonly "application/json": { readonly schema: { readonly oneOf: readonly [ { readonly $ref: "#/components/schemas/VerifyOtpSuccess"; }, { readonly $ref: "#/components/schemas/SimpleSuccess"; } ]; }; }; }; }; readonly 400: { readonly description: "Validation failed, OTP is invalid/expired, or linking was rejected."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/VerifyOtpFailure"; }; }; }; }; readonly 401: { readonly description: "Authorization header was sent but the access token is missing, invalid, or expired."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/me": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Get current authenticated user"; readonly description: "Returns the user profile for the `userId` claim on the provided access token. SMS-only accounts have `email: null` until an email is linked. Use `emailVerified` and `phoneVerified` to decide whether the user can create a workspace or accept an invite."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Current user info."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "user" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly user: { readonly $ref: "#/components/schemas/User"; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; readonly post: { readonly tags: readonly [ "Auth" ]; readonly summary: "Update user profile"; readonly description: "Updates the basic profile details for the authenticated user identified by the access token `userId` claim."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "firstName", "lastName" ]; readonly properties: { readonly firstName: { readonly type: "string"; }; readonly lastName: { readonly type: "string"; }; readonly profilePicture: { readonly type: "string"; readonly nullable: true; readonly description: "URL to the user's avatar."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Profile updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/refresh": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Refresh access token"; readonly description: "Generate a new access token by presenting a valid refresh token."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Access token refreshed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "accessToken" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly accessToken: { readonly type: "string"; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid refresh token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/logout": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Logout and invalidate current token"; readonly description: "Invalidates the presented access token by removing its JTI."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Token invalidated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "message" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly example: "jti_123 invalidated"; }; }; }; }; }; }; readonly 400: { readonly description: "Token could not be invalidated."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly message: { readonly type: "string"; readonly nullable: true; readonly example: "Failed to invalidate token"; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/auth/logout-all": { readonly get: { readonly tags: readonly [ "Auth" ]; readonly summary: "Logout from every session"; readonly description: "Invalidates all access and refresh tokens belonging to the authenticated user identified by the access token `userId` claim."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "All tokens invalidated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "message" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly message: { readonly type: "string"; readonly example: "All tokens invalidated"; }; }; }; }; }; }; readonly 400: { readonly description: "Tokens could not be invalidated."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: false; }; readonly message: { readonly type: "string"; readonly nullable: true; readonly example: "Failed to invalidate tokens"; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/create": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Create a new workspace"; readonly description: "Creates a workspace and its billing subscription atomically. Requires the caller to have both email and phone verified. Free starts a 15-day trial; each owner can start only one free trial for the lifetime of their account. Economy, Standard, and Professional each create a pending invoice; use the returned invoiceId to start YooKassa checkout. An owner may have at most 5 pending unpaid invoices for those paid plans before creating another."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "name", "maxCollaborators" ]; readonly properties: { readonly name: { readonly type: "string"; readonly description: "Workspace display name (first character uppercased server-side)."; }; readonly maxCollaborators: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly category: { readonly $ref: "#/components/schemas/WorkspaceCategory"; }; readonly plan: { readonly type: "string"; readonly default: "free"; readonly enum: readonly [ "free", "economy", "standard", "professional" ]; readonly description: "Public plan code. Enterprise codes are only available after operations grants them to an existing workspace."; }; readonly billingInterval: { readonly $ref: "#/components/schemas/BillingInterval"; }; readonly billingCycles: { readonly $ref: "#/components/schemas/BillingCycles"; readonly description: "Prepaid billing units (integer \u2265 1). Defaults to 1. Interval-specific caps apply after validation."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Workspace created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly allOf: readonly [ { readonly $ref: "#/components/schemas/CreateWorkspaceSuccess"; } ]; readonly description: "Returns the newly created workspace id and name."; }; }; }; }; readonly 400: { readonly description: "Invalid payload, unavailable plan, Free-trial limit exceeded (`Each user can create only one free trial workspace`), or too many pending unpaid invoices for Economy/Standard/Professional (`Pay or cancel unpaid invoices before creating more workspaces (limit 5)`)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - Email and phone are not both verified."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/plans": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "List public workspace plans"; readonly description: "Returns Free, Economy, Standard, and Professional cards. Enterprise is represented by a contact-us CTA and is not a public checkout plan."; readonly responses: { readonly 200: { readonly description: "Public plans fetched."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "plans", "enterprise" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly plans: { readonly type: "array"; readonly items: any; }; readonly enterprise: { readonly type: "object"; readonly required: readonly [ "code", "cta" ]; readonly properties: any; }; }; }; }; }; }; }; }; }; readonly "/workspace/plans/{workspace}": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "List plans available to a workspace"; readonly description: "Returns public plans plus any private Enterprise plans granted to this workspace."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Available plans fetched."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "plans" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly plans: { readonly type: "array"; readonly items: any; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found or caller is not a collaborator."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/billing/{workspace}": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Get workspace billing state"; readonly description: "Owner-only. If a pending invoice has a YooKassa payment that already succeeded, this GET confirms it (so post-checkout polling does not wait on the webhook). For a frozen Free trial, includes usage and plan-fit recommendations. Paid workspaces receive subscription and pending-invoice state only."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Billing state fetched."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "subscription", "pendingInvoice", "recommendations" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly subscription: { readonly allOf: readonly [ /*elided*/ any ]; readonly nullable: true; }; readonly pendingInvoice: { readonly allOf: readonly [ /*elided*/ any ]; readonly nullable: true; }; readonly recommendations: { readonly allOf: readonly [ /*elided*/ any ]; readonly nullable: true; }; }; }; }; }; }; readonly 403: { readonly description: "Only the workspace owner can view billing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/admin/enterprise-plan": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Create and grant a private Enterprise plan"; readonly description: "Operations-only endpoint. It creates a plan and grants it to one workspace. Do not call from frontend code or expose BILLING_ADMIN_TOKEN."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateEnterprisePlanRequest"; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Enterprise plan created and granted."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "plan" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly plan: { readonly $ref: "#/components/schemas/WorkspacePlan"; }; }; }; }; }; }; readonly 401: { readonly description: "Missing or invalid operations token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 400: { readonly description: "Invalid plan definition or duplicate plan code."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/list": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "List workspaces for the authenticated user"; readonly description: "Returns workspaces the user collaborates on, each with category, plan code, subscription status, trial end date when applicable, role, billing flags, invitation state, workspace profile picture URL, and the resource grants effective for the caller. Also returns `unpaidLimit` (5): the maximum pending unpaid Economy/Standard/Professional invoices an owner may hold before create is blocked."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Workspaces fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "workspaces", "unpaidLimit" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspaces: { readonly type: "array"; readonly items: any; }; readonly unpaidLimit: { readonly type: "integer"; readonly const: 5; readonly description: "Max pending unpaid invoices allowed when creating another Economy/Standard/Professional workspace. Create returns 400 once this many unpaid invoices already exist."; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/calculator": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Calculate workspace price per collaborator"; readonly description: "Returns pricing information based on the number of collaborators and selected services."; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "maxCollaborators", "services" ]; readonly properties: { readonly maxCollaborators: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly services: { readonly type: "array"; readonly items: { readonly type: "string"; readonly enum: readonly [ "crm" ]; }; readonly description: "Services to calculate price for."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Price calculated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/WorkspaceCalculatorResponse"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/resources": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "List workspace resources"; readonly description: "Returns the catalog of resources that can be targeted by workspace policies."; readonly responses: { readonly 200: { readonly description: "Resources fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "resources" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly resources: { readonly type: "array"; readonly items: any; }; }; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/policies": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Update workspace policies for a collaborator"; readonly description: "Updates the resource permissions for a collaborator or pending invitation. Send `collaboratorId` from GET /workspace/policies/{workspace}: that field is `invitations.id` for an unregistered email, or `collaborators.id` for a registered user. Email-only invites store grants on the invitation until signup; pending collaborators get policy rows updated as well. When a registered collaborator with an existing Matrix tenant loses all `crm::chats` grants, their Matrix account is deactivated with Synapse (`erase: false`); assigning `crm::chats` again reactivates it. Requires write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "resources", "workspace" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "ID from GET /workspace/policies/{workspace}: `invitations.id` for an unregistered email, or `collaborators.id` for a registered user."; }; readonly resources: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Array of resource UUIDs to grant access to."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the policies are applied."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Policies updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, id is not a collaborator or pending invitation, or policies cannot be changed for the workspace owner."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "One or more resource UUIDs were not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to update policies, or policies were updated but Synapse account activation/deactivation could not run because SYNAPSE_ADMIN_TOKEN is not configured."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 502: { readonly description: "Policies were updated, but Synapse failed to activate or deactivate the Matrix user after crm::chats access changed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/policies/{workspace}": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "List policies for a workspace"; readonly description: "Returns collaborators grouped by user with their resource grants, owner/current-user flags, profile fields, and `collaboratorId`. Requires read access to crm::general resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier to retrieve policies for."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Policies fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "collaborators" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly collaborators: { readonly type: "array"; readonly items: any; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/invite": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Create workspace invitation"; readonly description: "Creates an invitation for an email to join a workspace with specified resources and role. Works for emails that are not yet registered: a pending `invitations` row is stored and a collaborator is materialized when that email creates an account (OTP signup or OAuth). If the user already exists, a pending collaborator with policies is created immediately (same accept flow as before). Always returns the invite `token` for the frontend to share. Requires write access to crm::general. Pending invitations for unknown emails count toward the workspace collaborator seat limit."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "email", "workspace", "resources", "role" ]; readonly properties: { readonly email: { readonly type: "string"; readonly format: "email"; readonly description: "Email to invite (registered or not)."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the invitation is created."; }; readonly resources: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Array of resource UUIDs to grant access to."; }; readonly role: { readonly type: "string"; readonly description: "Role to assign to the collaborator."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Invitation created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "token" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly token: { readonly type: "string"; readonly minLength: 64; readonly maxLength: 64; readonly description: "Invite token for GET /workspace/invite/{workspace}/{token} after the invitee authenticates."; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, max collaborators reached, invitation already pending, user is already a collaborator, or resource not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Resource not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Invitation creation rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/invite/cancel": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Cancel a pending workspace invitation"; readonly description: "Cancels a pending invite. Send `collaboratorId` from GET /workspace/policies/{workspace}: that field is `invitations.id` for an unregistered email, or `collaborators.id` for a registered user who has not accepted yet. Email-only invites are marked canceled (seat is freed; the token can no longer be used after signup). Pending collaborators are removed the same way as /workspace/settings/remove-collaborator. Already-accepted members cannot be canceled here. Requires write access to crm::general. This cleanup action remains available in frozen Free-trial workspaces."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "collaboratorId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "The `collaboratorId` from the policies list for the pending row to cancel."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Invitation canceled."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid payload, or the id is not a pending invitation / pending collaborator (`No pending invitation`)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to cancel invitation."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/invite/{workspace}/{token}": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Accept workspace invitation"; readonly description: "Accepts a workspace invitation using the provided token. When a rejoining collaborator receives `crm::chats`, their existing Matrix account is reactivated if it exists. Requires authentication and both email and phone verified."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where the invitation was created."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "token"; readonly in: "path"; readonly required: true; readonly description: "64-character hexadecimal invitation token."; readonly schema: { readonly type: "string"; readonly minLength: 64; readonly maxLength: 64; }; } ]; readonly responses: { readonly 200: { readonly description: "Invitation accepted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id or invitation token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or email and phone are not both verified."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Invitation acceptance rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/role": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Update collaborator role"; readonly description: "Updates the role of a collaborator or pending invitation. Send `collaboratorId` from GET /workspace/policies/{workspace}: that field is `invitations.id` for an unregistered email, or `collaborators.id` for a registered user. Email-only invites store the role on the invitation until signup; pending collaborators are updated as well. Requires write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "collaboratorId", "role" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the role is updated."; }; readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "ID from GET /workspace/policies/{workspace}: `invitations.id` for an unregistered email, or `collaborators.id` for a registered user."; }; readonly role: { readonly type: "string"; readonly description: "New role to assign to the collaborator."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Role updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, or the id is not a collaborator or pending invitation."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too Many Requests - Role update rate limit exceeded."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to update role."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/settings": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Update workspace settings"; readonly description: "Updates the workspace name. Only the workspace owner may call this endpoint; requires write access to crm::general. Seat changes must use `/payments/upgrade` so an invoice is created."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace" ]; readonly properties: { readonly name: { readonly type: "string"; readonly description: "New name for the workspace."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier to update."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Workspace settings updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "workspace", "name", "maxCollaborators", "hasPaid" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; }; readonly maxCollaborators: { readonly $ref: "#/components/schemas/WorkspaceMaxCollaborators"; }; readonly hasPaid: { readonly type: "boolean"; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, missing name, or caller is not the workspace owner. Seat changes are rejected; use /payments/upgrade."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to edit workspace."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/settings/remove-collaborator": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Remove a collaborator from workspace"; readonly description: "Removes a non-owner collaborator from the workspace. Requires write access to crm::general resource. This cleanup action remains available in frozen Free-trial workspaces."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "workspace" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Collaborator row ID (`collaborators.id`) to remove."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the collaborator will be removed."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Collaborator removed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, user is not a collaborator, or target is the workspace owner."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to remove collaborator."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/delete": { readonly post: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Delete a workspace"; readonly description: "Soft-deletes a workspace: sets deleted_at, revokes collaborator access, and purges CRM content (policies, assignees, chat tenants, comments, tasks, customers, services, tags, templates). Billing subscriptions and invoices are retained for audit/history (pending invoices are canceled; the subscription is marked canceled). A workspace can be deleted after a YooKassa payment link has been issued; its pending invoice is canceled, so that link cannot activate the deleted workspace. Free trial workspaces cannot be deleted. Only the owner can delete. Requires write access to crm::general. Past-due paid workspaces and Free trials cannot."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "confirm" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier to delete."; }; readonly confirm: { readonly type: "string"; readonly description: "Confirmation text in the format 'confirm to delete workspace {workspaceName}'."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Workspace soft-deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, confirm text does not match, user is not the owner, or the workspace is a Free trial (`Free trial workspaces cannot be deleted`)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or crm::general write, or the workspace is frozen/past-due."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "The YooKassa payment has completed or is being processed. The workspace is left intact."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 503: { readonly description: "YooKassa configuration is missing, so the payment cannot be verified."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to delete workspace."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/workspace/leave/{workspace}": { readonly get: { readonly tags: readonly [ "Workspace" ]; readonly summary: "Leave a workspace"; readonly description: "Removes the authenticated user from the workspace. Workspace owners cannot leave; they must delete the workspace instead (`Owner cannot leave the workspace, Delete the workspace instead`)."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Left the workspace successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id, caller is not a collaborator, or caller is the workspace owner."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to leave workspace."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/payments/history": { readonly get: { readonly tags: readonly [ "Payments" ]; readonly summary: "List billing history for the signed-in owner"; readonly description: "Returns every subscription invoice for workspaces owned by the caller, newest first. Includes invoices for soft-deleted workspaces. Optional month=YYYY-MM filters by invoice creation month (UTC)."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "month"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly pattern: "^\\d{4}-(0[1-9]|1[0-2])$"; readonly example: "2026-07"; }; readonly description: "Filter invoices created in this UTC month. Omit for all months."; } ]; readonly responses: { readonly 200: { readonly description: "Invoice history."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "invoices" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly invoices: { readonly type: "array"; readonly items: any; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid month query."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/payments/invoice/{invoiceId}/pay": { readonly post: { readonly tags: readonly [ "Payments" ]; readonly summary: "Create or retrieve YooKassa checkout"; readonly description: "Workspace owner only. Starts a YooKassa Smart Payment checkout for a pending invoice and returns a redirect URL. Redirect the browser to paymentUrl, where the customer selects an available payment method, including SBP when enabled for the YooKassa shop. A live checkout must expire or complete before the invoice can change."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "invoiceId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Checkout URL ready."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "paymentUrl", "providerPaymentId" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly paymentUrl: { readonly type: "string"; readonly format: "uri"; }; readonly providerPaymentId: { readonly type: "string"; }; }; }; }; }; }; readonly 403: { readonly description: "Invoice does not belong to caller."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Pending invoice not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "Invoice is already paid."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 503: { readonly description: "YooKassa configuration is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/payments/invoice/{invoiceId}/coupon": { readonly post: { readonly tags: readonly [ "Payments" ]; readonly summary: "Apply a coupon to a pending invoice"; readonly description: "Workspace owner only. Applies a fixed or percentage coupon. If the invoice has a live YooKassa checkout, it is replaced with a discounted invoice and this response includes a new checkout link. Coupon attempts are rate limited; invalid codes intentionally return the same response."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "invoiceId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "code" ]; readonly properties: { readonly code: { readonly type: "string"; readonly minLength: 3; readonly maxLength: 64; readonly pattern: "^[A-Za-z0-9_-]+$"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Coupon applied."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly invoice: { readonly type: "object"; readonly properties: any; }; readonly paymentUrl: { readonly type: "string"; readonly format: "uri"; readonly description: "New YooKassa checkout URL when a live checkout was replaced."; }; readonly providerPaymentId: { readonly type: "string"; readonly description: "Identifier for the replacement YooKassa payment."; }; }; }; }; }; }; readonly 400: { readonly description: "Coupon cannot be applied."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "Invoice is no longer eligible for a coupon."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too many coupon attempts."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; readonly delete: { readonly tags: readonly [ "Payments" ]; readonly summary: "Remove a coupon from a pending invoice"; readonly description: "Workspace owner only. Removes the invoice redemption and restores the full invoice amount. It is unavailable after YooKassa checkout has started."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "invoiceId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Coupon removed."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly invoice: { readonly $ref: "#/components/schemas/BillingInvoice"; }; }; }; }; }; }; readonly 404: { readonly description: "Invoice not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "No coupon is applied or checkout has started."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 429: { readonly description: "Too many requests."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/payments/upgrade": { readonly post: { readonly tags: readonly [ "Payments" ]; readonly summary: "Create a plan-change or seat-change invoice"; readonly description: "Before the first payment, owners can correct a plan or seat count up or down. After any payment, only a higher plan and/or more seats is accepted. The selected plan must fit the workspace's current tasks, comments, customers, services, storage usage, and active collaborator count; otherwise delete data or select a larger plan before retrying. The selected change takes effect only after the new invoice is paid."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpgradeWorkspacePlanRequest"; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Pending invoice created."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "invoiceId", "invoice" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly invoiceId: { readonly type: "string"; readonly format: "uuid"; }; readonly invoice: { readonly $ref: "#/components/schemas/BillingInvoice"; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid change, no actual change, or disallowed downgrade."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Plan is not available to this workspace."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found or caller is not its owner."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/payments/webhook": { readonly post: { readonly tags: readonly [ "Payments" ]; readonly summary: "Receive YooKassa payment event"; readonly description: "Server-to-server endpoint for YooKassa only. The core verifies a completed payment and only then marks the invoice paid. Frontends must not call this endpoint."; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "object" ]; readonly properties: { readonly type: { readonly type: "string"; readonly example: "notification"; }; readonly object: { readonly type: "object"; readonly required: readonly [ "id", "status" ]; readonly properties: { readonly id: any; readonly status: any; }; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Payment applied or non-success event ignored."; }; readonly 400: { readonly description: "Invalid webhook or payment did not succeed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/task-phases/list/{workspace}": { readonly get: { readonly tags: readonly [ "Tasks" ]; readonly summary: "List workspace task phases"; readonly description: "Returns the ordered task phases configured for a workspace. Requires workspace access and crm::tasks read access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Task phases fetched."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "phases" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly phases: { readonly type: "array"; readonly items: any; }; }; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/task-phases/create": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Create a workspace task phase"; readonly description: "Adds a phase at the end of the workspace workflow. Requires crm::tasks write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "name" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; readonly maxLength: 64; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Task phase created."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly properties: { readonly success: { readonly type: "boolean"; readonly const: true; }; readonly phase: { readonly $ref: "#/components/schemas/TaskPhase"; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid request."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "A phase with this name exists."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/task-phases/update": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Rename a workspace task phase"; readonly description: "Requires crm::tasks write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "phaseId", "name" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly phaseId: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; readonly maxLength: 64; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Task phase renamed."; }; readonly 400: { readonly description: "Invalid request."; }; readonly 403: { readonly description: "Forbidden."; }; readonly 404: { readonly description: "Task phase not found."; }; readonly 409: { readonly description: "A phase with this name exists, or the phase is built-in."; }; }; }; }; readonly "/task-phases/reorder": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Reorder workspace task phases"; readonly description: "phaseIds must contain every phase in the workspace exactly once. Requires crm::tasks write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "phaseIds" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly phaseIds: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Task phases reordered."; }; readonly 400: { readonly description: "Invalid phase order."; }; readonly 403: { readonly description: "Forbidden."; }; }; }; }; readonly "/task-phases/delete": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Delete a workspace task phase"; readonly description: "Built-in phases cannot be deleted. A custom phase cannot be deleted while tasks use it, and each workspace must retain at least one phase. Requires crm::tasks write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "phaseId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly phaseId: { readonly type: "string"; readonly format: "uuid"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Task phase deleted."; }; readonly 400: { readonly description: "Invalid request."; }; readonly 403: { readonly description: "Forbidden."; }; readonly 404: { readonly description: "Task phase not found."; }; readonly 409: { readonly description: "Task phase is built-in, in use, or the workspace's last phase."; }; }; }; }; readonly "/tasks/create": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Create a new task"; readonly description: "Creates a task in the specified workspace. Collaborator IDs that don't belong to the workspace are skipped. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "subject" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task is created."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Optional customer identifier to associate with the task."; }; readonly subject: { readonly type: "string"; readonly description: "Task subject/title."; }; readonly description: { readonly type: "string"; readonly nullable: true; readonly description: "Task description."; }; readonly phaseId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Workspace phase for the task. Defaults to the workspace's first phase."; }; readonly priority: { readonly type: "string"; readonly enum: readonly [ "low", "medium", "high" ]; readonly nullable: true; readonly description: "Task priority level. Defaults to 'medium' if not provided."; }; readonly assignees: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly nullable: true; readonly description: "Collaborator IDs to assign to the task. IDs outside the workspace are skipped."; }; readonly comments: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly nullable: true; readonly description: "Optional strings allowed by validation; the create handler does not persist them."; }; readonly attachments: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly nullable: true; readonly description: "Optional strings allowed by validation; the create handler does not persist them."; }; readonly visibility: { readonly type: "string"; readonly enum: readonly [ "public", "private" ]; readonly nullable: true; readonly description: "Task visibility. Defaults to 'public'. Private tasks are only visible to assignees."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Task created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateTaskSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tasks/list/{workspace}": { readonly get: { readonly tags: readonly [ "Tasks" ]; readonly summary: "List tasks for a workspace"; readonly description: "Returns tasks in the specified workspace. Write access: all tasks. Read access: tasks with public visibility plus private tasks assigned to the caller. Requires workspace access and read or write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier to retrieve tasks for."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Tasks fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListTasksSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tasks/{workspace}/{taskId}": { readonly get: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Get a single task"; readonly description: "Returns a single task by ID. Write access: any task. Read access: only if task is public or the caller is assigned. Requires workspace access and read or write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where the task belongs."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "taskId"; readonly in: "path"; readonly required: true; readonly description: "Task identifier to retrieve."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Task fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/GetTaskSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id or task id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tasks/update": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Update a task"; readonly description: "Updates a task in the specified workspace. When assignees are notified, the sync response exposes the locale-neutral `task.assigned` key with interpolation data rather than pre-rendered copy. Omit the field to leave assignments untouched. Only the task creator can update the task. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to update."; }; readonly subject: { readonly type: "string"; readonly nullable: true; readonly description: "Task subject/title."; }; readonly description: { readonly type: "string"; readonly nullable: true; readonly description: "Task description."; }; readonly phaseId: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Workspace phase for the task."; }; readonly priority: { readonly type: "string"; readonly enum: readonly [ "low", "medium", "high" ]; readonly nullable: true; readonly description: "Task priority level."; }; readonly assignees: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly nullable: true; readonly description: "Full desired set of assigned collaborator IDs. Missing collaborators are unassigned, new ones assigned (both with in-app notifications). Omit to leave assignments unchanged. IDs outside the workspace are skipped."; }; readonly visibility: { readonly type: "string"; readonly enum: readonly [ "public", "private" ]; readonly nullable: true; readonly description: "Task visibility. Private tasks are only visible to assignees."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Task updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, user lacks write access to crm::tasks resource, or user is not the creator of the task."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to update task."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tasks/delete": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Delete a task"; readonly description: "Deletes a task from the specified workspace. Requires workspace access and write access to crm::tasks resource. This deletion remains available for a frozen Free-trial workspace so it can reduce usage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "taskId", "workspace" ]; readonly properties: { readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to delete."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Task deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tasks/assign-customer": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Assign a customer to a task"; readonly description: "Assigns a category-specific customer to an existing task in the specified workspace. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "customerId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to assign the customer to."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer identifier to associate with the task."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Customer assigned to task successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, customer, or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tasks/remove-customer": { readonly post: { readonly tags: readonly [ "Tasks" ]; readonly summary: "Remove a customer from a task"; readonly description: "Removes the customer association from an existing task in the specified workspace. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "customerId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to remove the customer from."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer identifier currently associated with the task."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Customer removed from task successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, customer, or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/templates/create": { readonly post: { readonly tags: readonly [ "Templates" ]; readonly summary: "Create a template"; readonly description: "Creates a task message template in the specified workspace. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "name", "content" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly name: { readonly type: "string"; readonly description: "Template title (stored as title)."; }; readonly content: { readonly type: "string"; readonly description: "Template body text."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Template created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateTemplateSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/templates/list/{workspace}": { readonly get: { readonly tags: readonly [ "Templates" ]; readonly summary: "List templates for a workspace"; readonly description: "Returns all task message templates in the specified workspace. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Templates fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListTemplatesSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/templates/delete": { readonly post: { readonly tags: readonly [ "Templates" ]; readonly summary: "Delete a template"; readonly description: "Deletes a template from the workspace. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "templateId", "workspace" ]; readonly properties: { readonly templateId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Template identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Template deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Template not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/comments/create": { readonly post: { readonly tags: readonly [ "Comments" ]; readonly summary: "Create a new comment"; readonly description: "Creates a comment on a task in the specified workspace. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "content" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the comment is created."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to comment on."; }; readonly content: { readonly type: "string"; readonly maxLength: 512; readonly description: "Comment content."; }; readonly replyTo: { readonly type: "string"; readonly format: "uuid"; readonly nullable: true; readonly description: "Optional identifier of the comment being replied to. When omitted, creates a top-level comment."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Comment created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCommentSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/comments/list/{workspace}/{taskId}": { readonly get: { readonly tags: readonly [ "Comments" ]; readonly summary: "List comments for a task"; readonly description: "Returns all comments for a task in the specified workspace. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where the task belongs."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "taskId"; readonly in: "path"; readonly required: true; readonly description: "Task identifier to retrieve comments for."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Comments fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListCommentsSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id or task id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/comments/delete": { readonly post: { readonly tags: readonly [ "Comments" ]; readonly summary: "Delete a comment"; readonly description: "Deletes a comment from a task in the specified workspace. Requires workspace access and write access to crm::tasks resource. This deletion remains available for a frozen Free-trial workspace so it can reduce usage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "commentId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the comment belongs."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier where the comment belongs."; }; readonly commentId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Comment identifier to delete."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Comment deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found or comment not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/comments/edit": { readonly post: { readonly tags: readonly [ "Comments" ]; readonly summary: "Edit a comment"; readonly description: "Updates a comment body and records its prior body, replacement body, editor, and time. Collaborators with write access to crm::tasks can edit any comment. A read-only collaborator assigned to that task can edit any comment on it."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "commentId", "content" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the comment belongs."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier where the comment belongs."; }; readonly commentId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Comment identifier to update."; }; readonly content: { readonly type: "string"; readonly description: "New comment content."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Comment updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks resource, or the collaborator is not assigned to the task."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found or comment not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/comments/history/{workspace}/{taskId}/{commentId}": { readonly get: { readonly tags: readonly [ "Comments" ]; readonly summary: "List a comment's edit history"; readonly description: "Returns each recorded change to a comment body, including its prior and replacement body, editor, and timestamp. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "taskId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Task identifier."; }, { readonly name: "commentId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Comment identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Comment edit history."; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "success", "history" ]; readonly properties: { readonly success: { readonly type: "boolean"; readonly example: true; }; readonly history: { readonly type: "array"; readonly items: any; }; }; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace or task read access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task or comment not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/event/stream": { readonly get: { readonly tags: readonly [ "Events" ]; readonly summary: "Subscribe to Server-Sent Events stream"; readonly description: "Establishes an authenticated Server-Sent Events (SSE) connection for real-time event streaming. The connection sends a connected event immediately, keepalive events every 30 seconds, and stream events published through NATS. Stream events are filtered by the authenticated user's userId."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "SSE stream established successfully."; readonly content: { readonly "text/event-stream": { readonly schema: { readonly type: "string"; readonly description: "Server-Sent Events stream. Events include 'connected', 'keepalive', and 'stream' event types."; readonly example: "event: connected\ndata: {\"message\":\"Connected\",\"time\":1234567890}\n\n"; }; }; }; readonly headers: { readonly "Content-Type": { readonly schema: { readonly type: "string"; readonly example: "text/event-stream"; }; readonly description: "SSE content type header."; }; readonly "Cache-Control": { readonly schema: { readonly type: "string"; readonly example: "no-cache"; }; readonly description: "Cache control header for SSE."; }; readonly Connection: { readonly schema: { readonly type: "string"; readonly example: "keep-alive"; }; readonly description: "Connection header for SSE."; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/customers/create": { readonly post: { readonly tags: readonly [ "Customers" ]; readonly summary: "Create a new customer"; readonly description: "Creates a category-specific customer in the specified workspace. Real-estate workspaces persist a lead on customer_real_estates. Requires workspace access, write access to crm::customers, and billing capacity for customers. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "name" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the customer is created."; }; readonly name: { readonly type: "string"; readonly description: "Customer name."; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "buyer", "seller", "tenant", "landlord", "investor", "agent" ]; }; readonly companyName: { readonly type: "string"; }; readonly phone: { readonly type: "string"; readonly description: "E.164 phone number."; }; readonly telegram: { readonly type: "string"; }; readonly whatsapp: { readonly type: "string"; }; readonly instagram: { readonly type: "string"; }; readonly vk: { readonly type: "string"; }; readonly igSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for Instagram chat."; }; readonly waSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for WhatsApp chat."; }; readonly tgSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for Telegram chat."; }; readonly vkSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for VK chat."; }; readonly email: { readonly type: "string"; readonly format: "email"; }; readonly leadSource: { readonly type: "string"; readonly enum: readonly [ "cian", "avito", "vk", "instagram", "whatsapp", "telegram", "max", "yandex", "website", "referral", "walk_in" ]; }; readonly budgetMin: { readonly type: "number"; readonly minimum: 0; }; readonly budgetMax: { readonly type: "number"; readonly minimum: 0; }; readonly fullPayment: { readonly type: "boolean"; }; readonly mortgagePayment: { readonly type: "boolean"; }; readonly installmentPayment: { readonly type: "boolean"; }; readonly fullPaymentAmount: { readonly type: "number"; readonly minimum: 0; }; readonly mortgagePaymentAmount: { readonly type: "number"; readonly minimum: 0; }; readonly installmentPaymentAmount: { readonly type: "number"; readonly minimum: 0; }; readonly minArea: { readonly type: "number"; readonly minimum: 0; }; readonly maxArea: { readonly type: "number"; readonly minimum: 0; }; readonly roomsCount: { readonly type: "integer"; readonly minimum: 0; }; readonly preferredDistricts: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly propertyType: { readonly type: "string"; }; readonly housingType: { readonly type: "string"; readonly description: "Housing type preference."; }; readonly housingTypeNew: { readonly type: "boolean"; readonly description: "Whether the customer is interested in newly built housing."; }; readonly housingTypeResale: { readonly type: "boolean"; readonly description: "Whether the customer is interested in resale housing."; }; readonly commercialType: { readonly type: "string"; }; readonly landType: { readonly type: "string"; }; readonly maxMetroDistance: { readonly type: "number"; readonly minimum: 0; }; readonly dealStatus: { readonly type: "string"; readonly enum: readonly [ "just_browsing", "serious_buyer", "mortgage_approved", "signed_contract", "closed_deal" ]; }; readonly preferredPaymentMethod: { readonly type: "string"; readonly enum: readonly [ "full_payment", "mortgage", "installment" ]; }; readonly childrenCount: { readonly type: "integer"; readonly minimum: 0; }; readonly hasPets: { readonly type: "boolean"; }; readonly carsCount: { readonly type: "integer"; readonly minimum: 0; }; readonly birthDate: { readonly type: "string"; readonly format: "date-time"; }; readonly notes: { readonly type: "string"; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Customer created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCustomerSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, write access to crm::customers, or billing capacity for customers."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/customers/update": { readonly post: { readonly tags: readonly [ "Customers" ]; readonly summary: "Update a customer"; readonly description: "Partially updates a category-specific customer in the specified workspace. Real-estate workspaces update only the provided lead fields on customer_real_estates. Requires workspace access, write access to crm::customers, and billing access for customers."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "customerId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the customer belongs."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer identifier to update."; }; readonly name: { readonly type: "string"; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "buyer", "seller", "tenant", "landlord", "investor", "agent" ]; }; readonly companyName: { readonly type: "string"; }; readonly phone: { readonly type: "string"; readonly description: "E.164 phone number."; }; readonly telegram: { readonly type: "string"; }; readonly whatsapp: { readonly type: "string"; }; readonly instagram: { readonly type: "string"; }; readonly vk: { readonly type: "string"; }; readonly igSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for Instagram chat."; }; readonly waSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for WhatsApp chat."; }; readonly tgSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for Telegram chat."; }; readonly vkSynapseId: { readonly type: "string"; readonly description: "Matrix (Synapse) user identifier for VK chat."; }; readonly email: { readonly type: "string"; readonly format: "email"; }; readonly leadSource: { readonly type: "string"; readonly enum: readonly [ "cian", "avito", "vk", "instagram", "whatsapp", "telegram", "max", "yandex", "website", "referral", "walk_in" ]; }; readonly budgetMin: { readonly type: "number"; readonly minimum: 0; }; readonly budgetMax: { readonly type: "number"; readonly minimum: 0; }; readonly fullPayment: { readonly type: "boolean"; }; readonly mortgagePayment: { readonly type: "boolean"; }; readonly installmentPayment: { readonly type: "boolean"; }; readonly fullPaymentAmount: { readonly type: "number"; readonly minimum: 0; }; readonly mortgagePaymentAmount: { readonly type: "number"; readonly minimum: 0; }; readonly installmentPaymentAmount: { readonly type: "number"; readonly minimum: 0; }; readonly minArea: { readonly type: "number"; readonly minimum: 0; }; readonly maxArea: { readonly type: "number"; readonly minimum: 0; }; readonly roomsCount: { readonly type: "integer"; readonly minimum: 0; }; readonly preferredDistricts: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly propertyType: { readonly type: "string"; }; readonly housingType: { readonly type: "string"; readonly description: "Housing type preference."; }; readonly housingTypeNew: { readonly type: "boolean"; readonly description: "Whether the customer is interested in newly built housing."; }; readonly housingTypeResale: { readonly type: "boolean"; readonly description: "Whether the customer is interested in resale housing."; }; readonly commercialType: { readonly type: "string"; }; readonly landType: { readonly type: "string"; }; readonly maxMetroDistance: { readonly type: "number"; readonly minimum: 0; }; readonly dealStatus: { readonly type: "string"; readonly enum: readonly [ "just_browsing", "serious_buyer", "mortgage_approved", "signed_contract", "closed_deal" ]; }; readonly preferredPaymentMethod: { readonly type: "string"; readonly enum: readonly [ "full_payment", "mortgage", "installment" ]; }; readonly childrenCount: { readonly type: "integer"; readonly minimum: 0; }; readonly hasPets: { readonly type: "boolean"; }; readonly carsCount: { readonly type: "integer"; readonly minimum: 0; }; readonly birthDate: { readonly type: "string"; readonly format: "date-time"; }; readonly notes: { readonly type: "string"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Customer updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpdateCustomerSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Customer or workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, write access to crm::customers, or billing access for customers."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/customers/get/{workspace}/{customerId}": { readonly get: { readonly tags: readonly [ "Customers" ]; readonly summary: "Get a customer by ID"; readonly description: "Returns a single customer by ID within the workspace. Real-estate workspaces read from customer_real_estates. Requires workspace access and read access to crm::customers resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "customerId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Customer identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Customer fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/GetCustomerSuccess"; }; }; }; }; readonly 400: { readonly description: "Unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Customer or workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/customers/list/{workspace}": { readonly get: { readonly tags: readonly [ "Customers" ]; readonly summary: "List customers in workspace"; readonly description: "Returns all customers in the specified workspace. Real-estate workspaces list leads from customer_real_estates. Requires workspace access and read access to crm::customers resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where customers belong."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Customers fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListCustomersSuccess"; }; }; }; }; readonly 400: { readonly description: "Unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/customers/delete": { readonly post: { readonly tags: readonly [ "Customers" ]; readonly summary: "Delete a customer"; readonly description: "Deletes a customer in the specified workspace. Real-estate workspaces remove the lead from customer_real_estates, along with that customer's invoices, history, and finance transactions (including receipt files). Requires workspace access and write access to crm::customers resource. This deletion remains available for a frozen Free-trial workspace so it can reduce usage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "customerId", "workspace" ]; readonly properties: { readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Customer deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Customer or workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/customers/get-tasks/{workspace}/{customerId}": { readonly get: { readonly tags: readonly [ "Customers" ]; readonly summary: "List tasks for a customer"; readonly description: "Returns tasks linked to the specified customer in the workspace. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "customerId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Customer identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Tasks fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListTasksSuccess"; }; }; }; }; readonly 400: { readonly description: "Unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Customer or workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/services/create": { readonly post: { readonly tags: readonly [ "Services" ]; readonly summary: "Create a new service"; readonly description: "Creates a category-specific service in the specified workspace. Real-estate workspaces persist a listing on service_real_estates. Requires workspace access, write access to crm::services, and billing capacity for services."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "title" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the service is created."; }; readonly title: { readonly type: "string"; readonly description: "Listing title."; }; readonly active: { readonly type: "boolean"; readonly description: "Whether the listing is active. Defaults to true when omitted."; }; readonly type: { readonly type: "string"; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "USD", "EUR", "RUB" ]; }; readonly description: { readonly type: "string"; }; readonly price: { readonly type: "number"; }; readonly propertyType: { readonly type: "string"; }; readonly propertyStatus: { readonly type: "string"; }; readonly commercialType: { readonly type: "string"; }; readonly commercialClass: { readonly type: "string"; }; readonly landType: { readonly type: "string"; }; readonly ownershipType: { readonly type: "string"; }; readonly loadingDockAccess: { readonly type: "boolean"; }; readonly waterAccess: { readonly type: "boolean"; }; readonly electricityAccess: { readonly type: "boolean"; }; readonly gasAccess: { readonly type: "boolean"; }; readonly sewageAccess: { readonly type: "boolean"; }; readonly internetAccess: { readonly type: "boolean"; }; readonly elevaorAccess: { readonly type: "boolean"; }; readonly seprateEntrance: { readonly type: "boolean"; }; readonly furnishedType: { readonly type: "string"; }; readonly parkingType: { readonly type: "string"; }; readonly balconyAccess: { readonly type: "boolean"; }; readonly loggiaAccess: { readonly type: "boolean"; }; readonly otherFeatures: { readonly type: "string"; }; readonly fullPayment: { readonly type: "boolean"; }; readonly mortgagePayment: { readonly type: "boolean"; }; readonly installmentPayment: { readonly type: "boolean"; }; readonly fullPaymentAmount: { readonly type: "number"; }; readonly mortgagePaymentAmount: { readonly type: "number"; }; readonly installmentPaymentAmount: { readonly type: "number"; }; readonly pricePerSquareMeter: { readonly type: "number"; }; readonly alternativeEURCurrency: { readonly type: "boolean"; }; readonly alternativeRUBCurrency: { readonly type: "boolean"; }; readonly alternativeUSDCurrency: { readonly type: "boolean"; }; readonly estimatedDeliveryDate: { readonly type: "string"; readonly format: "date-time"; }; readonly roomsCount: { readonly type: "number"; }; readonly bathroomsCount: { readonly type: "number"; }; readonly bedroomsCount: { readonly type: "number"; }; readonly totalArea: { readonly type: "number"; }; readonly livingArea: { readonly type: "number"; }; readonly ceilingHeight: { readonly type: "number"; }; readonly floor: { readonly type: "number"; }; readonly totalFloors: { readonly type: "number"; }; readonly yearBuilt: { readonly type: "string"; readonly format: "date-time"; }; readonly renovation: { readonly type: "string"; }; readonly developerName: { readonly type: "string"; }; readonly city: { readonly type: "string"; }; readonly district: { readonly type: "string"; }; readonly nearestMetroStation: { readonly type: "string"; }; readonly fullAddress: { readonly type: "string"; }; readonly latitude: { readonly type: "number"; }; readonly longitude: { readonly type: "number"; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Service created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateServiceSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/services/update": { readonly post: { readonly tags: readonly [ "Services" ]; readonly summary: "Update a service"; readonly description: "Partially updates a category-specific service in the specified workspace. Real-estate workspaces update only the provided listing fields on service_real_estates. Requires workspace access, write access to crm::services, and billing access for services."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "serviceId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the service belongs."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service identifier to update."; }; readonly title: { readonly type: "string"; readonly description: "Listing title."; }; readonly active: { readonly type: "boolean"; readonly description: "Whether the listing is active."; }; readonly type: { readonly type: "string"; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "USD", "EUR", "RUB" ]; }; readonly description: { readonly type: "string"; }; readonly price: { readonly type: "number"; }; readonly propertyType: { readonly type: "string"; }; readonly propertyStatus: { readonly type: "string"; }; readonly commercialType: { readonly type: "string"; }; readonly commercialClass: { readonly type: "string"; }; readonly landType: { readonly type: "string"; }; readonly ownershipType: { readonly type: "string"; }; readonly loadingDockAccess: { readonly type: "boolean"; }; readonly waterAccess: { readonly type: "boolean"; }; readonly electricityAccess: { readonly type: "boolean"; }; readonly gasAccess: { readonly type: "boolean"; }; readonly sewageAccess: { readonly type: "boolean"; }; readonly internetAccess: { readonly type: "boolean"; }; readonly elevaorAccess: { readonly type: "boolean"; }; readonly seprateEntrance: { readonly type: "boolean"; }; readonly furnishedType: { readonly type: "string"; }; readonly parkingType: { readonly type: "string"; }; readonly balconyAccess: { readonly type: "boolean"; }; readonly loggiaAccess: { readonly type: "boolean"; }; readonly otherFeatures: { readonly type: "string"; }; readonly fullPayment: { readonly type: "boolean"; }; readonly mortgagePayment: { readonly type: "boolean"; }; readonly installmentPayment: { readonly type: "boolean"; }; readonly fullPaymentAmount: { readonly type: "number"; }; readonly mortgagePaymentAmount: { readonly type: "number"; }; readonly installmentPaymentAmount: { readonly type: "number"; }; readonly pricePerSquareMeter: { readonly type: "number"; }; readonly alternativeEURCurrency: { readonly type: "boolean"; }; readonly alternativeRUBCurrency: { readonly type: "boolean"; }; readonly alternativeUSDCurrency: { readonly type: "boolean"; }; readonly estimatedDeliveryDate: { readonly type: "string"; readonly format: "date-time"; }; readonly roomsCount: { readonly type: "number"; }; readonly bathroomsCount: { readonly type: "number"; }; readonly bedroomsCount: { readonly type: "number"; }; readonly totalArea: { readonly type: "number"; }; readonly livingArea: { readonly type: "number"; }; readonly ceilingHeight: { readonly type: "number"; }; readonly floor: { readonly type: "number"; }; readonly totalFloors: { readonly type: "number"; }; readonly yearBuilt: { readonly type: "string"; readonly format: "date-time"; }; readonly renovation: { readonly type: "string"; }; readonly developerName: { readonly type: "string"; }; readonly city: { readonly type: "string"; }; readonly district: { readonly type: "string"; }; readonly nearestMetroStation: { readonly type: "string"; }; readonly fullAddress: { readonly type: "string"; }; readonly latitude: { readonly type: "number"; }; readonly longitude: { readonly type: "number"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Service updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpdateServiceSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/services/get/{workspace}/{serviceId}": { readonly get: { readonly tags: readonly [ "Services" ]; readonly summary: "Get a service by ID"; readonly description: "Returns a single service by ID within the workspace. Requires workspace access and read access to crm::services resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "serviceId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Service identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Service fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/GetServiceSuccess"; }; }; }; }; readonly 404: { readonly description: "Service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/services/list/{workspace}": { readonly get: { readonly tags: readonly [ "Services" ]; readonly summary: "List services in workspace"; readonly description: "Returns all services in the specified workspace. Requires workspace access and read access to crm::services resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where services belong."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Services fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListServicesSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/services/delete": { readonly post: { readonly tags: readonly [ "Services" ]; readonly summary: "Delete a service"; readonly description: "Deletes a service in the specified workspace. Requires workspace access and write access to crm::services resource. This deletion remains available for a frozen Free-trial workspace so it can reduce usage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "serviceId", "workspace" ]; readonly properties: { readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Service deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/assignees/create": { readonly post: { readonly tags: readonly [ "Assignees" ]; readonly summary: "Add assignee to task"; readonly description: "Assigns a collaborator to a task in the specified workspace. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "taskId", "workspace" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Collaborator to assign to the task."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to assign to."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; readonly startDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Optional start date for the assignment. When both startDate and endDate are provided, startDate must be before endDate."; }; readonly endDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Optional end date for the assignment. When both startDate and endDate are provided, startDate must be before endDate."; }; readonly description: { readonly type: "string"; readonly description: "Optional assignment description."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Assignee created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateAssigneeSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Collaborator not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/assignees/list/{workspace}": { readonly get: { readonly tags: readonly [ "Assignees" ]; readonly summary: "List collaborators in workspace"; readonly description: "Returns all collaborators in the specified workspace. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where collaborators belong."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Collaborators fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListAssigneesByWorkspaceSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/assignees/list/{workspace}/{taskId}": { readonly get: { readonly tags: readonly [ "Assignees" ]; readonly summary: "List assignees for a task"; readonly description: "Returns all assignees for a task in the specified workspace. Requires workspace access and read access to crm::tasks resource."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly description: "Workspace identifier where the task belongs."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "taskId"; readonly in: "path"; readonly required: true; readonly description: "Task identifier to retrieve assignees for."; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Assignees fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListAssigneesByTaskSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/assignees/remove": { readonly post: { readonly tags: readonly [ "Assignees" ]; readonly summary: "Remove assignee from task"; readonly description: "Removes an assignee from a task in the specified workspace. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "collaboratorId", "taskId", "workspace" ]; readonly properties: { readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Collaborator identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier where the assignee belongs."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Assignee removed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Collaborator not found or assignee not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/assignees/update": { readonly post: { readonly tags: readonly [ "Assignees" ]; readonly summary: "Update assignee for task"; readonly description: "Updates an existing assignee for a task in the specified workspace. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "collaboratorId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the task belongs."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier to update the assignee for."; }; readonly collaboratorId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Collaborator identifier linked to the assignee."; }; readonly startDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Optional start date for the assignment. When both startDate and endDate are provided, startDate must be before endDate."; }; readonly endDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Optional end date for the assignment. When both startDate and endDate are provided, startDate must be before endDate."; }; readonly description: { readonly type: "string"; readonly description: "Optional assignment description."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Assignee updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpdateAssigneeSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Collaborator not found or assignee not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/task-phase-funnel": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate task-phase funnel and durations"; readonly description: "Returns the current task funnel and time-in-phase analytics for a real-estate workspace. taskCount is the number of tasks currently in each phase; when supplied, from and to limit it to tasks created in that period. visitCount and duration averages use phase entries recorded in the period. Active phase visits are measured through now, or through to when supplied. Tracking begins when this API version is deployed, so tasks that have not changed phase since then have no duration sample. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include phase entries and tasks created at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include phase entries and tasks created before this timestamp; active durations are measured through this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Task-phase funnel fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/TaskPhaseFunnelAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/total-revenue": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get total paid customer-invoice revenue"; readonly description: "Returns paid CInvoice revenue for a real-estate workspace, grouped by currency. Optional from and to timestamps filter the server-set paidAt field (from inclusive, to exclusive). When both bounds are supplied, each total is compared with the immediately previous period of the same duration (for 10 Sep \u2192 20 Sep, the previous window is 31 Aug \u2192 10 Sep exclusive). Growth is ((current \u2212 previous) / previous) \u00D7 100 with direction positive, negative, or none. Each total is calculated as unitPrice \u00D7 unitQuantity \u2212 discount in minor units and excludes VAT. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include invoices paid at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include invoices paid before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Paid revenue totals fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/PaidRevenueAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace ID or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/leads-by-source": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate leads by acquisition source"; readonly description: "Returns real-estate leads grouped by their recorded acquisition source. Optional from and to timestamps filter lead creation time (from inclusive, to exclusive). Leads with no recorded source are grouped as unattributed. Soft-deleted leads are excluded. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include leads created at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include leads created before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Lead totals by source fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/LeadSourceAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/channel-performance": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate channel performance"; readonly description: "Returns paid and pending CInvoice revenue grouped by the linked customer's acquisition source and invoice currency. Paid invoices are filtered by paidAt; pending invoices are filtered by invoice date; both period bounds are from inclusive and to exclusive. Amounts are post-discount minor units and exclude VAT. Customers without a recorded source are grouped as unattributed. Soft-deleted invoices and customers, plus cancelled and refunded invoices, are excluded. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include pending invoices dated and paid invoices paid at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include pending invoices dated and paid invoices paid before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Channel performance fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ChannelPerformanceAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/conversion-rate": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate conversion rate"; readonly description: "Returns the conversion rate for a real-estate workspace: paid CInvoices divided by non-deleted real-estate customers, multiplied by 100. Optional from and to timestamps filter invoices by paidAt and customers by created_at (from inclusive, to exclusive). The rate is zero when no customers match. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include invoices paid and customers created at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include invoices paid and customers created before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Conversion rate fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConversionRateAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/employee-conversion-rate": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate employee conversion rates"; readonly description: "Returns a customer-level conversion rate for each active or inactive collaborator with at least one qualifying task linked to a non-deleted real-estate customer. Assigned customers are distinct customers on the collaborator's tasks created within the optional period. A converted customer has at least one non-deleted paid CInvoice in the period. When several collaborators worked on the same customer, each receives full credit; multiple tasks or invoices for that customer do not increase counts. The rate is zero when a returned collaborator has no assigned customers after filtering. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include tasks created and CInvoices paid at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include tasks created and CInvoices paid before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Employee conversion rates fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/EmployeeConversionRateAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/workload-distribution": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate workload distribution"; readonly description: "Returns every workspace collaborator with their distinct assigned-task count, ordered from highest to lowest workload. Tasks are filtered by creation time when a reporting period is supplied (from inclusive, to exclusive). A task assigned to several collaborators contributes once to each assignee's workload. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include tasks created at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include tasks created before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Workload distribution fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/WorkloadDistributionAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/analytics/{workspace}/forecast-revenue": { readonly get: { readonly tags: readonly [ "Analytics" ]; readonly summary: "Get real-estate forecast revenue"; readonly description: "Returns forecast revenue for a real-estate workspace, grouped by currency. Pending CInvoices are filtered by their invoice date; paid invoices are filtered by paidAt; and leads are filtered by creation time (from inclusive, to exclusive). Projected pipeline revenue is leads in the period \u00D7 (paid invoices \u00F7 leads) \u00D7 average paid invoice size. Forecast revenue is pending revenue plus projected pipeline revenue. Amounts are post-discount minor units and exclude VAT. Requires workspace access and read access to crm::analytics. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "from"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include pending invoices dated, paid invoices paid, and leads created at or after this timestamp."; }, { readonly name: "to"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Include pending invoices dated, paid invoices paid, and leads created before this timestamp."; } ]; readonly responses: { readonly 200: { readonly description: "Forecast revenue fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ForecastRevenueAnalysisSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query, invalid workspace ID, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::analytics resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/cinvoices/create": { readonly post: { readonly tags: readonly [ "CInvoices" ]; readonly summary: "Create a customer invoice"; readonly description: "Creates a customer invoice in the specified workspace. Real-estate workspaces require an existing seller finance account, customer_real_estates lead, and service_real_estates listing in the same workspace. created_by is taken from the access token. When status is paid, an income finance transaction is recorded on the seller account for unitPrice \u00D7 unitQuantity \u2212 discount (minor units converted to major units). Requires workspace access and write access to crm::customers. Other workspace categories return 400."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "invoiceId", "serviceId", "SellerFinanceAccountId", "customerId", "date", "language", "currency", "vatOption", "unitName", "unitPrice", "unitQuantity" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier where the invoice is created."; }; readonly invoiceId: { readonly type: "string"; readonly description: "User-facing invoice number."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate service identifier."; }; readonly SellerFinanceAccountId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Seller finance account identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate customer identifier."; }; readonly date: { readonly type: "string"; readonly format: "date-time"; readonly description: "Invoice date."; }; readonly language: { readonly type: "string"; readonly enum: readonly [ "ru", "en" ]; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "RUB", "USD", "EUR" ]; }; readonly vatOption: { readonly type: "string"; readonly enum: readonly [ "vat_included", "vat_excluded" ]; }; readonly vatRate: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; readonly description: "VAT rate (0-100)."; }; readonly status: { readonly type: "string"; readonly enum: readonly [ "pending", "paid", "canceled", "refunded" ]; readonly description: "Invoice payment status. Defaults to pending."; }; readonly buyerInn: { readonly type: "string"; readonly description: "Buyer INN (tax ID)."; }; readonly buyerKpp: { readonly type: "string"; readonly description: "Buyer KPP."; }; readonly unitName: { readonly type: "string"; readonly description: "Line-item name."; }; readonly unitPrice: { readonly type: "integer"; readonly minimum: 0; readonly description: "Unit price in the invoice currency's minor units."; }; readonly unitQuantity: { readonly type: "integer"; readonly minimum: 1; }; readonly notes: { readonly type: "string"; }; readonly discount: { readonly type: "integer"; readonly minimum: 0; }; readonly fullPayment: { readonly type: "boolean"; readonly description: "Whether the invoice is paid in full. Defaults to false."; }; readonly installment: { readonly type: "boolean"; readonly description: "Whether the invoice is paid in installments. Defaults to false."; }; readonly subscription: { readonly type: "boolean"; readonly description: "Whether the invoice represents a subscription. Defaults to false."; }; readonly subscriptionStartDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Subscription period start."; }; readonly subscriptionEndDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Subscription period end."; }; readonly paymentMethod: { readonly type: "string"; readonly maxLength: 50; readonly description: "How the invoice is paid. Copied onto the income finance transaction when status is paid."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Invoice created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCInvoiceSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, billing, customer, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/cinvoices/accounts/list/{workspace}": { readonly get: { readonly tags: readonly [ "CInvoices" ]; readonly summary: "List finance accounts for invoice seller selection"; readonly description: "Returns workspace finance accounts for choosing SellerFinanceAccountId when creating or updating a customer invoice. Requires workspace access and read access to crm::customers, not crm::finance. Includes company and bank details, but omits openingBalance."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Accounts fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListCInvoiceFinanceAccountsSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/cinvoices/list/{workspace}/{customerId}": { readonly get: { readonly tags: readonly [ "CInvoices" ]; readonly summary: "List a real-estate customer's invoices"; readonly description: "Returns all invoices for a customer_real_estates lead in the specified real-estate workspace. Requires workspace access and read access to crm::customers."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "customerId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Real-estate customer identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Invoices fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListCInvoicesSuccess"; }; }; }; }; readonly 400: { readonly description: "Unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or customer not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/cinvoices/update": { readonly post: { readonly tags: readonly [ "CInvoices" ]; readonly summary: "Update a customer invoice"; readonly description: "Updates specified fields of an invoice in a real-estate workspace. Any replacement seller finance account, customer, or service must belong to the workspace. When status changes to paid, an income finance transaction is recorded on the seller account for unitPrice \u00D7 unitQuantity \u2212 discount (minor units converted to major units). Requires workspace access and write access to crm::customers."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "cinvoiceId", "workspace" ]; readonly properties: { readonly cinvoiceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Invoice identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly invoiceId: { readonly type: "string"; readonly description: "User-facing invoice number."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Replacement real-estate service identifier."; }; readonly SellerFinanceAccountId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Replacement seller finance account identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Replacement real-estate customer identifier."; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; readonly language: { readonly type: "string"; readonly enum: readonly [ "ru", "en" ]; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "RUB", "USD", "EUR" ]; }; readonly vatOption: { readonly type: "string"; readonly enum: readonly [ "vat_included", "vat_excluded" ]; }; readonly vatRate: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; }; readonly status: { readonly type: "string"; readonly enum: readonly [ "pending", "paid", "canceled", "refunded" ]; }; readonly buyerInn: { readonly type: "string"; }; readonly buyerKpp: { readonly type: "string"; }; readonly unitName: { readonly type: "string"; }; readonly unitPrice: { readonly type: "integer"; readonly minimum: 0; }; readonly unitQuantity: { readonly type: "integer"; readonly minimum: 1; }; readonly notes: { readonly type: "string"; }; readonly discount: { readonly type: "integer"; readonly minimum: 0; }; readonly fullPayment: { readonly type: "boolean"; readonly description: "Whether the invoice is paid in full."; }; readonly installment: { readonly type: "boolean"; readonly description: "Whether the invoice is paid in installments."; }; readonly subscription: { readonly type: "boolean"; readonly description: "Whether the invoice represents a subscription."; }; readonly subscriptionStartDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Subscription period start."; }; readonly subscriptionEndDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "Subscription period end."; }; readonly paymentMethod: { readonly type: "string"; readonly maxLength: 50; readonly description: "How the invoice is paid. Copied onto the income finance transaction when status changes to paid."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Invoice updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpdateCInvoiceSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, invoice, billing, customer, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/cinvoices/delete": { readonly post: { readonly tags: readonly [ "CInvoices" ]; readonly summary: "Delete a customer invoice"; readonly description: "Deletes an invoice from a real-estate workspace. Requires workspace access and write access to crm::customers."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "cinvoiceId", "workspace" ]; readonly properties: { readonly cinvoiceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Invoice identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Invoice deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or invoice not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/chistory/create": { readonly post: { readonly tags: readonly [ "Customer History" ]; readonly summary: "Create a customer history entry"; readonly description: "Records a service-history entry for a real-estate customer. The customer and service must exist in the specified workspace. created_by is taken from the access token. Requires workspace access and write access to crm::customers."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "customerId", "serviceId", "date" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate customer identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Real-estate service identifier."; }; readonly notes: { readonly type: "string"; readonly maxLength: 256; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "History entry created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateCHistorySuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::customers."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, customer, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/chistory/list/{workspace}/{customerId}": { readonly get: { readonly tags: readonly [ "Customer History" ]; readonly summary: "List a customer's service history"; readonly description: "Returns all service-history entries for a real-estate customer in the specified workspace. Requires workspace access and read access to crm::customers."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "customerId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Real-estate customer identifier."; } ]; readonly responses: { readonly 200: { readonly description: "History entries fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListCHistorySuccess"; }; }; }; }; readonly 400: { readonly description: "Unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or read access to crm::customers."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or customer not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/chistory/update": { readonly post: { readonly tags: readonly [ "Customer History" ]; readonly summary: "Update a customer history entry"; readonly description: "Updates specified fields of a customer service-history entry in a real-estate workspace. Any replacement customer or service must belong to the workspace. Requires workspace access and write access to crm::customers."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "chistoryId", "workspace" ]; readonly properties: { readonly chistoryId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer history entry identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Replacement real-estate customer identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Replacement real-estate service identifier."; }; readonly notes: { readonly type: "string"; readonly maxLength: 256; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "History entry updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UpdateCHistorySuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::customers."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, history entry, customer, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/chistory/delete": { readonly post: { readonly tags: readonly [ "Customer History" ]; readonly summary: "Delete a customer history entry"; readonly description: "Deletes a customer service-history entry from a real-estate workspace. Requires workspace access and write access to crm::customers."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "chistoryId", "workspace" ]; readonly properties: { readonly chistoryId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer history entry identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "History entry deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::customers."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or history entry not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/list/{workspace}": { readonly get: { readonly tags: readonly [ "Tags" ]; readonly summary: "List tags by workspace"; readonly description: "Returns all tags for the given workspace. Requires workspace access and read access to crm::tasks, crm::customers, or crm::services."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Tags fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListTagsSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks, crm::customers, and crm::services."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/create": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Create a tag"; readonly description: "Creates a tag in the specified workspace. Requires workspace access and write access to crm::tasks, crm::customers, or crm::services."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "name" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly name: { readonly type: "string"; readonly description: "Tag label."; }; readonly description: { readonly type: "string"; readonly description: "Optional tag description."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Tag created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateTagSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks, crm::customers, and crm::services."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/update": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Update a tag"; readonly description: "Updates a tag's name and/or description. Requires workspace access and write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "tagId", "workspace" ]; readonly properties: { readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly name: { readonly type: "string"; readonly description: "Updated tag label."; }; readonly description: { readonly type: "string"; readonly description: "Updated tag description."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/TagUpdateSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/delete": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Delete a tag"; readonly description: "Removes the tag from all linked tasks, customers, and services, then deletes it from the workspace. Requires workspace access and write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "tagId", "workspace" ]; readonly properties: { readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Tag not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/assign-to-task": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Assign a tag to a task"; readonly description: "Links an existing workspace tag to a task. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "tagId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier."; }; readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag assigned to task successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Tag or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/assign-to-customer": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Assign a tag to a customer"; readonly description: "Links an existing workspace tag to a category-specific customer. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::customers resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "customerId", "tagId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer identifier."; }; readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag assigned to customer successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, tag, or customer not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/remove-from-customer": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Remove a tag from a customer"; readonly description: "Unlinks a tag from a category-specific customer. Real-estate workspaces resolve the customer from customer_real_estates. Requires workspace access and write access to crm::customers resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "customerId", "tagId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Customer identifier."; }; readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag removed from customer successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::customers resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, tag, or customer not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/assign-to-service": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Assign a tag to a service"; readonly description: "Links an existing workspace tag to a category-specific service. Real-estate workspaces resolve the service from service_real_estates. Requires workspace access and write access to crm::services resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "serviceId", "tagId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service identifier."; }; readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag assigned to service successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, tag, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/remove-from-service": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Remove a tag from a service"; readonly description: "Unlinks a tag from a category-specific service. Requires workspace access and write access to crm::services resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "serviceId", "tagId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Service identifier."; }; readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag removed from service successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::services resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, tag, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/tags/remove-from-task": { readonly post: { readonly tags: readonly [ "Tags" ]; readonly summary: "Remove a tag from a task"; readonly description: "Unlinks a tag from a task. Requires workspace access and write access to crm::tasks resource."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "tagId" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier."; }; readonly tagId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Tag identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Tag removed from task successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks resource."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Tag or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/list/{workspace}": { readonly get: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "List failure reasons by workspace"; readonly description: "Returns all failure reasons for the given workspace. Requires workspace access and read access to crm::tasks."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Failure reasons fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFailureReasonsSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/get/{workspace}/{failureReasonId}": { readonly get: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "Get a failure reason"; readonly description: "Returns a single failure reason by id. Requires workspace access and read access to crm::tasks."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "failureReasonId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Failure reason identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Failure reason fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FailureReasonSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Failure reason not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/create": { readonly post: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "Create a failure reason"; readonly description: "Creates a failure reason in the specified workspace. Requires workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "title" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly title: { readonly type: "string"; readonly maxLength: 256; readonly description: "Failure reason title."; }; readonly description: { readonly type: "string"; readonly maxLength: 256; readonly description: "Optional failure reason description."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Failure reason created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FailureReasonSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "A failure reason with this title already exists."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/update": { readonly post: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "Update a failure reason"; readonly description: "Updates a failure reason's title and/or description. Requires workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "failureReasonId", "workspace" ]; readonly properties: { readonly failureReasonId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Failure reason identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly title: { readonly type: "string"; readonly maxLength: 256; readonly description: "Updated failure reason title."; }; readonly description: { readonly type: "string"; readonly maxLength: 256; readonly description: "Updated failure reason description."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Failure reason updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FailureReasonSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Failure reason not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "A failure reason with this title already exists."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/delete": { readonly post: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "Delete a failure reason"; readonly description: "Deletes a failure reason from the workspace. Requires workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "failureReasonId", "workspace" ]; readonly properties: { readonly failureReasonId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Failure reason identifier."; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Failure reason deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Failure reason not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/list/{workspace}/{taskId}": { readonly get: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "List failure reasons on a task"; readonly description: "Returns failure reasons linked to the given task. Requires workspace access and read access to crm::tasks."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "taskId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Task identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Task failure reasons fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFailureReasonsSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or read access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/assign-to-task": { readonly post: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "Assign failure reasons to a task"; readonly description: "Links existing workspace failure reasons to a task. Already-linked reasons are ignored. Requires workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "failureReasonIds" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier."; }; readonly failureReasonIds: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Failure reason identifiers."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Failure reason assigned to task successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Failure reason or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/freason/remove-from-task": { readonly post: { readonly tags: readonly [ "Failure Reasons" ]; readonly summary: "Remove failure reasons from a task"; readonly description: "Unlinks existing workspace failure reasons from a task. Requires workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "taskId", "failureReasonIds" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier."; }; readonly taskId: { readonly type: "string"; readonly format: "uuid"; readonly description: "Task identifier."; }; readonly failureReasonIds: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Failure reason identifiers."; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Failure reason removed from task successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access or write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Failure reason or task not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/upload": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned S3 upload"; readonly description: "Returns a presigned POST URL and form fields for uploading a file to S3 (max 15 MB, 5-minute expiry). Root object key is `{workspace}/{filename}.tmp`. With optional `folder`, key is `{workspace}/folders/{folder}/{filename}.tmp` and the folder marker must already exist. Only JPEG, PNG, WebP, and PDF content types are accepted. After the multipart upload succeeds, call `/files/confirm` with the same `filename` and `folder` to validate magic bytes and promote the object. Temporary objects are excluded from list results. Requires active workspace access and write access to crm::files."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/PresignedUploadSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported content type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or destination folder not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm and promote a temporary upload"; readonly description: "Reads the temporary object (root or under `folders/{folder}/`), verifies size (<= 15 MB) and real file type (JPEG, PNG, WebP, or PDF), promotes it to the final key, and deletes the temporary object. On failure, the temporary object is deleted. Requires workspace access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "File confirmed and promoted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Temporary object missing, file too large, invalid file type, or processing failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or destination folder not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/create-folder": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create an empty S3 folder"; readonly description: "Creates an empty folder marker in S3 at `{workspace}/folders/{name}/`. `name` may be nested (e.g. `contracts/2026`). Requires workspace access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateFolderRequest"; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Folder created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateFolderSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete-folder": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete an S3 folder and its contents"; readonly description: "Deletes all objects under `{workspace}/folders/{name}/` in paginated batches. `name` may be nested. Requires workspace access and file write access. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/CreateFolderRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Folder and all objects under its prefix deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFolderSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/list/{workspace}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "List workspace files"; readonly description: "Lists up to 50 S3 objects under the workspace prefix. Temporary uploads ending in `.tmp` are excluded. Each item includes `pin` from S3 object user metadata. Requires workspace access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Files listed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFilesSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/usage/{workspace}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "Get workspace storage usage"; readonly description: "Returns finalized storage usage broken down by workspace files (`filesBytes`), comment attachments (`commentsBytes`), customer files (`customerBytes`), service files (`servicesBytes`), and finance receipts (`financeBytes`), plus the combined total and plan limit. Temporary `.tmp` objects are excluded. Requires workspace access and read access to crm::files."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Storage usage returned."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/StorageUsageSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/download/{workspace}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "Get presigned download URL"; readonly description: "Returns a presigned GET URL for `{workspace}/{path}` (5-minute expiry). Pass the workspace-relative path as the `path` query parameter (root leaf or `folders/...`). Requires workspace access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "path"; readonly in: "query"; readonly required: true; readonly schema: { readonly $ref: "#/components/schemas/WorkspaceRelativeFilePath"; }; readonly description: "Workspace-relative file path after the workspace prefix."; } ]; readonly responses: { readonly 200: { readonly description: "Download URL created."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DownloadFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id or file path."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/pin": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Pin or unpin a file"; readonly description: "Sets S3 object user metadata `pin` to `true` or `false` on `{workspace}/{path}` via copy-in-place with MetadataDirective REPLACE. Requires workspace access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/PinFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Pin metadata updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/PinFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete a file by workspace-relative path"; readonly description: "Deletes the S3 object at `{workspace}/{path}`. Verifies the object exists before deletion and confirms removal afterward. Requires workspace access and file write access. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "File deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "File or workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; readonly 500: { readonly description: "Delete failed (object still present after delete)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; }; }; }; readonly "/files/move": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Move a file within a workspace"; readonly description: "Copies `{workspace}/{from}` to `{workspace}/{to}` (preserving content type and metadata including pin), then deletes the source. Destination must not already exist (409). If `to` is under `folders/`, the parent folder marker must exist. Requires workspace access and write access to crm::files."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/MoveFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "File moved successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/MoveFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Source file, destination folder, or workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 409: { readonly description: "Destination already exists."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/upload-to-comment": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned upload for a comment attachment"; readonly description: "Returns a presigned POST URL and form fields for uploading a file attached to a task comment. Object key is `{workspace}_comments/{taskId}/{commentId}/{filename}.tmp` (max 15 MB, 5-minute expiry). Accepts JPEG, PNG, WebP, and PDF. After upload, call `/files/confirm-comment-file` to validate magic bytes and promote the object. Verifies the task and comment belong to the workspace. Requires active workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToCommentRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned comment upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToCommentSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported content type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, task, or comment not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm-comment-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm a comment attachment upload"; readonly description: "Reads the temporary object at `{workspace}_comments/{taskId}/{commentId}/{filename}.tmp`, verifies size (<= 15 MB) and real file type (JPEG, PNG, WebP, or PDF), promotes it to `{workspace}_comments/{taskId}/{commentId}/{filename}`, and deletes the temporary object. Verifies the task and comment belong to the workspace. Requires active workspace access and write access to crm::tasks."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmCommentFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Comment file confirmed and promoted."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, missing temp object, oversized file, or invalid file type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - Invite not accepted, user lacks workspace access, or user lacks write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace, task, or comment not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/upload-to-service": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned upload for a service file"; readonly description: "Returns a presigned POST URL and form fields for uploading a file attached to a CRM service. Object key is `{workspace}_services/{serviceId}/{filename}.tmp` (max 15 MB, 5-minute expiry). Accepts JPEG, PNG, WebP, and PDF. After upload, call `/files/confirm-service-file` to validate magic bytes and promote the object. Currently supported for real-estate workspaces; verifies the service belongs to the workspace. Requires active workspace access, write access to crm::services, and an active billing grant."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToServiceRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned service upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToServiceSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, unsupported content type, or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, user lacks write access to crm::services, or billing access is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace or real-estate service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm-service-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm a service file upload"; readonly description: "Reads the temporary object at `{workspace}_services/{serviceId}/{filename}.tmp`, verifies size (<= 15 MB) and real file type (JPEG, PNG, WebP, or PDF), promotes it to `{workspace}_services/{serviceId}/{filename}`, and deletes the temporary object. Confirmed bytes count toward workspace storage usage (`servicesBytes`). Requires active workspace access, write access to crm::services, and an active billing grant."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmServiceFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Service file confirmed and promoted."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload, missing temp object, oversized file, or invalid file type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - Invite not accepted, user lacks workspace access, user lacks write access to crm::services, or billing access is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/download-from-service/{workspace}/{serviceId}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "List files for a service"; readonly description: "Lists all objects under `{workspace}_services/{serviceId}/` (excluding `.tmp` keys) and returns each with a 5-minute presigned download URL. Requires workspace access and read access to crm::services."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "serviceId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Service identifier whose files are listed."; } ]; readonly responses: { readonly 200: { readonly description: "Service files listed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListServiceFilesSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace or service id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::services."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete-service-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete a service file"; readonly description: "Deletes the S3 object at `{workspace}_services/{serviceId}/{filename}`. Verifies the object exists before deletion and confirms removal afterward. Requires workspace access and write access to crm::services. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteServiceFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Service file deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, user lacks write access to crm::services, or billing access is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "File not found at the given service file key."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; readonly 500: { readonly description: "Delete command ran but the object still exists."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; }; }; }; readonly "/files/upload-to-customer": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned upload for a customer file"; readonly description: "Returns a presigned POST for `{workspace}_customers/{customerId}/{filename}.tmp`. JPEG, PNG, WebP, and PDF files up to 15 MB are supported. The customer must belong to a real-estate workspace. Confirm the upload with `/files/confirm-customer-file`."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToCustomerRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned customer upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToCustomerSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid payload or unsupported workspace category."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Real-estate customer not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm-customer-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm a customer file upload"; readonly description: "Validates and promotes `{workspace}_customers/{customerId}/{filename}.tmp` to its finalized key. Confirmed bytes contribute to `customerBytes`."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmCustomerFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Customer file confirmed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request, missing temporary object, oversized file, or invalid file type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/download-from-customer/{workspace}/{customerId}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "List files for a customer"; readonly description: "Lists finalized objects under `{workspace}_customers/{customerId}/`, each with a 5-minute presigned download URL. Requires workspace access and read access to crm::customers."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "customerId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Customer identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Customer files listed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListCustomerFilesSuccess"; }; }; }; }; readonly 403: { readonly description: "Workspace or customer read access is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete-customer-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete a customer file"; readonly description: "Deletes `{workspace}_customers/{customerId}/{filename}`. Requires workspace access and write access to crm::customers. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteCustomerFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Customer file deleted."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileSuccess"; }; }; }; }; readonly 404: { readonly description: "File not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; }; }; }; readonly "/files/upload-to-finance": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned upload for a finance receipt"; readonly description: "Returns a presigned POST for `{workspace}_finance/{transactionId}/{filename}.tmp`. JPEG, PNG, WebP, and PDF files up to 15 MB are supported. The transaction must belong to the workspace. Confirm the upload with `/files/confirm-finance-file`. Requires crm::finance write access and an active billing grant."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToFinanceRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned finance upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadToFinanceSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Transaction not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm-finance-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm a finance receipt upload"; readonly description: "Validates and promotes `{workspace}_finance/{transactionId}/{filename}.tmp` to its finalized key. Confirmed bytes contribute to `financeBytes`."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFinanceFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Finance file confirmed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request, missing temporary object, oversized file, or invalid file type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Transaction not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/download-from-finance/{workspace}/{transactionId}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "List files for a finance transaction"; readonly description: "Lists finalized objects under `{workspace}_finance/{transactionId}/`, each with a 5-minute presigned download URL. Requires workspace access and read access to crm::finance."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "transactionId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Finance transaction identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Finance files listed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFinanceFilesSuccess"; }; }; }; }; readonly 403: { readonly description: "Workspace or finance read access is missing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Transaction not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete-finance-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete a finance receipt"; readonly description: "Deletes `{workspace}_finance/{transactionId}/{filename}`. Requires workspace access and write access to crm::finance. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFinanceFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Finance file deleted."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileSuccess"; }; }; }; }; readonly 404: { readonly description: "File or transaction not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; }; }; }; readonly "/files/delete-comment-file": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete a comment attachment"; readonly description: "Deletes the S3 object at `{workspace}_comments/{taskId}/{commentId}/{filename}`. Verifies the object exists before deletion and confirms removal afterward. Requires workspace access and write access to crm::tasks. This deletion remains available for a frozen Free-trial workspace so it can reduce storage before selecting a paid plan."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteCommentFileRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Comment file deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "File not found at the given comment attachment key."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; readonly 500: { readonly description: "Delete command ran but the object still exists."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteFileFailure"; }; }; }; }; }; }; }; readonly "/files/download-from-task/{workspace}/{taskId}": { readonly get: { readonly tags: readonly [ "Files" ]; readonly summary: "List comment files for a task"; readonly description: "Lists all comment attachment objects under `{workspace}_comments/{taskId}/` and returns each with a 5-minute presigned download URL. Requires workspace access and read access to crm::tasks."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; }, { readonly name: "taskId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Task identifier whose comment attachments are listed."; } ]; readonly responses: { readonly 200: { readonly description: "Task comment files listed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListTaskCommentFilesSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace or task id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks read access to crm::tasks."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/upload-profile-picture": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned upload for profile picture"; readonly description: "Returns a presigned POST URL and form fields for uploading a temporary profile picture to `profiles/clients/{userId}/temp` (max 0.5 MB, 5-minute expiry). Accepts JPEG and PNG. After the multipart upload succeeds, call `/files/confirm-profile-picture` to validate, optimize, and persist the image. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadProfilePictureRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned profile picture upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly allOf: readonly [ { readonly $ref: "#/components/schemas/PresignedUploadSuccess"; } ]; readonly description: "key is `profiles/clients/{userId}/temp`; maxSize is 524288 (0.5 MB)."; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported content type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm-profile-picture": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm and persist an uploaded profile picture"; readonly description: "Reads the temporary object at `profiles/clients/{userId}/temp`, verifies size (<= 0.5 MB) and real image type (JPEG, PNG, or WebP), resizes it to a 512x512 WebP avatar (cover fit, without enlargement, input pixel limit 4096x4096), stores it privately at `profiles/clients/{userId}/avatar.webp`, deletes the temporary object, creates a 7-day presigned GET URL for the avatar, and saves that URL on the user profile. On failure, the temporary object is deleted; the existing profile picture is left unchanged."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Profile picture confirmed and saved successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmProfilePictureSuccess"; }; }; }; }; readonly 400: { readonly description: "Temporary object missing, file too large, invalid image type, or processing failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete-profile-picture": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete the authenticated user's profile picture"; readonly description: "Deletes `profiles/clients/{userId}/avatar.webp` from S3 when present and clears the profile picture on the user. If the object is already missing, still clears the stored value and returns success with message `Profile picture already deleted`. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "Profile picture deleted, or already absent and cleared from the user profile."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteProfilePictureSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to delete the profile picture object."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/upload-workspace-picture": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Create presigned upload for workspace picture"; readonly description: "Returns a presigned POST URL and form fields for uploading a temporary workspace picture to `profiles/workspaces/{workspace}/temp` (max 0.5 MB, 5-minute expiry). Accepts JPEG and PNG. After the multipart upload succeeds, call `/files/confirm-workspace-picture` to validate, optimize, and persist the image. Requires workspace access and write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/UploadWorkspacePictureRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Presigned workspace picture upload created."; readonly content: { readonly "application/json": { readonly schema: { readonly allOf: readonly [ { readonly $ref: "#/components/schemas/PresignedUploadSuccess"; } ]; readonly description: "key is `profiles/workspaces/{workspace}/temp`; maxSize is 524288 (0.5 MB)."; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or unsupported content type."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/confirm-workspace-picture": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Confirm and persist an uploaded workspace picture"; readonly description: "Reads the temporary object at `profiles/workspaces/{workspace}/temp`, verifies size (<= 0.5 MB) and real image type (JPEG, PNG, or WebP), resizes it to a 512x512 WebP avatar (cover fit, without enlargement, input pixel limit 4096x4096), stores it privately at `profiles/workspaces/{workspace}/avatar.webp`, deletes the temporary object, creates a 7-day presigned GET URL for the avatar, and saves that URL on the workspace. On failure, the temporary object is deleted; the existing workspace picture is left unchanged. Requires workspace access and write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/WorkspacePictureWorkspaceRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Workspace picture confirmed and saved successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ConfirmWorkspacePictureSuccess"; }; }; }; }; readonly 400: { readonly description: "Temporary object missing, file too large, invalid image type, or processing failed."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/files/delete-workspace-picture": { readonly post: { readonly tags: readonly [ "Files" ]; readonly summary: "Delete a workspace picture"; readonly description: "Deletes `profiles/workspaces/{workspace}/avatar.webp` from S3 when present and clears the picture on the workspace. If the object is already missing, still clears the stored value and returns success with message `Workspace picture already deleted`. Requires workspace access and write access to crm::general."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/WorkspacePictureWorkspaceRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Workspace picture deleted, or already absent and cleared from the workspace."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/DeleteWorkspacePictureSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - User lacks workspace access, or user lacks write access to crm::general."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to delete the workspace picture object."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/notifications/sync": { readonly get: { readonly tags: readonly [ "Notifications" ]; readonly summary: "Sync notifications incrementally"; readonly description: "Returns the authenticated user's notifications created or updated after the given `cursor` (change timestamp = greatest of created_at/updated_at), ordered oldest change first. Without a cursor, returns notifications from the beginning. Responses are paged by `limit`; when `hasMore` is true, call again with the returned cursor until it is false. Marking notifications read or archived bumps their change timestamp, so state changes propagate to all of the user's devices. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "cursor"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "date-time"; }; readonly description: "Change timestamp returned by the previous sync call (ISO 8601). Omit for a full initial sync."; }, { readonly name: "limit"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 200; readonly default: 100; }; readonly description: "Maximum notifications per page."; } ]; readonly responses: { readonly 200: { readonly description: "Changed notifications with the next cursor."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/NotificationSyncSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid cursor or limit query parameter."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/notifications/read": { readonly post: { readonly tags: readonly [ "Notifications" ]; readonly summary: "Mark a notification as read"; readonly description: "Sets `read=true` and bumps `updated_at` for a notification owned by the authenticated user so the change is picked up by `/notifications/sync`. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/NotificationIdRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Notification marked as read."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Notification not found for this user."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/notifications/read-all": { readonly post: { readonly tags: readonly [ "Notifications" ]; readonly summary: "Mark all notifications as read"; readonly description: "Sets `read=true` and bumps `updated_at` on every unread notification owned by the authenticated user so the changes are picked up by `/notifications/sync`. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "All unread notifications marked as read."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/notifications/archive": { readonly post: { readonly tags: readonly [ "Notifications" ]; readonly summary: "Archive a notification"; readonly description: "Sets `archive=true` and bumps `updated_at` for a notification owned by the authenticated user so the change is picked up by `/notifications/sync`. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/NotificationIdRequest"; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Notification archived."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Notification not found for this user."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/notifications/archive-all": { readonly post: { readonly tags: readonly [ "Notifications" ]; readonly summary: "Archive all notifications"; readonly description: "Sets `archive=true` and bumps `updated_at` on every unarchived notification owned by the authenticated user so the changes are picked up by `/notifications/sync`. Requires a valid access token (no workspace policy check)."; readonly security: readonly [ never ]; readonly responses: { readonly 200: { readonly description: "All unarchived notifications archived."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/chat/start": { readonly post: { readonly tags: readonly [ "Chat" ]; readonly summary: "Start Matrix chat session"; readonly description: "Provisions or reuses a Matrix (Synapse) user for the authenticated collaborator. Existing tenants are looked up by JWT `userId` + workspace. Username is `owner_{emailLocalPart}-{workspace}` when the caller is the workspace owner (`workspaces.owner_id`), otherwise `{emailLocalPart}-{workspace}`. Persists a tenant row when new, logs in via Matrix `/login` on first use (stable `device_id` and display name), caches `access_token` on the tenant, and returns the raw login JSON. Requires workspace access and read access to crm::chats."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; readonly description: "Workspace identifier for chat tenancy."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Matrix login payload (fresh Synapse login or cached token response)."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/MatrixLoginResponse"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - Collaborator invite not accepted, user lacks workspace access, or user lacks read access to crm::chats."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 500: { readonly description: "Failed to provision the Matrix user on Synapse."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ChatStartFailure"; }; }; }; }; }; }; }; readonly "/chat/collaborators/{workspace}": { readonly get: { readonly tags: readonly [ "Chat" ]; readonly summary: "List chat tenants / collaborators"; readonly description: "Returns chat tenants for the workspace joined with collaborator role and user profile fields. `username` is a fully qualified Matrix user ID (`@{localpart}:aio.mestra.chat`). Requires workspace access and read access to crm::chats."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; readonly description: "Workspace identifier."; } ]; readonly responses: { readonly 200: { readonly description: "Chat collaborators listed successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListChatCollaboratorsSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid workspace id."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized - Missing or invalid access token."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - Collaborator invite not accepted, user lacks workspace access, or user lacks read access to crm::chats."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Workspace not found, or collaborators not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/accounts/list/{workspace}": { readonly get: { readonly tags: readonly [ "Finance" ]; readonly summary: "List finance accounts"; readonly description: "Returns workspace finance accounts ordered by display order. Requires crm::finance read access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Accounts fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFinanceAccountsSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/accounts/get/{workspace}/{accountId}": { readonly get: { readonly tags: readonly [ "Finance" ]; readonly summary: "Get a finance account"; readonly description: "Returns a single finance account. Requires crm::finance read access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "accountId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Account fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceAccountSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Account not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/accounts/create": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Create a finance account"; readonly description: "Creates an account and assigns the next display order (1, 2, 3, \u2026). Requires crm::finance write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "name", "cardColor", "currency", "openingBalance" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; }; readonly cardColor: { readonly type: "string"; readonly description: "6-digit hex color, with or without #."; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "ruble", "dollar", "euro" ]; }; readonly openingBalance: { readonly type: "number"; }; readonly country: { readonly type: "string"; }; readonly companyName: { readonly type: "string"; }; readonly companyAccountNumber: { readonly type: "string"; }; readonly companyInn: { readonly type: "string"; }; readonly companyKpp: { readonly type: "string"; }; readonly companyOgrn: { readonly type: "string"; }; readonly bankName: { readonly type: "string"; }; readonly bankBik: { readonly type: "string"; }; readonly bankKc: { readonly type: "string"; }; readonly bankInn: { readonly type: "string"; }; readonly bankKpp: { readonly type: "string"; }; readonly vatRate: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; }; readonly active: { readonly type: "boolean"; readonly description: "Defaults to true."; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Account created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceAccountSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/accounts/update": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Update a finance account"; readonly description: "Updates account card fields and optional company/bank details. Requires crm::finance write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "accountId", "workspace" ]; readonly properties: { readonly accountId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly name: { readonly type: "string"; }; readonly cardColor: { readonly type: "string"; }; readonly currency: { readonly type: "string"; readonly enum: readonly [ "ruble", "dollar", "euro" ]; }; readonly openingBalance: { readonly type: "number"; }; readonly country: { readonly type: "string"; }; readonly companyName: { readonly type: "string"; }; readonly companyAccountNumber: { readonly type: "string"; }; readonly companyInn: { readonly type: "string"; }; readonly companyKpp: { readonly type: "string"; }; readonly companyOgrn: { readonly type: "string"; }; readonly bankName: { readonly type: "string"; }; readonly bankBik: { readonly type: "string"; }; readonly bankKc: { readonly type: "string"; }; readonly bankInn: { readonly type: "string"; }; readonly bankKpp: { readonly type: "string"; }; readonly vatRate: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; }; readonly active: { readonly type: "boolean"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Account updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceAccountSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Account not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/accounts/reorder": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Reorder finance accounts"; readonly description: "Sets display order to 1..n from the given accountIds list. The list must contain every workspace account exactly once. Requires crm::finance write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "accountIds" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly accountIds: { readonly type: "array"; readonly items: { readonly type: "string"; readonly format: "uuid"; }; readonly minItems: 1; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Accounts reordered successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFinanceAccountsSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or incomplete accountIds list."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/accounts/delete": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Delete a finance account"; readonly description: "Deletes an account and compact remaining display orders. Requires crm::finance write access. Available in frozen Free-trial workspaces."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "accountId", "workspace" ]; readonly properties: { readonly accountId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Account deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Account not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/transactions/list/{workspace}": { readonly get: { readonly tags: readonly [ "Finance" ]; readonly summary: "List finance transactions"; readonly description: "Returns workspace finance transactions newest first. Optional `accountId` matches source or destination account; optional `type` filters by transaction type. Requires crm::finance read access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "accountId"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "type"; readonly in: "query"; readonly required: false; readonly schema: { readonly type: "string"; readonly enum: readonly [ "refund", "income", "expense", "transfer" ]; }; } ]; readonly responses: { readonly 200: { readonly description: "Transactions fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ListFinanceTransactionsSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid query."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/transactions/get/{workspace}/{transactionId}": { readonly get: { readonly tags: readonly [ "Finance" ]; readonly summary: "Get a finance transaction"; readonly description: "Returns a single finance transaction. Requires crm::finance read access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; }, { readonly name: "transactionId"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Transaction fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceTransactionSuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Transaction not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/transactions/create": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Create a finance transaction"; readonly description: "Creates a ledger transaction. Transfers require distinct source `accountId` and `destinationAccountId`. Optional customerId/serviceId are validated against the workspace CRM. Opening balances are not rewritten. Requires crm::finance write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "type", "amount" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "refund", "income", "expense", "transfer" ]; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; }; readonly accountId: { readonly type: "string"; readonly format: "uuid"; }; readonly destinationAccountId: { readonly type: "string"; readonly format: "uuid"; }; readonly paymentMethod: { readonly type: "string"; }; readonly amount: { readonly type: "number"; readonly minimum: 0.01; }; readonly description: { readonly type: "string"; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; readonly vat: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; }; readonly reason: { readonly type: "string"; }; }; }; }; }; }; readonly responses: { readonly 201: { readonly description: "Transaction created successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceTransactionSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or transfer pairing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Account, customer, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/transactions/update": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Update a finance transaction"; readonly description: "Updates transaction fields. Changing type away from transfer clears destinationAccountId. Requires crm::finance write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "transactionId", "workspace" ]; readonly properties: { readonly transactionId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly type: { readonly type: "string"; readonly enum: readonly [ "refund", "income", "expense", "transfer" ]; }; readonly customerId: { readonly type: "string"; readonly format: "uuid"; }; readonly serviceId: { readonly type: "string"; readonly format: "uuid"; }; readonly accountId: { readonly type: "string"; readonly format: "uuid"; }; readonly destinationAccountId: { readonly type: "string"; readonly format: "uuid"; }; readonly paymentMethod: { readonly type: "string"; }; readonly amount: { readonly type: "number"; readonly minimum: 0.01; }; readonly description: { readonly type: "string"; }; readonly date: { readonly type: "string"; readonly format: "date-time"; }; readonly vat: { readonly type: "integer"; readonly minimum: 0; readonly maximum: 100; }; readonly reason: { readonly type: "string"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Transaction updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceTransactionSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload or transfer pairing."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Transaction, account, customer, or service not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/transactions/delete": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Delete a finance transaction"; readonly description: "Deletes a transaction and its receipt prefix `{workspace}_finance/{transactionId}/`. Requires crm::finance write access. Available in frozen Free-trial workspaces."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "transactionId", "workspace" ]; readonly properties: { readonly transactionId: { readonly type: "string"; readonly format: "uuid"; }; readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Transaction deleted successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/SimpleSuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 404: { readonly description: "Transaction not found."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/visibility/{workspace}": { readonly get: { readonly tags: readonly [ "Finance" ]; readonly summary: "Get finance numbers visibility"; readonly description: "Returns whether the frontend should disclose account numbers in the default finance view. Defaults to true when unset. Requires crm::finance read access."; readonly security: readonly [ never ]; readonly parameters: readonly [ { readonly name: "workspace"; readonly in: "path"; readonly required: true; readonly schema: { readonly type: "string"; readonly format: "uuid"; }; } ]; readonly responses: { readonly 200: { readonly description: "Visibility fetched successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceVisibilitySuccess"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; readonly "/finance/visibility": { readonly post: { readonly tags: readonly [ "Finance" ]; readonly summary: "Set finance numbers visibility"; readonly description: "Sets whether the frontend should disclose account numbers in the default finance view. Requires crm::finance write access."; readonly security: readonly [ never ]; readonly requestBody: { readonly required: true; readonly content: { readonly "application/json": { readonly schema: { readonly type: "object"; readonly required: readonly [ "workspace", "visibility" ]; readonly properties: { readonly workspace: { readonly type: "string"; readonly format: "uuid"; }; readonly visibility: { readonly type: "boolean"; }; }; }; }; }; }; readonly responses: { readonly 200: { readonly description: "Visibility updated successfully."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/FinanceVisibilitySuccess"; }; }; }; }; readonly 400: { readonly description: "Invalid request payload."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 401: { readonly description: "Unauthorized."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; readonly 403: { readonly description: "Forbidden - missing workspace or crm::finance write access."; readonly content: { readonly "application/json": { readonly schema: { readonly $ref: "#/components/schemas/ErrorResponse"; }; }; }; }; }; }; }; }; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/docs": { $get: { input: {}; output: {}; outputFormat: string; status: import("hono/utils/http-status").StatusCode; }; }; } & { "/health": { $get: { input: {}; output: { status: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/": { $get: { input: {}; output: { message: string; link: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; }) | import("hono/types").MergeSchemaPath<{ "/stream": { $get: { input: {}; output: {}; outputFormat: string; status: import("hono/utils/http-status").StatusCode; }; }; }, "/event"> | import("hono/types").MergeSchemaPath<{ "/vk": { $get: { input: {}; output: undefined; outputFormat: "redirect"; status: 302; }; }; } & { "/vk/callback": { $get: { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; }; }; } & { "/google": { $get: { input: {}; output: undefined; outputFormat: "redirect"; status: 302; }; }; } & { "/google/callback": { $get: { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; }; }; } & { "/request-otp": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: boolean; expiresAt: any; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/verify-otp": { $post: { input: {}; output: { success: boolean; error: string | undefined; }; outputFormat: "json"; status: 200 | 400; } | { input: {}; output: { success: boolean; accessToken: string | null; refreshToken: string | null; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/request-sms-otp": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: boolean; expiresAt: any; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/verify-sms-otp": { $post: { input: {}; output: { success: boolean; error: string | undefined; }; outputFormat: "json"; status: 200 | 400; } | { input: {}; output: { success: boolean; accessToken: string | null; refreshToken: string | null; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/request-voice-otp": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: boolean; expiresAt: any; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/verify-voice-otp": { $post: { input: {}; output: { success: boolean; error: string | undefined; }; outputFormat: "json"; status: 200 | 400; } | { input: {}; output: { success: boolean; accessToken: string | null; refreshToken: string | null; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/me": { $get: { input: {}; output: { success: true; user: { id: string; email: string | null; phone: string | null; emailVerified: boolean; phoneVerified: boolean; firstName: string | null; lastName: string | null; profilePicture: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/me": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: boolean; }; outputFormat: "json"; status: 200; }; }; } & { "/refresh": { $get: { input: {}; output: { success: true; accessToken: string; }; outputFormat: "json"; status: 200; }; }; } & { "/logout": { $get: { input: {}; output: { success: boolean; message: string | false; }; outputFormat: "json"; status: 200 | 400; }; }; } & { "/logout-all": { $get: { input: {}; output: { success: boolean; message: false | "All tokens invalidated"; }; outputFormat: "json"; status: 200 | 400; }; }; }, "/auth"> | import("hono/types").MergeSchemaPath<{ "/plans": { $get: { input: {}; output: { success: true; plans: { id: string; code: string; name: string; kind: string; sortOrder: number; prices: { [x: string]: number; }; limits: { [x: string]: number; }; }[]; enterprise: { code: string; cta: string; }; }; outputFormat: "json"; status: 200; }; }; } & { "/plans/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; plans: { id: string; code: string; name: string; kind: string; sortOrder: number; prices: { [x: string]: number; }; limits: { [x: string]: number; }; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/admin/enterprise-plan": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 401; } | { input: {}; output: { success: true; plan: { id: string; created_at: string; name: string; active: boolean; code: string; sortOrder: number; kind: string; publiclyVisible: boolean; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; }; }; outputFormat: "json"; status: 201; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 404; }; }; } & { "/admin/coupons": { $get: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 401; } | { input: {}; output: { success: true; coupons: { id: string; code: string; discountType: string; fixedKopecks: number | null; percent: number | null; active: boolean; expiresAt: string | null; maxRedemptions: number | null; redemptionCount: number; createdAt: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/admin/coupons": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 401; } | { input: {}; output: { success: true; coupon: { expiresAt: string | null; id: string; created_at: string; active: boolean; code: string; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; discountType: string; fixedKopecks: number | null; percent: number | null; maxRedemptions: number | null; redemptionCount: number; createdBy: string; }; }; outputFormat: "json"; status: 201; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 409; }; }; } & { "/admin/coupons/:couponId": { $patch: { input: { param: { couponId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 401; } | { input: { param: { couponId: string; }; }; output: { success: true; coupon: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; code: string; discountType: string; fixedKopecks: number | null; percent: number | null; active: boolean; expiresAt: string | null; maxRedemptions: number | null; redemptionCount: number; createdBy: string; }; }; outputFormat: "json"; status: 200; } | { input: { param: { couponId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 404; }; }; } & { "/admin/coupons/:couponId": { $delete: { input: { param: { couponId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 401; } | { input: { param: { couponId: string; }; }; output: { success: true; }; outputFormat: "json"; status: 200; } | { input: { param: { couponId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; }; }; } & { "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 403 | 404 | 500; } | { input: {}; output: { success: true; workspace: string; name: string; invoiceId: any; subscriptionStatus: any; }; outputFormat: "json"; status: 201; }; }; } & { "/list": { $get: { input: {}; output: { success: true; workspaces: { workspaceId: string; workspaceName: string; profilePicture: string | null; workspaceCategory: string; role: string; maxCollaborators: number; hasPaid: boolean; status: string; planCode: string | null; subscriptionStatus: string | null; trialEndsAt: string | null; token: string | null; isOwner: boolean; resources: { name: string; action: string; }[]; }[]; unpaidLimit: number; }; outputFormat: "json"; status: 200; }; }; } & { "/billing/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 403; } | { input: { param: { workspace: string; }; }; output: { subscription: null; pendingInvoice: null; recommendations: null; success: true; } | { subscription: { id: string; status: string; seats: number; interval: string | null; billingCycles: number; trialEndsAt: string | null; periodEnd: string | null; planCode: string; planName: string; planId: string; }; pendingInvoice: { planCode: string; planName: string; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; subscriptionId: string; planId: string; status: string; kind: string; seats: number; interval: string; billingCycles: number; amountKopecks: number; subtotalKopecks: number; discountKopecks: number; couponCode: string | null; currency: string; periodStart: string; periodEnd: string; providerPaymentId: string | null; paymentUrl: string | null; paidAt: string | null; } | null; recommendations: { usage: { tasks: number; comments: number; customers: number; services: number; seats: number; storage_bytes: number; }; plans: { fits: boolean; overLimit: string[]; id: string; code: string; name: string; kind: string; sortOrder: number; prices: { [x: string]: number; }; limits: { [x: string]: number; }; }[]; } | null; success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/policies/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; collaborators: { firstName: string; lastName: string; email: string; role: string; collaboratorId: string; status: string; resources: { name: string; action: string; }[]; profilePicture: string | null; isOwner?: boolean | undefined; isCurrentUser?: boolean | undefined; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/calculator": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; plans: { id: string; code: string; name: string; kind: string; sortOrder: number; prices: { [x: string]: number; }; limits: { [x: string]: number; }; }[]; price: { code: string; amountKopecks: number; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/resources": { $get: { input: {}; output: { success: true; resources: { id: string; name: string; action: string; description: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/invite": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; token: string; }; outputFormat: "json"; status: 201; }; }; } & { "/invite/cancel": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/invite/:workspace/:token": { $get: { input: { param: { workspace: string; } & { token: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; } & { token: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 403; } | { input: { param: { workspace: string; } & { token: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 502; } | { input: { param: { workspace: string; } & { token: string; }; }; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/policies": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 502; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/role": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/settings": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; workspace: string; name: string; maxCollaborators: number; hasPaid: boolean; }; outputFormat: "json"; status: 200; }; }; } & { "/settings/remove-collaborator": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 502; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; code: string | undefined; }; outputFormat: "json"; status: 400 | 403 | 404 | 409 | 502 | 503; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/leave/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: { param: { workspace: string; }; }; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/workspace"> | import("hono/types").MergeSchemaPath<{ "/create": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 201; }; }; } & { "/list/:workspace/:taskId": { $get: { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: true; comments: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; taskId: string; workspaceId: string; content: string; reply: string | null; created_by: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/edit": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 403; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/history/:workspace/:taskId/:commentId": { $get: { input: { param: { workspace: string; } & { taskId: string; } & { commentId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { taskId: string; } & { commentId: string; }; }; output: { success: true; history: { editorFirstName: string | null; editorLastName: string | null; editorProfilePicture: string | null; id: string; commentId: string; taskId: string; workspaceId: string; previousContent: string; content: string; editedBy: string; createdAt: string; }[]; }; outputFormat: "json"; status: 200; }; }; }, "/comments"> | import("hono/types").MergeSchemaPath<{ "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; task: { id: string; created_at: string; workspaceId: string; description: string | null; subject: string; created_by: string; customerId: string | null; phaseId: string | null; visibility: string | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; priority: string | null; }; }; outputFormat: "json"; status: 201; }; }; } & { "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; tasks: { id: string; subject: string; description: string | null; visibility: string | null; phaseId: string | null; phaseName: string | null; phaseSortOrder: number | null; priority: string | null; created_at: string; workspaceId: string; created_by: string; comments_count: number; tags: { id: string; name: string; description: string | null; }[]; }[] | undefined; collaborators: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/:taskId": { $get: { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: true; task: { id: string; subject: string; description: string | null; visibility: string | null; phaseId: string | null; phaseName: string | null; phaseSortOrder: number | null; priority: string | null; created_at: string; workspaceId: string; created_by: string; comments_count: number; tags: { id: string; name: string; description: string | null; }[]; }; collaborators: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; }[]; customer: { tags: { id: string; name: string; description: string | null; }[]; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; type: string | null; name: string; companyName: string | null; phone: string | null; telegram: string | null; whatsapp: string | null; instagram: string | null; vk: string | null; igSynapseId: string | null; waSynapseId: string | null; tgSynapseId: string | null; vkSynapseId: string | null; email: string | null; leadSource: string | null; budgetMin: number | null; budgetMax: number | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; minArea: number | null; maxArea: number | null; roomsCount: number | null; preferredDistricts: string[] | null; propertyType: string | null; housingType: string | null; housingTypeNew: boolean | null; housingTypeResale: boolean | null; commercialType: string | null; landType: string | null; maxMetroDistance: number | null; dealStatus: string | null; preferredPaymentMethod: string | null; childrenCount: number | null; hasPets: boolean | null; carsCount: number | null; birthDate: string | null; notes: string | null; }[]; failureReasons: { id: string; title: string; description: string | null; workspaceId: string; created_at: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 403; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/assign-customer": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/remove-customer": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/tasks"> | import("hono/types").MergeSchemaPath<{ "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; phases: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; name: string; sortOrder: number; isBuiltin: boolean; }[]; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/create": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 409; } | { input: {}; output: { success: true; phase: { id: string; created_at: string; name: string; workspaceId: string; sortOrder: number; isBuiltin: boolean; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; }; }; outputFormat: "json"; status: 201; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 409; } | { input: {}; output: { success: true; phase: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; name: string; sortOrder: number; isBuiltin: boolean; }; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/reorder": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; phases: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; name: string; sortOrder: number; isBuiltin: boolean; }[]; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 409; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; }, "/task-phases"> | import("hono/types").MergeSchemaPath<{ "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; templates: { id: string; title: string; content: string; created_by: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/create": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; template: { id: string; created_at: string; title: string; workspaceId: string; created_by: string; content: string; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; }[]; }; outputFormat: "json"; status: 201; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/templates"> | import("hono/types").MergeSchemaPath<{ "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; service: { id: string; type: string | null; created_at: string; active: boolean | null; title: string; workspaceId: string; description: string | null; price: number | null; created_by: string | null; currency: string | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; roomsCount: number | null; propertyType: string | null; commercialType: string | null; landType: string | null; propertyStatus: string | null; commercialClass: string | null; ownershipType: string | null; loadingDockAccess: boolean | null; waterAccess: boolean | null; electricityAccess: boolean | null; gasAccess: boolean | null; sewageAccess: boolean | null; internetAccess: boolean | null; elevaorAccess: boolean | null; seprateEntrance: boolean | null; furnishedType: string | null; parkingType: string | null; balconyAccess: boolean | null; loggiaAccess: boolean | null; otherFeatures: string | null; pricePerSquareMeter: number | null; alternativeEURCurrency: boolean | null; alternativeRUBCurrency: boolean | null; alternativeUSDCurrency: boolean | null; estimatedDeliveryDate: string | null; bathroomsCount: number | null; bedroomsCount: number | null; totalArea: number | null; livingArea: number | null; ceilingHeight: number | null; floor: number | null; totalFloors: number | null; yearBuilt: string | null; renovation: string | null; developerName: string | null; city: string | null; district: string | null; nearestMetroStation: string | null; fullAddress: string | null; latitude: string | null; longitude: string | null; }[]; }; outputFormat: "json"; status: 201; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; service: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; title: string; active: boolean | null; type: string | null; currency: string | null; description: string | null; price: number | null; propertyType: string | null; propertyStatus: string | null; commercialType: string | null; commercialClass: string | null; landType: string | null; ownershipType: string | null; loadingDockAccess: boolean | null; waterAccess: boolean | null; electricityAccess: boolean | null; gasAccess: boolean | null; sewageAccess: boolean | null; internetAccess: boolean | null; elevaorAccess: boolean | null; seprateEntrance: boolean | null; furnishedType: string | null; parkingType: string | null; balconyAccess: boolean | null; loggiaAccess: boolean | null; otherFeatures: string | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; pricePerSquareMeter: number | null; alternativeEURCurrency: boolean | null; alternativeRUBCurrency: boolean | null; alternativeUSDCurrency: boolean | null; estimatedDeliveryDate: string | null; roomsCount: number | null; bathroomsCount: number | null; bedroomsCount: number | null; totalArea: number | null; livingArea: number | null; ceilingHeight: number | null; floor: number | null; totalFloors: number | null; yearBuilt: string | null; renovation: string | null; developerName: string | null; city: string | null; district: string | null; nearestMetroStation: string | null; fullAddress: string | null; latitude: string | null; longitude: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: true; services: { createdBy: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; } | null; tags: { id: string; name: string; description: string | null; }[]; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; title: string; active: boolean | null; type: string | null; currency: string | null; description: string | null; price: number | null; propertyType: string | null; propertyStatus: string | null; commercialType: string | null; commercialClass: string | null; landType: string | null; ownershipType: string | null; loadingDockAccess: boolean | null; waterAccess: boolean | null; electricityAccess: boolean | null; gasAccess: boolean | null; sewageAccess: boolean | null; internetAccess: boolean | null; elevaorAccess: boolean | null; seprateEntrance: boolean | null; furnishedType: string | null; parkingType: string | null; balconyAccess: boolean | null; loggiaAccess: boolean | null; otherFeatures: string | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; pricePerSquareMeter: number | null; alternativeEURCurrency: boolean | null; alternativeRUBCurrency: boolean | null; alternativeUSDCurrency: boolean | null; estimatedDeliveryDate: string | null; roomsCount: number | null; bathroomsCount: number | null; bedroomsCount: number | null; totalArea: number | null; livingArea: number | null; ceilingHeight: number | null; floor: number | null; totalFloors: number | null; yearBuilt: string | null; renovation: string | null; developerName: string | null; city: string | null; district: string | null; nearestMetroStation: string | null; fullAddress: string | null; latitude: string | null; longitude: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/get/:workspace/:serviceId": { $get: { input: { param: { workspace: string; } & { serviceId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; } & { serviceId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { serviceId: string; }; }; output: { success: true; service: { createdBy: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; } | null; tags: { id: string; name: string; description: string | null; }[]; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; title: string; active: boolean | null; type: string | null; currency: string | null; description: string | null; price: number | null; propertyType: string | null; propertyStatus: string | null; commercialType: string | null; commercialClass: string | null; landType: string | null; ownershipType: string | null; loadingDockAccess: boolean | null; waterAccess: boolean | null; electricityAccess: boolean | null; gasAccess: boolean | null; sewageAccess: boolean | null; internetAccess: boolean | null; elevaorAccess: boolean | null; seprateEntrance: boolean | null; furnishedType: string | null; parkingType: string | null; balconyAccess: boolean | null; loggiaAccess: boolean | null; otherFeatures: string | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; pricePerSquareMeter: number | null; alternativeEURCurrency: boolean | null; alternativeRUBCurrency: boolean | null; alternativeUSDCurrency: boolean | null; estimatedDeliveryDate: string | null; roomsCount: number | null; bathroomsCount: number | null; bedroomsCount: number | null; totalArea: number | null; livingArea: number | null; ceilingHeight: number | null; floor: number | null; totalFloors: number | null; yearBuilt: string | null; renovation: string | null; developerName: string | null; city: string | null; district: string | null; nearestMetroStation: string | null; fullAddress: string | null; latitude: string | null; longitude: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/services"> | import("hono/types").MergeSchemaPath<{ "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; customer: { id: string; type: string | null; created_at: string; name: string; email: string | null; workspaceId: string; created_by: string | null; vk: string | null; instagram: string | null; whatsapp: string | null; telegram: string | null; companyName: string | null; leadSource: string | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; phone: string | null; igSynapseId: string | null; waSynapseId: string | null; tgSynapseId: string | null; vkSynapseId: string | null; budgetMin: number | null; budgetMax: number | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; minArea: number | null; maxArea: number | null; roomsCount: number | null; preferredDistricts: string[] | null; propertyType: string | null; housingType: string | null; housingTypeNew: boolean | null; housingTypeResale: boolean | null; commercialType: string | null; landType: string | null; maxMetroDistance: number | null; dealStatus: string | null; preferredPaymentMethod: string | null; childrenCount: number | null; hasPets: boolean | null; carsCount: number | null; birthDate: string | null; notes: string | null; }[]; }; outputFormat: "json"; status: 201; }; }; } & { "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: true; customers: { createdBy: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; } | null; tags: { id: string; name: string; description: string | null; }[]; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; type: string | null; name: string; companyName: string | null; phone: string | null; telegram: string | null; whatsapp: string | null; instagram: string | null; vk: string | null; igSynapseId: string | null; waSynapseId: string | null; tgSynapseId: string | null; vkSynapseId: string | null; email: string | null; leadSource: string | null; budgetMin: number | null; budgetMax: number | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; minArea: number | null; maxArea: number | null; roomsCount: number | null; preferredDistricts: string[] | null; propertyType: string | null; housingType: string | null; housingTypeNew: boolean | null; housingTypeResale: boolean | null; commercialType: string | null; landType: string | null; maxMetroDistance: number | null; dealStatus: string | null; preferredPaymentMethod: string | null; childrenCount: number | null; hasPets: boolean | null; carsCount: number | null; birthDate: string | null; notes: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/get/:workspace/:customerId": { $get: { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: true; customer: { createdBy: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; } | null; tags: { id: string; name: string; description: string | null; }[]; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; type: string | null; name: string; companyName: string | null; phone: string | null; telegram: string | null; whatsapp: string | null; instagram: string | null; vk: string | null; igSynapseId: string | null; waSynapseId: string | null; tgSynapseId: string | null; vkSynapseId: string | null; email: string | null; leadSource: string | null; budgetMin: number | null; budgetMax: number | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; minArea: number | null; maxArea: number | null; roomsCount: number | null; preferredDistricts: string[] | null; propertyType: string | null; housingType: string | null; housingTypeNew: boolean | null; housingTypeResale: boolean | null; commercialType: string | null; landType: string | null; maxMetroDistance: number | null; dealStatus: string | null; preferredPaymentMethod: string | null; childrenCount: number | null; hasPets: boolean | null; carsCount: number | null; birthDate: string | null; notes: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; customer: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; created_by: string | null; type: string | null; name: string; companyName: string | null; phone: string | null; telegram: string | null; whatsapp: string | null; instagram: string | null; vk: string | null; igSynapseId: string | null; waSynapseId: string | null; tgSynapseId: string | null; vkSynapseId: string | null; email: string | null; leadSource: string | null; budgetMin: number | null; budgetMax: number | null; fullPayment: boolean | null; mortgagePayment: boolean | null; installmentPayment: boolean | null; fullPaymentAmount: number | null; mortgagePaymentAmount: number | null; installmentPaymentAmount: number | null; minArea: number | null; maxArea: number | null; roomsCount: number | null; preferredDistricts: string[] | null; propertyType: string | null; housingType: string | null; housingTypeNew: boolean | null; housingTypeResale: boolean | null; commercialType: string | null; landType: string | null; maxMetroDistance: number | null; dealStatus: string | null; preferredPaymentMethod: string | null; childrenCount: number | null; hasPets: boolean | null; carsCount: number | null; birthDate: string | null; notes: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/get-tasks/:workspace/:customerId": { $get: { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: true; tasks: { id: string; subject: string; description: string | null; visibility: string | null; phaseId: string | null; phaseName: string | null; phaseSortOrder: number | null; priority: string | null; created_at: string; workspaceId: string; created_by: string; comments_count: number; tags: { id: string; name: string; description: string | null; }[]; }[] | null; }; outputFormat: "json"; status: 200; }; }; }, "/customers"> | import("hono/types").MergeSchemaPath<{ "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; cinvoice: { id: string; created_at: string; invoiceId: string; status: string; workspaceId: string; created_by: string; customerId: string; serviceId: string; installment: boolean | null; vatRate: number | null; SellerFinanceAccountId: string; date: string; language: string; currency: string; vatOption: string; unitName: string; unitPrice: number; unitQuantity: number; subscription: boolean | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; paidAt: string | null; fullPayment: boolean | null; notes: string | null; buyerInn: string | null; buyerKpp: string | null; discount: number | null; subscriptionStartDate: string | null; subscriptionEndDate: string | null; paymentMethod: string | null; }[]; }; outputFormat: "json"; status: 201; }; }; } & { "/accounts/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; accounts: { id: string; created_at: string; name: string; active: boolean; workspaceId: string; country: string | null; companyName: string | null; bankBik: string | null; bankKc: string | null; vatRate: number | null; currency: FinanceCurrency; order: number; cardColor: string; updated_at: string | null; companyAccountNumber: string | null; companyInn: string | null; companyKpp: string | null; companyOgrn: string | null; bankName: string | null; bankInn: string | null; bankKpp: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/list/:workspace/:customerId": { $get: { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: true; cinvoices: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; invoiceId: string; serviceId: string; SellerFinanceAccountId: string; customerId: string; date: string; language: string; currency: string; vatOption: string; vatRate: number | null; buyerInn: string | null; buyerKpp: string | null; unitName: string; unitPrice: number; unitQuantity: number; notes: string | null; discount: number | null; fullPayment: boolean | null; installment: boolean | null; subscription: boolean | null; subscriptionStartDate: string | null; subscriptionEndDate: string | null; paymentMethod: string | null; status: string; paidAt: string | null; created_by: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; cinvoice: { id: string; created_at: string; invoiceId: string; status: string; workspaceId: string; created_by: string; customerId: string; serviceId: string; installment: boolean | null; vatRate: number | null; SellerFinanceAccountId: string; date: string; language: string; currency: string; vatOption: string; unitName: string; unitPrice: number; unitQuantity: number; subscription: boolean | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; paidAt: string | null; fullPayment: boolean | null; notes: string | null; buyerInn: string | null; buyerKpp: string | null; discount: number | null; subscriptionStartDate: string | null; subscriptionEndDate: string | null; paymentMethod: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/cinvoices"> | import("hono/types").MergeSchemaPath<{ "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; history: { id: string; created_at: string; workspaceId: string; created_by: string; customerId: string; serviceId: string; date: string; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; notes: string | null; }[]; }; outputFormat: "json"; status: 201; }; }; } & { "/list/:workspace/:customerId": { $get: { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: true; history: { createdBy: { id: string; firstName: string | null; lastName: string | null; profilePicture: string | null; } | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; customerId: string; serviceId: string; notes: string | null; date: string; created_by: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; history: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; workspaceId: string; customerId: string; serviceId: string; notes: string | null; date: string; created_by: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/chistory"> | import("hono/types").MergeSchemaPath<{ "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; collaborators: { collaboratorId: string; role: string; profilePicture: string | null; firstName: string | null; lastName: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/list/:workspace/:taskId": { $get: { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: true; assignees: { assigneeId: string; workspaceId: string; collaboratorId: string; taskId: string; startDate: string | null; endDate: string | null; description: string | null; profilePicture: string | null; firstName: string | null; lastName: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; assignee: { id: string; created_at: string; startDate: string | null; endDate: string | null; collaboratorId: string; workspaceId: string; description: string | null; created_by: string; taskId: string; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; }; }; outputFormat: "json"; status: 201; }; }; } & { "/remove": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; result: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; taskId: string; collaboratorId: string; startDate: string | null; endDate: string | null; description: string | null; workspaceId: string; created_by: string; }; }; outputFormat: "json"; status: 200; }; }; }, "/assignees"> | import("hono/types").MergeSchemaPath<{ "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; tags: { id: string; name: string; description: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/create": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; tag: { id: string; created_at: string; name: string; workspaceId: string; description: string | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; }[]; }; outputFormat: "json"; status: 201; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; tag: { rows: never[]; command: string; rowCount: number | null; oid: number; fields: { name: string; tableID: number; columnID: number; dataTypeID: number; dataTypeSize: number; dataTypeModifier: number; format: string; }[]; }; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/assign-to-task": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/assign-to-customer": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/remove-from-customer": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/assign-to-service": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/remove-from-service": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/remove-from-task": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/tags"> | import("hono/types").MergeSchemaPath<{ "/list/:workspace/:taskId": { $get: { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: true; reasons: { id: string; title: string; description: string | null; workspaceId: string; created_at: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; reasons: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; title: string; description: string | null; workspaceId: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/get/:workspace/:failureReasonId": { $get: { input: { param: { workspace: string; } & { failureReasonId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { failureReasonId: string; }; }; output: { success: true; reason: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; title: string; description: string | null; workspaceId: string; }; }; outputFormat: "json"; status: 200; }; }; } & { "/create": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 409; } | { input: {}; output: { success: true; reason: { id: string; created_at: string; title: string; workspaceId: string; description: string | null; updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; }; }; outputFormat: "json"; status: 201; }; }; } & { "/update": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 409; } | { input: {}; output: { success: true; reason: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; title: string; description: string | null; workspaceId: string; }; }; outputFormat: "json"; status: 200; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/assign-to-task": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/remove-from-task": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/freason"> | import("hono/types").MergeSchemaPath<{ "/google/connect": { $get: { input: {}; output: { success: true; url: string; }; outputFormat: "json"; status: 200; }; }; } & { "/google/callback": { $get: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/list": { $get: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; integrations: { scope: string; status: string; }; user: string | null | undefined; }; outputFormat: "json"; status: 200; }; }; } & { "/google/disconnect": { $get: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/create-event": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: import("hono/utils/types").JSONValue; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; event: { request?: { addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; readonly aborted: boolean; readonly bufferSize: number; readonly closed: boolean; readonly destroyed: boolean; readonly endAfterHeaders: boolean; readonly id?: number | undefined | undefined; readonly pending: boolean; readonly rstCode: number; readonly sentHeaders: { [x: string]: import("node:http").OutgoingHttpHeader | undefined; accept?: string | string[] | undefined | undefined; "accept-charset"?: string | string[] | undefined | undefined; "accept-encoding"?: string | string[] | undefined | undefined; "accept-language"?: string | string[] | undefined | undefined; "accept-ranges"?: string | undefined | undefined; "access-control-allow-credentials"?: string | undefined | undefined; "access-control-allow-headers"?: string | undefined | undefined; "access-control-allow-methods"?: string | undefined | undefined; "access-control-allow-origin"?: string | undefined | undefined; "access-control-expose-headers"?: string | undefined | undefined; "access-control-max-age"?: string | undefined | undefined; "access-control-request-headers"?: string | undefined | undefined; "access-control-request-method"?: string | undefined | undefined; age?: string | undefined | undefined; allow?: string | undefined | undefined; authorization?: string | undefined | undefined; "cache-control"?: string | undefined | undefined; "cdn-cache-control"?: string | undefined | undefined; connection?: string | string[] | undefined | undefined; "content-disposition"?: string | undefined | undefined; "content-encoding"?: string | undefined | undefined; "content-language"?: string | undefined | undefined; "content-length"?: string | number | undefined | undefined; "content-location"?: string | undefined | undefined; "content-range"?: string | undefined | undefined; "content-security-policy"?: string | undefined | undefined; "content-security-policy-report-only"?: string | undefined | undefined; "content-type"?: string | undefined | undefined; cookie?: string | string[] | undefined | undefined; dav?: string | string[] | undefined | undefined; dnt?: string | undefined | undefined; date?: string | undefined | undefined; etag?: string | undefined | undefined; expect?: string | undefined | undefined; expires?: string | undefined | undefined; forwarded?: string | undefined | undefined; from?: string | undefined | undefined; host?: string | undefined | undefined; "if-match"?: string | undefined | undefined; "if-modified-since"?: string | undefined | undefined; "if-none-match"?: string | undefined | undefined; "if-range"?: string | undefined | undefined; "if-unmodified-since"?: string | undefined | undefined; "last-modified"?: string | undefined | undefined; link?: string | string[] | undefined | undefined; location?: string | undefined | undefined; "max-forwards"?: string | undefined | undefined; origin?: string | undefined | undefined; pragma?: string | string[] | undefined | undefined; "proxy-authenticate"?: string | string[] | undefined | undefined; "proxy-authorization"?: string | undefined | undefined; "public-key-pins"?: string | undefined | undefined; "public-key-pins-report-only"?: string | undefined | undefined; range?: string | undefined | undefined; referer?: string | undefined | undefined; "referrer-policy"?: string | undefined | undefined; refresh?: string | undefined | undefined; "retry-after"?: string | undefined | undefined; "sec-websocket-accept"?: string | undefined | undefined; "sec-websocket-extensions"?: string | string[] | undefined | undefined; "sec-websocket-key"?: string | undefined | undefined; "sec-websocket-protocol"?: string | string[] | undefined | undefined; "sec-websocket-version"?: string | undefined | undefined; server?: string | undefined | undefined; "set-cookie"?: string | string[] | undefined | undefined; "strict-transport-security"?: string | undefined | undefined; te?: string | undefined | undefined; trailer?: string | undefined | undefined; "transfer-encoding"?: string | undefined | undefined; "user-agent"?: string | undefined | undefined; upgrade?: string | undefined | undefined; "upgrade-insecure-requests"?: string | undefined | undefined; vary?: string | undefined | undefined; via?: string | string[] | undefined | undefined; warning?: string | undefined | undefined; "www-authenticate"?: string | string[] | undefined | undefined; "x-content-type-options"?: string | undefined | undefined; "x-dns-prefetch-control"?: string | undefined | undefined; "x-frame-options"?: string | undefined | undefined; "x-xss-protection"?: string | undefined | undefined; }; readonly sentInfoHeaders?: { [x: string]: import("node:http").OutgoingHttpHeader | undefined; accept?: string | string[] | undefined | undefined; "accept-charset"?: string | string[] | undefined | undefined; "accept-encoding"?: string | string[] | undefined | undefined; "accept-language"?: string | string[] | undefined | undefined; "accept-ranges"?: string | undefined | undefined; "access-control-allow-credentials"?: string | undefined | undefined; "access-control-allow-headers"?: string | undefined | undefined; "access-control-allow-methods"?: string | undefined | undefined; "access-control-allow-origin"?: string | undefined | undefined; "access-control-expose-headers"?: string | undefined | undefined; "access-control-max-age"?: string | undefined | undefined; "access-control-request-headers"?: string | undefined | undefined; "access-control-request-method"?: string | undefined | undefined; age?: string | undefined | undefined; allow?: string | undefined | undefined; authorization?: string | undefined | undefined; "cache-control"?: string | undefined | undefined; "cdn-cache-control"?: string | undefined | undefined; connection?: string | string[] | undefined | undefined; "content-disposition"?: string | undefined | undefined; "content-encoding"?: string | undefined | undefined; "content-language"?: string | undefined | undefined; "content-length"?: string | number | undefined | undefined; "content-location"?: string | undefined | undefined; "content-range"?: string | undefined | undefined; "content-security-policy"?: string | undefined | undefined; "content-security-policy-report-only"?: string | undefined | undefined; "content-type"?: string | undefined | undefined; cookie?: string | string[] | undefined | undefined; dav?: string | string[] | undefined | undefined; dnt?: string | undefined | undefined; date?: string | undefined | undefined; etag?: string | undefined | undefined; expect?: string | undefined | undefined; expires?: string | undefined | undefined; forwarded?: string | undefined | undefined; from?: string | undefined | undefined; host?: string | undefined | undefined; "if-match"?: string | undefined | undefined; "if-modified-since"?: string | undefined | undefined; "if-none-match"?: string | undefined | undefined; "if-range"?: string | undefined | undefined; "if-unmodified-since"?: string | undefined | undefined; "last-modified"?: string | undefined | undefined; link?: string | string[] | undefined | undefined; location?: string | undefined | undefined; "max-forwards"?: string | undefined | undefined; origin?: string | undefined | undefined; pragma?: string | string[] | undefined | undefined; "proxy-authenticate"?: string | string[] | undefined | undefined; "proxy-authorization"?: string | undefined | undefined; "public-key-pins"?: string | undefined | undefined; "public-key-pins-report-only"?: string | undefined | undefined; range?: string | undefined | undefined; referer?: string | undefined | undefined; "referrer-policy"?: string | undefined | undefined; refresh?: string | undefined | undefined; "retry-after"?: string | undefined | undefined; "sec-websocket-accept"?: string | undefined | undefined; "sec-websocket-extensions"?: string | string[] | undefined | undefined; "sec-websocket-key"?: string | undefined | undefined; "sec-websocket-protocol"?: string | string[] | undefined | undefined; "sec-websocket-version"?: string | undefined | undefined; server?: string | undefined | undefined; "set-cookie"?: string | string[] | undefined | undefined; "strict-transport-security"?: string | undefined | undefined; te?: string | undefined | undefined; trailer?: string | undefined | undefined; "transfer-encoding"?: string | undefined | undefined; "user-agent"?: string | undefined | undefined; upgrade?: string | undefined | undefined; "upgrade-insecure-requests"?: string | undefined | undefined; vary?: string | undefined | undefined; via?: string | string[] | undefined | undefined; warning?: string | undefined | undefined; "www-authenticate"?: string | string[] | undefined | undefined; "x-content-type-options"?: string | undefined | undefined; "x-dns-prefetch-control"?: string | undefined | undefined; "x-frame-options"?: string | undefined | undefined; "x-xss-protection"?: string | undefined | undefined; }[] | undefined; readonly sentTrailers?: { [x: string]: import("node:http").OutgoingHttpHeader | undefined; accept?: string | string[] | undefined | undefined; "accept-charset"?: string | string[] | undefined | undefined; "accept-encoding"?: string | string[] | undefined | undefined; "accept-language"?: string | string[] | undefined | undefined; "accept-ranges"?: string | undefined | undefined; "access-control-allow-credentials"?: string | undefined | undefined; "access-control-allow-headers"?: string | undefined | undefined; "access-control-allow-methods"?: string | undefined | undefined; "access-control-allow-origin"?: string | undefined | undefined; "access-control-expose-headers"?: string | undefined | undefined; "access-control-max-age"?: string | undefined | undefined; "access-control-request-headers"?: string | undefined | undefined; "access-control-request-method"?: string | undefined | undefined; age?: string | undefined | undefined; allow?: string | undefined | undefined; authorization?: string | undefined | undefined; "cache-control"?: string | undefined | undefined; "cdn-cache-control"?: string | undefined | undefined; connection?: string | string[] | undefined | undefined; "content-disposition"?: string | undefined | undefined; "content-encoding"?: string | undefined | undefined; "content-language"?: string | undefined | undefined; "content-length"?: string | number | undefined | undefined; "content-location"?: string | undefined | undefined; "content-range"?: string | undefined | undefined; "content-security-policy"?: string | undefined | undefined; "content-security-policy-report-only"?: string | undefined | undefined; "content-type"?: string | undefined | undefined; cookie?: string | string[] | undefined | undefined; dav?: string | string[] | undefined | undefined; dnt?: string | undefined | undefined; date?: string | undefined | undefined; etag?: string | undefined | undefined; expect?: string | undefined | undefined; expires?: string | undefined | undefined; forwarded?: string | undefined | undefined; from?: string | undefined | undefined; host?: string | undefined | undefined; "if-match"?: string | undefined | undefined; "if-modified-since"?: string | undefined | undefined; "if-none-match"?: string | undefined | undefined; "if-range"?: string | undefined | undefined; "if-unmodified-since"?: string | undefined | undefined; "last-modified"?: string | undefined | undefined; link?: string | string[] | undefined | undefined; location?: string | undefined | undefined; "max-forwards"?: string | undefined | undefined; origin?: string | undefined | undefined; pragma?: string | string[] | undefined | undefined; "proxy-authenticate"?: string | string[] | undefined | undefined; "proxy-authorization"?: string | undefined | undefined; "public-key-pins"?: string | undefined | undefined; "public-key-pins-report-only"?: string | undefined | undefined; range?: string | undefined | undefined; referer?: string | undefined | undefined; "referrer-policy"?: string | undefined | undefined; refresh?: string | undefined | undefined; "retry-after"?: string | undefined | undefined; "sec-websocket-accept"?: string | undefined | undefined; "sec-websocket-extensions"?: string | string[] | undefined | undefined; "sec-websocket-key"?: string | undefined | undefined; "sec-websocket-protocol"?: string | string[] | undefined | undefined; "sec-websocket-version"?: string | undefined | undefined; server?: string | undefined | undefined; "set-cookie"?: string | string[] | undefined | undefined; "strict-transport-security"?: string | undefined | undefined; te?: string | undefined | undefined; trailer?: string | undefined | undefined; "transfer-encoding"?: string | undefined | undefined; "user-agent"?: string | undefined | undefined; upgrade?: string | undefined | undefined; "upgrade-insecure-requests"?: string | undefined | undefined; vary?: string | undefined | undefined; via?: string | string[] | undefined | undefined; warning?: string | undefined | undefined; "www-authenticate"?: string | string[] | undefined | undefined; "x-content-type-options"?: string | undefined | undefined; "x-dns-prefetch-control"?: string | undefined | undefined; "x-frame-options"?: string | undefined | undefined; "x-xss-protection"?: string | undefined | undefined; } | undefined; readonly session: { readonly alpnProtocol?: string | undefined | undefined; readonly closed: boolean; readonly connecting: boolean; readonly destroyed: boolean; readonly encrypted?: boolean | undefined | undefined; readonly localSettings: { headerTableSize?: number | undefined | undefined; enablePush?: boolean | undefined | undefined; initialWindowSize?: number | undefined | undefined; maxFrameSize?: number | undefined | undefined; maxConcurrentStreams?: number | undefined | undefined; maxHeaderListSize?: number | undefined | undefined; enableConnectProtocol?: boolean | undefined | undefined; customSettings?: { [x: number]: number; } | undefined; }; readonly originSet?: string[] | undefined | undefined; readonly pendingSettingsAck: boolean; readonly remoteSettings: { headerTableSize?: number | undefined | undefined; enablePush?: boolean | undefined | undefined; initialWindowSize?: number | undefined | undefined; maxFrameSize?: number | undefined | undefined; maxConcurrentStreams?: number | undefined | undefined; maxHeaderListSize?: number | undefined | undefined; enableConnectProtocol?: boolean | undefined | undefined; customSettings?: { [x: number]: number; } | undefined; }; readonly socket: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; } | { authorized: boolean; authorizationError: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; }; encrypted: true; alpnProtocol: string | false | null; servername: string | false | null; getPeerCertificate: never; renegotiate: never; setKeyCert: never; setMaxSendFragment: never; exportKeyingMaterial: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; }; readonly state: { effectiveLocalWindowSize?: number | undefined | undefined; effectiveRecvDataLength?: number | undefined | undefined; nextStreamID?: number | undefined | undefined; localWindowSize?: number | undefined | undefined; lastProcStreamID?: number | undefined | undefined; remoteWindowSize?: number | undefined | undefined; outboundQueueSize?: number | undefined | undefined; deflateDynamicTableSize?: number | undefined | undefined; inflateDynamicTableSize?: number | undefined | undefined; }; readonly type: number; close: never; destroy: never; goaway: never; ping: never; setLocalWindowSize: never; setTimeout: never; settings: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; setMaxListeners: never; } | undefined; readonly state: { localWindowSize?: number | undefined | undefined; state?: number | undefined | undefined; localClose?: number | undefined | undefined; remoteClose?: number | undefined | undefined; sumDependencyWeight?: number | undefined | undefined; weight?: number | undefined | undefined; }; close: never; setTimeout: never; sendTrailers: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; setEncoding: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; write: never; setDefaultEncoding: never; end: never; } | undefined; headers: { [x: string]: string | string[] | undefined; ":path"?: string | undefined | undefined; ":method"?: string | undefined | undefined; ":authority"?: string | undefined | undefined; ":scheme"?: string | undefined | undefined; ":protocol"?: string | undefined | undefined; accept?: string | undefined | undefined; "accept-encoding"?: string | undefined | undefined; "accept-language"?: string | undefined | undefined; "accept-patch"?: string | undefined | undefined; "accept-ranges"?: string | undefined | undefined; "access-control-allow-credentials"?: string | undefined | undefined; "access-control-allow-headers"?: string | undefined | undefined; "access-control-allow-methods"?: string | undefined | undefined; "access-control-allow-origin"?: string | undefined | undefined; "access-control-expose-headers"?: string | undefined | undefined; "access-control-max-age"?: string | undefined | undefined; "access-control-request-headers"?: string | undefined | undefined; "access-control-request-method"?: string | undefined | undefined; age?: string | undefined | undefined; allow?: string | undefined | undefined; "alt-svc"?: string | undefined | undefined; authorization?: string | undefined | undefined; "cache-control"?: string | undefined | undefined; connection?: string | undefined | undefined; "content-disposition"?: string | undefined | undefined; "content-encoding"?: string | undefined | undefined; "content-language"?: string | undefined | undefined; "content-length"?: string | undefined | undefined; "content-location"?: string | undefined | undefined; "content-range"?: string | undefined | undefined; "content-type"?: string | undefined | undefined; cookie?: string | undefined | undefined; date?: string | undefined | undefined; etag?: string | undefined | undefined; expect?: string | undefined | undefined; expires?: string | undefined | undefined; forwarded?: string | undefined | undefined; from?: string | undefined | undefined; host?: string | undefined | undefined; "if-match"?: string | undefined | undefined; "if-modified-since"?: string | undefined | undefined; "if-none-match"?: string | undefined | undefined; "if-unmodified-since"?: string | undefined | undefined; "last-modified"?: string | undefined | undefined; location?: string | undefined | undefined; origin?: string | undefined | undefined; pragma?: string | undefined | undefined; "proxy-authenticate"?: string | undefined | undefined; "proxy-authorization"?: string | undefined | undefined; "public-key-pins"?: string | undefined | undefined; range?: string | undefined | undefined; referer?: string | undefined | undefined; "retry-after"?: string | undefined | undefined; "sec-fetch-site"?: string | undefined | undefined; "sec-fetch-mode"?: string | undefined | undefined; "sec-fetch-user"?: string | undefined | undefined; "sec-fetch-dest"?: string | undefined | undefined; "sec-websocket-accept"?: string | undefined | undefined; "sec-websocket-extensions"?: string | undefined | undefined; "sec-websocket-key"?: string | undefined | undefined; "sec-websocket-protocol"?: string | undefined | undefined; "sec-websocket-version"?: string | undefined | undefined; "set-cookie"?: string[] | undefined | undefined; "strict-transport-security"?: string | undefined | undefined; tk?: string | undefined | undefined; trailer?: string | undefined | undefined; "transfer-encoding"?: string | undefined | undefined; upgrade?: string | undefined | undefined; "user-agent"?: string | undefined | undefined; vary?: string | undefined | undefined; via?: string | undefined | undefined; warning?: string | undefined | undefined; "www-authenticate"?: string | undefined | undefined; ":status"?: number | undefined | undefined; }; data: { anyoneCanAddSelf?: boolean | null | undefined; attachments?: { fileId?: string | null | undefined; fileUrl?: string | null | undefined; iconLink?: string | null | undefined; mimeType?: string | null | undefined; title?: string | null | undefined; }[] | undefined; attendees?: { additionalGuests?: number | null | undefined; comment?: string | null | undefined; displayName?: string | null | undefined; email?: string | null | undefined; id?: string | null | undefined; optional?: boolean | null | undefined; organizer?: boolean | null | undefined; resource?: boolean | null | undefined; responseStatus?: string | null | undefined; self?: boolean | null | undefined; }[] | undefined; attendeesOmitted?: boolean | null | undefined; birthdayProperties?: { contact?: string | null | undefined; customTypeName?: string | null | undefined; type?: string | null | undefined; } | undefined; colorId?: string | null | undefined; conferenceData?: { conferenceId?: string | null | undefined; conferenceSolution?: { iconUri?: string | null | undefined; key?: { type?: string | null | undefined; } | undefined; name?: string | null | undefined; } | undefined; createRequest?: { conferenceSolutionKey?: { type?: string | null | undefined; } | undefined; requestId?: string | null | undefined; status?: { statusCode?: string | null | undefined; } | undefined; } | undefined; entryPoints?: { accessCode?: string | null | undefined; entryPointFeatures?: string[] | null | undefined; entryPointType?: string | null | undefined; label?: string | null | undefined; meetingCode?: string | null | undefined; passcode?: string | null | undefined; password?: string | null | undefined; pin?: string | null | undefined; regionCode?: string | null | undefined; uri?: string | null | undefined; }[] | undefined; notes?: string | null | undefined; parameters?: { addOnParameters?: { parameters?: { [x: string]: string; } | null | undefined; } | undefined; } | undefined; signature?: string | null | undefined; } | undefined; created?: string | null | undefined; creator?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; description?: string | null | undefined; end?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; endTimeUnspecified?: boolean | null | undefined; etag?: string | null | undefined; eventType?: string | null | undefined; extendedProperties?: { private?: { [x: string]: string; } | undefined; shared?: { [x: string]: string; } | undefined; } | null | undefined; focusTimeProperties?: { autoDeclineMode?: string | null | undefined; chatStatus?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; gadget?: { display?: string | undefined; height?: number | undefined; iconLink?: string | undefined; link?: string | undefined; preferences?: { [x: string]: string; } | undefined; title?: string | undefined; type?: string | undefined; width?: number | undefined; } | null | undefined; guestsCanInviteOthers?: boolean | null | undefined; guestsCanModify?: boolean | null | undefined; guestsCanSeeOtherGuests?: boolean | null | undefined; hangoutLink?: string | null | undefined; htmlLink?: string | null | undefined; iCalUID?: string | null | undefined; id?: string | null | undefined; kind?: string | null | undefined; location?: string | null | undefined; locked?: boolean | null | undefined; organizer?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; originalStartTime?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; outOfOfficeProperties?: { autoDeclineMode?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; privateCopy?: boolean | null | undefined; recurrence?: string[] | null | undefined; recurringEventId?: string | null | undefined; reminders?: { overrides?: { method?: string | null | undefined; minutes?: number | null | undefined; }[] | undefined; useDefault?: boolean | undefined; } | null | undefined; sequence?: number | null | undefined; source?: { title?: string | undefined; url?: string | undefined; } | null | undefined; start?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; status?: string | null | undefined; summary?: string | null | undefined; transparency?: string | null | undefined; updated?: string | null | undefined; visibility?: string | null | undefined; workingLocationProperties?: { customLocation?: { label?: string | undefined; } | null | undefined; homeOffice?: any | null; officeLocation?: { buildingId?: string | undefined; deskId?: string | undefined; floorId?: string | undefined; floorSectionId?: string | undefined; label?: string | undefined; } | null | undefined; type?: string | null | undefined; } | undefined; }; readonly type: ResponseType; readonly url: string; readonly status: number; readonly ok: boolean; config: { headers: { [x: string]: string; "set-cookie"?: string[] | undefined; }; url: string; adapter?: undefined; baseURL?: string | undefined; data?: string | {} | { readonly lastModified: number; readonly name: string; readonly webkitRelativePath: string; readonly size: number; readonly type: string; slice: never; image: never; } | { readonly size: number; readonly type: string; slice: never; image: never; } | { append: never; delete: never; get: never; getAll: never; has: never; set: never; forEach: never; } | { readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; destroyed: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; setEncoding: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; pipe: never; setMaxListeners: never; } | { type: "Buffer"; data: number[]; } | { readonly locked: boolean; pipeThrough: never; pipeTo: never; values: never; } | { [x: string]: string; } | { readonly byteLength: number; slice: never; resize: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; toBase64: never; setFromBase64: never; setFromHex: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: never; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; includes: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; toLocaleString: never; at: never; } | { [x: number]: never; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; includes: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; toLocaleString: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; at: never; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; findLast: never; findLastIndex: never; forEach: never; includes: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; toLocaleString: never; toSorted: never; with: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { [x: number]: number; readonly BYTES_PER_ELEMENT: number; readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; copyWithin: never; every: never; fill: never; filter: never; find: never; findIndex: never; forEach: never; indexOf: never; join: never; lastIndexOf: never; readonly length: number; map: never; reduce: never; reduceRight: never; set: never; slice: never; some: never; sort: never; subarray: never; includes: never; at: never; } | { readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; getFloat32: never; getFloat64: never; getInt8: never; getInt16: never; getInt32: never; getUint8: never; getUint16: never; getUint32: never; setFloat32: never; setFloat64: never; setInt8: never; setInt16: never; setInt32: never; setUint8: never; setUint16: never; setUint32: never; getBigInt64: never; getBigUint64: never; setBigInt64: never; setBigUint64: never; getFloat16: never; setFloat16: never; } | {} | { readonly size: number; readonly type: string; slice: never; image: never; } | { append: never; set: never; get: never; getAll: never; has: never; delete: never; forEach: never; } | {} | { readonly buffer: { readonly byteLength: number; slice: never; resize: never; } | { readonly byteLength: number; slice: never; grow: never; }; readonly byteLength: number; readonly byteOffset: number; } | null | undefined; maxContentLength?: number | undefined; maxRedirects?: number | undefined; follow?: number | undefined; multipart?: { headers: { [x: string]: string; "set-cookie"?: string[] | undefined; }; content: string | { readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; destroyed: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; setEncoding: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; pipe: never; setMaxListeners: never; }; }[] | undefined; params?: any; paramsSerializer?: undefined; timeout?: number | undefined; responseType?: "arraybuffer" | "blob" | "json" | "text" | "stream" | "unknown" | undefined; agent?: { maxFreeSockets: number; maxSockets: number; maxTotalSockets: number; readonly freeSockets: { readonly [x: string]: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; }[] | undefined; }; readonly sockets: { readonly [x: string]: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; }[] | undefined; }; readonly requests: { readonly [x: string]: { aborted: boolean; host: string; protocol: string; reusedSocket: boolean; maxHeadersCount: number; method: string; path: string; onSocket: never; setTimeout: never; setNoDelay: never; setSocketKeepAlive: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; readonly req: { aborted: boolean; httpVersion: string; httpVersionMajor: number; httpVersionMinor: number; complete: boolean; connection: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; }; socket: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; }; headers: { [x: string]: string | string[] | undefined; accept?: string | undefined | undefined; "accept-encoding"?: string | undefined | undefined; "accept-language"?: string | undefined | undefined; "accept-patch"?: string | undefined | undefined; "accept-ranges"?: string | undefined | undefined; "access-control-allow-credentials"?: string | undefined | undefined; "access-control-allow-headers"?: string | undefined | undefined; "access-control-allow-methods"?: string | undefined | undefined; "access-control-allow-origin"?: string | undefined | undefined; "access-control-expose-headers"?: string | undefined | undefined; "access-control-max-age"?: string | undefined | undefined; "access-control-request-headers"?: string | undefined | undefined; "access-control-request-method"?: string | undefined | undefined; age?: string | undefined | undefined; allow?: string | undefined | undefined; "alt-svc"?: string | undefined | undefined; authorization?: string | undefined | undefined; "cache-control"?: string | undefined | undefined; connection?: string | undefined | undefined; "content-disposition"?: string | undefined | undefined; "content-encoding"?: string | undefined | undefined; "content-language"?: string | undefined | undefined; "content-length"?: string | undefined | undefined; "content-location"?: string | undefined | undefined; "content-range"?: string | undefined | undefined; "content-type"?: string | undefined | undefined; cookie?: string | undefined | undefined; date?: string | undefined | undefined; etag?: string | undefined | undefined; expect?: string | undefined | undefined; expires?: string | undefined | undefined; forwarded?: string | undefined | undefined; from?: string | undefined | undefined; host?: string | undefined | undefined; "if-match"?: string | undefined | undefined; "if-modified-since"?: string | undefined | undefined; "if-none-match"?: string | undefined | undefined; "if-unmodified-since"?: string | undefined | undefined; "last-modified"?: string | undefined | undefined; location?: string | undefined | undefined; origin?: string | undefined | undefined; pragma?: string | undefined | undefined; "proxy-authenticate"?: string | undefined | undefined; "proxy-authorization"?: string | undefined | undefined; "public-key-pins"?: string | undefined | undefined; range?: string | undefined | undefined; referer?: string | undefined | undefined; "retry-after"?: string | undefined | undefined; "sec-fetch-site"?: string | undefined | undefined; "sec-fetch-mode"?: string | undefined | undefined; "sec-fetch-user"?: string | undefined | undefined; "sec-fetch-dest"?: string | undefined | undefined; "sec-websocket-accept"?: string | undefined | undefined; "sec-websocket-extensions"?: string | undefined | undefined; "sec-websocket-key"?: string | undefined | undefined; "sec-websocket-protocol"?: string | undefined | undefined; "sec-websocket-version"?: string | undefined | undefined; "set-cookie"?: string[] | undefined | undefined; "strict-transport-security"?: string | undefined | undefined; tk?: string | undefined | undefined; trailer?: string | undefined | undefined; "transfer-encoding"?: string | undefined | undefined; upgrade?: string | undefined | undefined; "user-agent"?: string | undefined | undefined; vary?: string | undefined | undefined; via?: string | undefined | undefined; warning?: string | undefined | undefined; "www-authenticate"?: string | undefined | undefined; }; headersDistinct: { [x: string]: string[] | undefined; }; rawHeaders: string[]; trailers: { [x: string]: string | undefined; }; trailersDistinct: { [x: string]: string[] | undefined; }; rawTrailers: string[]; setTimeout: never; readonly signal: { readonly aborted: boolean; onabort: null; readonly reason: any; addEventListener: never; removeEventListener: never; dispatchEvent: never; }; method?: string | undefined | undefined; url?: string | undefined | undefined; statusCode?: number | undefined | undefined; statusMessage?: string | undefined | undefined; destroy: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; destroyed: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; setEncoding: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; pipe: never; setMaxListeners: never; }; chunkedEncoding: boolean; shouldKeepAlive: boolean; useChunkedEncodingByDefault: boolean; sendDate: boolean; finished: boolean; readonly headersSent: boolean; readonly connection: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; } | null; readonly socket: { write: never; connect: never; setEncoding: never; setTimeout: never; setNoDelay: never; setKeepAlive: never; setTypeOfService: never; readonly autoSelectFamilyAttemptedAddresses: string[]; readonly bufferSize: number; readonly bytesRead: number; readonly bytesWritten: number; readonly connecting: boolean; readonly pending: boolean; readonly destroyed: boolean; readonly localAddress?: string | undefined; readonly localPort?: number | undefined; readonly localFamily?: string | undefined; readonly readyState: import("node:net").SocketReadyState; readonly remoteAddress: string | undefined; readonly remoteFamily: string | undefined; readonly remotePort: number | undefined; readonly timeout?: number | undefined; end: never; addListener: never; listenerCount: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; removeListener: never; allowHalfOpen: boolean; pipe: never; setMaxListeners: never; readonly readableAborted: boolean; readable: boolean; readonly readableDidRead: boolean; readonly readableEncoding: BufferEncoding | null; readonly readableEnded: boolean; readableFlowing: boolean | null; readonly readableHighWaterMark: number; readonly readableLength: number; readonly readableObjectMode: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; _construct?: undefined; _read: never; read: never; unpipe: never; unshift: never; wrap: never; push: never; compose: never; iterator: never; map: never; filter: never; forEach: never; toArray: never; some: never; find: never; every: never; flatMap: never; drop: never; take: never; reduce: never; _destroy: never; destroy: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _final: never; setDefaultEncoding: never; } | null; setHeader: never; setHeaders: never; appendHeader: never; getHeader: never; hasHeader: never; removeHeader: never; addTrailers: never; writable: boolean; readonly writableAborted: boolean; readonly writableEnded: boolean; readonly writableFinished: boolean; readonly writableHighWaterMark: number; readonly writableLength: number; readonly writableObjectMode: boolean; readonly writableCorked: number; destroyed: boolean; readonly closed: boolean; readonly errored: { name: string; message: string; stack?: string | undefined; cause?: import("hono/utils/types").JSONValue | undefined; } | null; readonly writableNeedDrain: boolean; _write: never; _writev?: undefined; _construct?: undefined; _destroy: never; _final: never; write: never; setDefaultEncoding: never; end: never; destroy: never; pipe: never; setMaxListeners: never; }[] | undefined; }; createConnection: never; keepSocketAlive: never; reuseSocket: never; getName: never; addListener: never; emit: never; listenerCount: never; listeners: never; off: never; on: never; once: never; prependListener: never; prependOnceListener: never; rawListeners: never; removeAllListeners: never; removeListener: never; setMaxListeners: never; } | undefined; validateStatus?: undefined; retryConfig?: { retry?: number | undefined; currentRetryAttempt?: number | undefined; retryDelay?: number | undefined; httpMethodsToRetry?: string[] | undefined; statusCodesToRetry?: number[][] | undefined; onRetryAttempt?: undefined; shouldRetry?: undefined; noResponseRetries?: number | undefined; retryBackoff?: undefined; timeOfFirstRequest?: number | undefined; totalTimeout?: number | undefined; maxRetryDelay?: number | undefined; retryDelayMultiplier?: number | undefined; } | undefined; retry?: boolean | undefined; size?: number | undefined; fetchImplementation?: { preconnect: never; } | undefined; cert?: string | undefined; key?: string | undefined; proxy?: string | undefined; noProxy?: (string | { exec: never; test: never; readonly source: string; readonly global: boolean; readonly ignoreCase: boolean; readonly multiline: boolean; lastIndex: number; compile: never; readonly flags: string; readonly sticky: boolean; readonly unicode: boolean; readonly dotAll: boolean; readonly hasIndices: boolean; })[] | undefined; errorRedactor?: false | undefined; body?: string | { readonly size: number; readonly type: string; slice: never; image: never; } | { append: never; delete: never; get: never; getAll: never; has: never; set: never; forEach: never; } | { [x: string]: string; } | { readonly byteLength: number; slice: never; resize: never; } | { readonly locked: boolean; pipeThrough: never; pipeTo: never; values: never; } | { readonly buffer: { readonly byteLength: number; slice: never; resize: never; }; readonly byteLength: number; readonly byteOffset: number; } | null | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; integrity?: string | undefined; keepalive?: boolean | undefined; method?: string | undefined; mode?: RequestMode | undefined; priority?: RequestPriority | undefined; redirect?: RequestRedirect | undefined; referrer?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; signal?: { readonly aborted: boolean; onabort: null; readonly reason: any; addEventListener: never; removeEventListener: never; dispatchEvent: never; } | null | undefined; window?: null | undefined; }; readonly redirected: boolean; readonly statusText: string; readonly body: { readonly locked: boolean; pipeThrough: never; pipeTo: never; values: never; } | null; readonly bodyUsed: boolean; }; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/:workspace/get-event": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: true; event: { anyoneCanAddSelf?: boolean | null | undefined; attachments?: { fileId?: string | null | undefined; fileUrl?: string | null | undefined; iconLink?: string | null | undefined; mimeType?: string | null | undefined; title?: string | null | undefined; }[] | undefined; attendees?: { additionalGuests?: number | null | undefined; comment?: string | null | undefined; displayName?: string | null | undefined; email?: string | null | undefined; id?: string | null | undefined; optional?: boolean | null | undefined; organizer?: boolean | null | undefined; resource?: boolean | null | undefined; responseStatus?: string | null | undefined; self?: boolean | null | undefined; }[] | undefined; attendeesOmitted?: boolean | null | undefined; birthdayProperties?: { contact?: string | null | undefined; customTypeName?: string | null | undefined; type?: string | null | undefined; } | undefined; colorId?: string | null | undefined; conferenceData?: { conferenceId?: string | null | undefined; conferenceSolution?: { iconUri?: string | null | undefined; key?: { type?: string | null | undefined; } | undefined; name?: string | null | undefined; } | undefined; createRequest?: { conferenceSolutionKey?: { type?: string | null | undefined; } | undefined; requestId?: string | null | undefined; status?: { statusCode?: string | null | undefined; } | undefined; } | undefined; entryPoints?: { accessCode?: string | null | undefined; entryPointFeatures?: string[] | null | undefined; entryPointType?: string | null | undefined; label?: string | null | undefined; meetingCode?: string | null | undefined; passcode?: string | null | undefined; password?: string | null | undefined; pin?: string | null | undefined; regionCode?: string | null | undefined; uri?: string | null | undefined; }[] | undefined; notes?: string | null | undefined; parameters?: { addOnParameters?: { parameters?: { [x: string]: string; } | null | undefined; } | undefined; } | undefined; signature?: string | null | undefined; } | undefined; created?: string | null | undefined; creator?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; description?: string | null | undefined; end?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; endTimeUnspecified?: boolean | null | undefined; etag?: string | null | undefined; eventType?: string | null | undefined; extendedProperties?: { private?: { [x: string]: string; } | undefined; shared?: { [x: string]: string; } | undefined; } | null | undefined; focusTimeProperties?: { autoDeclineMode?: string | null | undefined; chatStatus?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; gadget?: { display?: string | undefined; height?: number | undefined; iconLink?: string | undefined; link?: string | undefined; preferences?: { [x: string]: string; } | undefined; title?: string | undefined; type?: string | undefined; width?: number | undefined; } | null | undefined; guestsCanInviteOthers?: boolean | null | undefined; guestsCanModify?: boolean | null | undefined; guestsCanSeeOtherGuests?: boolean | null | undefined; hangoutLink?: string | null | undefined; htmlLink?: string | null | undefined; iCalUID?: string | null | undefined; id?: string | null | undefined; kind?: string | null | undefined; location?: string | null | undefined; locked?: boolean | null | undefined; organizer?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; originalStartTime?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; outOfOfficeProperties?: { autoDeclineMode?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; privateCopy?: boolean | null | undefined; recurrence?: string[] | null | undefined; recurringEventId?: string | null | undefined; reminders?: { overrides?: { method?: string | null | undefined; minutes?: number | null | undefined; }[] | undefined; useDefault?: boolean | undefined; } | null | undefined; sequence?: number | null | undefined; source?: { title?: string | undefined; url?: string | undefined; } | null | undefined; start?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; status?: string | null | undefined; summary?: string | null | undefined; transparency?: string | null | undefined; updated?: string | null | undefined; visibility?: string | null | undefined; workingLocationProperties?: { customLocation?: { label?: string | undefined; } | null | undefined; homeOffice?: any | null; officeLocation?: { buildingId?: string | undefined; deskId?: string | undefined; floorId?: string | undefined; floorSectionId?: string | undefined; label?: string | undefined; } | null | undefined; type?: string | null | undefined; } | undefined; }; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/update-event": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: import("hono/utils/types").JSONValue; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; event: { anyoneCanAddSelf?: boolean | null | undefined; attachments?: { fileId?: string | null | undefined; fileUrl?: string | null | undefined; iconLink?: string | null | undefined; mimeType?: string | null | undefined; title?: string | null | undefined; }[] | undefined; attendees?: { additionalGuests?: number | null | undefined; comment?: string | null | undefined; displayName?: string | null | undefined; email?: string | null | undefined; id?: string | null | undefined; optional?: boolean | null | undefined; organizer?: boolean | null | undefined; resource?: boolean | null | undefined; responseStatus?: string | null | undefined; self?: boolean | null | undefined; }[] | undefined; attendeesOmitted?: boolean | null | undefined; birthdayProperties?: { contact?: string | null | undefined; customTypeName?: string | null | undefined; type?: string | null | undefined; } | undefined; colorId?: string | null | undefined; conferenceData?: { conferenceId?: string | null | undefined; conferenceSolution?: { iconUri?: string | null | undefined; key?: { type?: string | null | undefined; } | undefined; name?: string | null | undefined; } | undefined; createRequest?: { conferenceSolutionKey?: { type?: string | null | undefined; } | undefined; requestId?: string | null | undefined; status?: { statusCode?: string | null | undefined; } | undefined; } | undefined; entryPoints?: { accessCode?: string | null | undefined; entryPointFeatures?: string[] | null | undefined; entryPointType?: string | null | undefined; label?: string | null | undefined; meetingCode?: string | null | undefined; passcode?: string | null | undefined; password?: string | null | undefined; pin?: string | null | undefined; regionCode?: string | null | undefined; uri?: string | null | undefined; }[] | undefined; notes?: string | null | undefined; parameters?: { addOnParameters?: { parameters?: { [x: string]: string; } | null | undefined; } | undefined; } | undefined; signature?: string | null | undefined; } | undefined; created?: string | null | undefined; creator?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; description?: string | null | undefined; end?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; endTimeUnspecified?: boolean | null | undefined; etag?: string | null | undefined; eventType?: string | null | undefined; extendedProperties?: { private?: { [x: string]: string; } | undefined; shared?: { [x: string]: string; } | undefined; } | null | undefined; focusTimeProperties?: { autoDeclineMode?: string | null | undefined; chatStatus?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; gadget?: { display?: string | undefined; height?: number | undefined; iconLink?: string | undefined; link?: string | undefined; preferences?: { [x: string]: string; } | undefined; title?: string | undefined; type?: string | undefined; width?: number | undefined; } | null | undefined; guestsCanInviteOthers?: boolean | null | undefined; guestsCanModify?: boolean | null | undefined; guestsCanSeeOtherGuests?: boolean | null | undefined; hangoutLink?: string | null | undefined; htmlLink?: string | null | undefined; iCalUID?: string | null | undefined; id?: string | null | undefined; kind?: string | null | undefined; location?: string | null | undefined; locked?: boolean | null | undefined; organizer?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; originalStartTime?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; outOfOfficeProperties?: { autoDeclineMode?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; privateCopy?: boolean | null | undefined; recurrence?: string[] | null | undefined; recurringEventId?: string | null | undefined; reminders?: { overrides?: { method?: string | null | undefined; minutes?: number | null | undefined; }[] | undefined; useDefault?: boolean | undefined; } | null | undefined; sequence?: number | null | undefined; source?: { title?: string | undefined; url?: string | undefined; } | null | undefined; start?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; status?: string | null | undefined; summary?: string | null | undefined; transparency?: string | null | undefined; updated?: string | null | undefined; visibility?: string | null | undefined; workingLocationProperties?: { customLocation?: { label?: string | undefined; } | null | undefined; homeOffice?: any | null; officeLocation?: { buildingId?: string | undefined; deskId?: string | undefined; floorId?: string | undefined; floorSectionId?: string | undefined; label?: string | undefined; } | null | undefined; type?: string | null | undefined; } | undefined; }; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/remove-event": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: import("hono/utils/types").JSONValue; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/cancel-event": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: import("hono/utils/types").JSONValue; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/:workspace/list-events-by-month": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; events: { anyoneCanAddSelf?: boolean | null | undefined; attachments?: { fileId?: string | null | undefined; fileUrl?: string | null | undefined; iconLink?: string | null | undefined; mimeType?: string | null | undefined; title?: string | null | undefined; }[] | undefined; attendees?: { additionalGuests?: number | null | undefined; comment?: string | null | undefined; displayName?: string | null | undefined; email?: string | null | undefined; id?: string | null | undefined; optional?: boolean | null | undefined; organizer?: boolean | null | undefined; resource?: boolean | null | undefined; responseStatus?: string | null | undefined; self?: boolean | null | undefined; }[] | undefined; attendeesOmitted?: boolean | null | undefined; birthdayProperties?: { contact?: string | null | undefined; customTypeName?: string | null | undefined; type?: string | null | undefined; } | undefined; colorId?: string | null | undefined; conferenceData?: { conferenceId?: string | null | undefined; conferenceSolution?: { iconUri?: string | null | undefined; key?: { type?: string | null | undefined; } | undefined; name?: string | null | undefined; } | undefined; createRequest?: { conferenceSolutionKey?: { type?: string | null | undefined; } | undefined; requestId?: string | null | undefined; status?: { statusCode?: string | null | undefined; } | undefined; } | undefined; entryPoints?: { accessCode?: string | null | undefined; entryPointFeatures?: string[] | null | undefined; entryPointType?: string | null | undefined; label?: string | null | undefined; meetingCode?: string | null | undefined; passcode?: string | null | undefined; password?: string | null | undefined; pin?: string | null | undefined; regionCode?: string | null | undefined; uri?: string | null | undefined; }[] | undefined; notes?: string | null | undefined; parameters?: { addOnParameters?: { parameters?: { [x: string]: string; } | null | undefined; } | undefined; } | undefined; signature?: string | null | undefined; } | undefined; created?: string | null | undefined; creator?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; description?: string | null | undefined; end?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; endTimeUnspecified?: boolean | null | undefined; etag?: string | null | undefined; eventType?: string | null | undefined; extendedProperties?: { private?: { [x: string]: string; } | undefined; shared?: { [x: string]: string; } | undefined; } | null | undefined; focusTimeProperties?: { autoDeclineMode?: string | null | undefined; chatStatus?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; gadget?: { display?: string | undefined; height?: number | undefined; iconLink?: string | undefined; link?: string | undefined; preferences?: { [x: string]: string; } | undefined; title?: string | undefined; type?: string | undefined; width?: number | undefined; } | null | undefined; guestsCanInviteOthers?: boolean | null | undefined; guestsCanModify?: boolean | null | undefined; guestsCanSeeOtherGuests?: boolean | null | undefined; hangoutLink?: string | null | undefined; htmlLink?: string | null | undefined; iCalUID?: string | null | undefined; id?: string | null | undefined; kind?: string | null | undefined; location?: string | null | undefined; locked?: boolean | null | undefined; organizer?: { displayName?: string | undefined; email?: string | undefined; id?: string | undefined; self?: boolean | undefined; } | null | undefined; originalStartTime?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; outOfOfficeProperties?: { autoDeclineMode?: string | null | undefined; declineMessage?: string | null | undefined; } | undefined; privateCopy?: boolean | null | undefined; recurrence?: string[] | null | undefined; recurringEventId?: string | null | undefined; reminders?: { overrides?: { method?: string | null | undefined; minutes?: number | null | undefined; }[] | undefined; useDefault?: boolean | undefined; } | null | undefined; sequence?: number | null | undefined; source?: { title?: string | undefined; url?: string | undefined; } | null | undefined; start?: { date?: string | null | undefined; dateTime?: string | null | undefined; timeZone?: string | null | undefined; } | undefined; status?: string | null | undefined; summary?: string | null | undefined; transparency?: string | null | undefined; updated?: string | null | undefined; visibility?: string | null | undefined; workingLocationProperties?: { customLocation?: { label?: string | undefined; } | null | undefined; homeOffice?: any | null; officeLocation?: { buildingId?: string | undefined; deskId?: string | undefined; floorId?: string | undefined; floorSectionId?: string | undefined; label?: string | undefined; } | null | undefined; type?: string | null | undefined; } | undefined; }[] | undefined; }; outputFormat: "json"; status: 200; }; }; } & { "/calendar/list-assignees-by-workspace/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; assignees: { collaboratorId: string; role: string; profilePicture: string | null; firstName: string | null; lastName: string | null; email: string; }[]; }; outputFormat: "json"; status: 200; }; }; }, "/integrations"> | import("hono/types").MergeSchemaPath<{ "/upload": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/create-folder": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; message: string; key: string; }; outputFormat: "json"; status: 201; }; }; } & { "/delete-folder": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; message: string; }; outputFormat: "json"; status: 200; }; }; } & { "/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; files: { key: string | undefined; size: number | undefined; lastModified: string | undefined; pin: boolean; }[]; nextToken: string | undefined; }; outputFormat: "json"; status: 200; }; }; } & { "/usage/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; usedBytes: number; filesBytes: number; commentsBytes: number; customerBytes: number; servicesBytes: number; financeBytes: number; limitBytes: number | null; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/download/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: true; url: string; expiresIn: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/pin": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; message: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; message: string; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/move": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 409; } | { input: {}; output: { success: true; from: string; to: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/upload-to-comment": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm-comment-file": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/delete-comment-file": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; message: string; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/download-from-task/:workspace/:taskId": { $get: { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { taskId: string; }; }; output: { success: true; files: { key: string; filename: string; commentId: string; size: number; lastModified: string | null; downloadUrl: string; }[]; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/upload-profile-picture": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm-profile-picture": { $post: { input: {}; output: { success: true; url: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/delete-profile-picture": { $post: { input: {}; output: { success: true; message: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; }; }; } & { "/upload-workspace-picture": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm-workspace-picture": { $post: { input: {}; output: { success: true; url: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/delete-workspace-picture": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; message: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; }; }; } & { "/upload-to-service": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm-service-file": { $post: { input: {}; output: { success: true; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/download-from-service/:workspace/:serviceId": { $get: { input: { param: { workspace: string; } & { serviceId: string; }; }; output: { success: true; files: { key: string; filename: string; size: number; lastModified: string | null; downloadUrl: string; }[]; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/delete-service-file": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; message: string; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/upload-to-customer": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm-customer-file": { $post: { input: {}; output: { success: true; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/download-from-customer/:workspace/:customerId": { $get: { input: { param: { workspace: string; } & { customerId: string; }; }; output: { success: true; files: { key: string; filename: string; size: number; lastModified: string | null; downloadUrl: string; }[]; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/delete-customer-file": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; message: string; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/upload-to-finance": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; url: string; fields: { [x: string]: string; }; key: string; maxSize: number; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/confirm-finance-file": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; }; }; } & { "/download-from-finance/:workspace/:transactionId": { $get: { input: { param: { workspace: string; } & { transactionId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { transactionId: string; }; }; output: { success: true; files: { key: string; filename: string; size: number; lastModified: string | null; downloadUrl: string; }[]; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; } & { "/delete-finance-file": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: false; message: string; key: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: { success: true; message: string; key: string; }; outputFormat: "json"; status: import("hono/utils/http-status").ContentfulStatusCode; }; }; }, "/files"> | import("hono/types").MergeSchemaPath<{ "/start": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 500; } | { input: {}; output: {}; outputFormat: "json"; status: 201; }; }; } & { "/collaborators/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; collaborators: { id: string; username: string; firstName: string | null; lastName: string | null; email: string; role: string; profilePicture: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; }, "/chat"> | import("hono/types").MergeSchemaPath<{ "/sync": { $get: { input: {}; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; notifications: { updated_at: string | null; deleted_at: string | null; verified_at: string | null; suspended_at: string | null; created_at: string; id: string; userId: string; workspaceId: string | null; key: string; data: { [x: string]: import("hono/utils/types").JSONValue; }; title: string | null; message: string | null; type: "success" | "info" | "warning" | "failure"; read: boolean; archive: boolean; }[]; cursor: string | null; hasMore: boolean; }; outputFormat: "json"; status: 200; }; }; } & { "/read": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/read-all": { $post: { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/archive": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/archive-all": { $post: { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; }, "/notifications"> | import("hono/types").MergeSchemaPath<{ "/history": { $get: { input: {}; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; invoices: { createdAt: string; id: string; workspaceId: string; workspaceName: string; seats: number; planId: string; planCode: string; planName: string; interval: string; billingCycles: number; subtotalKopecks: number; discountKopecks: number; couponCode: string | null; amountKopecks: number; currency: string; status: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/invoice/:invoiceId/pay": { $post: { input: { param: { invoiceId: string; }; }; output: { paymentUrl: string; providerPaymentId: string; success: true; }; outputFormat: "json"; status: 200; } | { input: { param: { invoiceId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 403 | 404 | 409 | 502 | 503; }; }; } & { "/invoice/:invoiceId/coupon": { $post: { input: { param: { invoiceId: string; }; }; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: { param: { invoiceId: string; }; }; output: { paymentUrl?: string | undefined; providerPaymentId?: string | undefined; success: true; invoice: { id: string; subtotalKopecks: number; discountKopecks: number; amountKopecks: number; couponCode: string | null; status: string; }; }; outputFormat: "json"; status: 200; } | { input: { param: { invoiceId: string; }; }; output: { success: false; error: string; code: string | undefined; }; outputFormat: "json"; status: 400 | 403 | 404 | 409 | 502 | 503; }; }; } & { "/invoice/:invoiceId/coupon": { $delete: { input: { param: { invoiceId: string; }; }; output: { success: true; invoice: { id: string; subtotalKopecks: number; discountKopecks: number; amountKopecks: number; couponCode: string | null; status: string; }; }; outputFormat: "json"; status: 200; } | { input: { param: { invoiceId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 403 | 404 | 409; }; }; } & { "/upgrade": { $post: { input: {}; output: { success: true; invoiceId: any; invoice: any; }; outputFormat: "json"; status: 201; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 403 | 404; }; }; } & { "/webhook": { $post: { input: {}; output: { success: true; ignored: true; }; outputFormat: "json"; status: 200; } | { input: {}; output: { success: true; invoiceId: string; }; outputFormat: "json"; status: 200; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 404 | 409 | 502 | 503; }; }; }, "/payments"> | import("hono/types").MergeSchemaPath<{ "/:workspace/task-phase-funnel": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; phases: { averageDurationDays: number | null; averageCurrentDurationDays: number | null; phaseId: string; phaseName: string; sortOrder: number; taskCount: number; visitCount: number; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/total-revenue": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; previousPeriod: { from: string; to: string; } | null; totals: { currency: string; amountMinor: number; invoiceCount: number; growth: { amountMinor: { previousValue: number; growthPercentage: number | null; direction: GrowthDirection; }; invoiceCount: { previousValue: number; growthPercentage: number | null; direction: GrowthDirection; }; } | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/leads-by-source": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; sources: { leadSource: string; leadCount: number; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/conversion-rate": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; paidInvoiceCount: number; customerCount: number; conversionRate: number; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/employee-conversion-rate": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; employees: { collaboratorId: string; userId: string; firstName: string | null; lastName: string | null; profilePicture: string | null; status: string; assignedCustomerCount: number; convertedCustomerCount: number; conversionRate: number; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/workload-distribution": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; employees: { taskCount: number; collaboratorId: string; userId: string; firstName: string | null; lastName: string | null; profilePicture: string | null; status: string; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/channel-performance": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; channels: { leadSource: string; currency: string; paidAmountMinor: number; paidInvoiceCount: number; pendingAmountMinor: number; pendingInvoiceCount: number; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/:workspace/forecast-revenue": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: { [x: string]: import("hono/utils/types").JSONValue; }; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; }; }; output: { success: true; workspaceId: string; category: string; period: { from: string | null; to: string | null; }; leadCount: number; averageDailyLeads: number | null; paidInvoiceCount: number; conversionRate: number; forecasts: { currency: string; pendingRevenueMinor: number; pendingInvoiceCount: number; averageDealSizeMinor: number; projectedPipelineMinor: number; forecastRevenueMinor: number; }[]; }; outputFormat: "json"; status: 200; }; }; }, "/analytics"> | import("hono/types").MergeSchemaPath<{ "/accounts/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; accounts: { id: string; workspaceId: string; order: number; name: string; cardColor: string; currency: FinanceCurrency; openingBalance: number; country: string | null; companyName: string | null; companyAccountNumber: string | null; companyInn: string | null; companyKpp: string | null; companyOgrn: string | null; bankName: string | null; bankBik: string | null; bankKc: string | null; bankInn: string | null; bankKpp: string | null; vatRate: number | null; active: boolean; created_at: string; updated_at: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/accounts/get/:workspace/:accountId": { $get: { input: { param: { workspace: string; } & { accountId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { accountId: string; }; }; output: { success: true; account: { id: string; workspaceId: string; order: number; name: string; cardColor: string; currency: FinanceCurrency; openingBalance: number; country: string | null; companyName: string | null; companyAccountNumber: string | null; companyInn: string | null; companyKpp: string | null; companyOgrn: string | null; bankName: string | null; bankBik: string | null; bankKc: string | null; bankInn: string | null; bankKpp: string | null; vatRate: number | null; active: boolean; created_at: string; updated_at: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/accounts/create": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; account: { id: string; workspaceId: string; order: number; name: string; cardColor: string; currency: FinanceCurrency; openingBalance: number; country: string | null; companyName: string | null; companyAccountNumber: string | null; companyInn: string | null; companyKpp: string | null; companyOgrn: string | null; bankName: string | null; bankBik: string | null; bankKc: string | null; bankInn: string | null; bankKpp: string | null; vatRate: number | null; active: boolean; created_at: string; updated_at: string | null; }; }; outputFormat: "json"; status: 201; }; }; } & { "/accounts/update": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; account: { id: string; workspaceId: string; order: number; name: string; cardColor: string; currency: FinanceCurrency; openingBalance: number; country: string | null; companyName: string | null; companyAccountNumber: string | null; companyInn: string | null; companyKpp: string | null; companyOgrn: string | null; bankName: string | null; bankBik: string | null; bankKc: string | null; bankInn: string | null; bankKpp: string | null; vatRate: number | null; active: boolean; created_at: string; updated_at: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/accounts/reorder": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; accounts: { id: string; workspaceId: string; order: number; name: string; cardColor: string; currency: FinanceCurrency; openingBalance: number; country: string | null; companyName: string | null; companyAccountNumber: string | null; companyInn: string | null; companyKpp: string | null; companyOgrn: string | null; bankName: string | null; bankBik: string | null; bankKc: string | null; bankInn: string | null; bankKpp: string | null; vatRate: number | null; active: boolean; created_at: string; updated_at: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/accounts/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/transactions/list/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 400; } | { input: { param: { workspace: string; }; }; output: { success: true; transactions: { id: string; workspaceId: string; type: FinanceTransactionType; customerId: string | null; serviceId: string | null; accountId: string | null; destinationAccountId: string | null; paymentMethod: string | null; amount: number; description: string | null; date: string; vat: number | null; reason: string | null; created_at: string; updated_at: string | null; }[]; }; outputFormat: "json"; status: 200; }; }; } & { "/transactions/get/:workspace/:transactionId": { $get: { input: { param: { workspace: string; } & { transactionId: string; }; }; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: { param: { workspace: string; } & { transactionId: string; }; }; output: { success: true; transaction: { id: string; workspaceId: string; type: FinanceTransactionType; customerId: string | null; serviceId: string | null; accountId: string | null; destinationAccountId: string | null; paymentMethod: string | null; amount: number; description: string | null; date: string; vat: number | null; reason: string | null; created_at: string; updated_at: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/transactions/create": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 404; } | { input: {}; output: { success: true; transaction: { id: string; workspaceId: string; type: FinanceTransactionType; customerId: string | null; serviceId: string | null; accountId: string | null; destinationAccountId: string | null; paymentMethod: string | null; amount: number; description: string | null; date: string; vat: number | null; reason: string | null; created_at: string; updated_at: string | null; }; }; outputFormat: "json"; status: 201; }; }; } & { "/transactions/update": { $post: { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 400 | 404; } | { input: {}; output: { success: true; transaction: { id: string; workspaceId: string; type: FinanceTransactionType; customerId: string | null; serviceId: string | null; accountId: string | null; destinationAccountId: string | null; paymentMethod: string | null; amount: number; description: string | null; date: string; vat: number | null; reason: string | null; created_at: string; updated_at: string | null; }; }; outputFormat: "json"; status: 200; }; }; } & { "/transactions/delete": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: false; error: string; }; outputFormat: "json"; status: 404; } | { input: {}; output: { success: true; }; outputFormat: "json"; status: 200; }; }; } & { "/visibility/:workspace": { $get: { input: { param: { workspace: string; }; }; output: { success: true; visibility: boolean; }; outputFormat: "json"; status: 200; }; }; } & { "/visibility": { $post: { input: {}; output: { success: false; error: never; }; outputFormat: "json"; status: 400; } | { input: {}; output: { success: true; visibility: boolean; }; outputFormat: "json"; status: 200; }; }; }, "/finance">, "/", "/">; type GlobalErrorResponses = { 400: { json: ApiError; }; 401: { json: ApiError; }; 403: { json: ApiError; }; 404: { json: ApiError; }; 429: { json: ApiError; }; 500: { json: ApiError; }; }; /** AppType for `hc` — includes route responses plus global auth/middleware error statuses. */ export type AppType = ApplyGlobalResponse;