evo360-types 1.3.570 → 1.3.574
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/evo-crm/lead/zod-schemas.d.ts +9 -9
- package/dist/apps/evo-csq/zod-schemas.d.ts +12 -12
- package/dist/apps/evo-finops/zod-schemas.d.ts +18 -18
- package/dist/apps/evo-med/dic/zod-schemas.d.ts +2 -2
- package/dist/apps/evo-med/people/zod-schemas.d.ts +45 -45
- package/dist/apps/evo-notifications/quick-reply-action/zod-schemas.d.ts +3 -0
- package/dist/apps/evo-notifications/quick-reply-action/zod-schemas.js +3 -0
- package/dist/apps/evo-notifications/quick-reply-action/zod-schemas.ts +3 -0
- package/dist/apps/evo-notifications/zod-schemas.d.ts +69 -39
- package/dist/apps/evo-task/zod-schemas.d.ts +69 -69
- package/dist/apps/evo-task/zod-schemas.js +8 -0
- package/dist/apps/evo-task/zod-schemas.ts +8 -0
- package/dist/apps/evo-telemedicine/zod-schemas.d.ts +1445 -0
- package/dist/apps/evo-telemedicine/zod-schemas.js +641 -0
- package/dist/apps/evo-telemedicine/zod-schemas.ts +723 -0
- package/dist/apps/evo-tenant/zod-schemas.d.ts +94 -0
- package/dist/apps/evo-tenant/zod-schemas.js +29 -1
- package/dist/apps/evo-tenant/zod-schemas.ts +32 -1
- package/dist/apps/hub-automation/zod-schemas.d.ts +172 -172
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.ts +2 -0
- package/dist/types/evo-med/calendar/index.d.ts +6 -0
- package/dist/types/evo-med/calendar/index.js +6 -0
- package/dist/types/evo-med/calendar/index.ts +6 -0
- package/dist/types/evo-notifications/index.d.ts +13 -0
- package/dist/types/evo-notifications/index.js +6 -0
- package/dist/types/evo-notifications/index.ts +13 -0
- package/dist/types/evo-task/index.d.ts +1 -0
- package/dist/types/evo-task/index.js +8 -0
- package/dist/types/evo-task/index.ts +8 -0
- package/dist/types/evo-telemedicine/fb_collections.d.ts +16 -0
- package/dist/types/evo-telemedicine/fb_collections.js +38 -0
- package/dist/types/evo-telemedicine/fb_collections.ts +37 -0
- package/dist/types/evo-telemedicine/index.d.ts +890 -0
- package/dist/types/evo-telemedicine/index.js +361 -0
- package/dist/types/evo-telemedicine/index.ts +1046 -0
- package/dist/types/evo-tenant/index.d.ts +45 -0
- package/dist/types/evo-tenant/index.js +20 -1
- package/dist/types/evo-tenant/index.ts +65 -0
- package/dist/types/shared/external-links.d.ts +6 -0
- package/dist/types/shared/external-links.js +6 -0
- package/dist/types/shared/external-links.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,890 @@
|
|
|
1
|
+
export * from "./fb_collections";
|
|
2
|
+
import type { IFireDoc, IFireGlobalDoc } from "../shared";
|
|
3
|
+
import type { ITenantModuleEntitlement } from "../evo-tenant";
|
|
4
|
+
export declare const EvoTelemedicinePermissions: {
|
|
5
|
+
/** Ver estado e dados operacionais básicos. */
|
|
6
|
+
readonly Read: "evo_telemedicine_read";
|
|
7
|
+
/** Preparar, admitir, entrar como médico e encerrar. */
|
|
8
|
+
readonly Host: "evo_telemedicine_host";
|
|
9
|
+
/** Solicitar/iniciar/parar gravação. */
|
|
10
|
+
readonly Record: "evo_telemedicine_record";
|
|
11
|
+
/** Listar e baixar gravações/transcrições. */
|
|
12
|
+
readonly ArtifactsRead: "evo_telemedicine_artifacts_read";
|
|
13
|
+
/** Alterar defaults permitidos do tenant; reatribuir host. */
|
|
14
|
+
readonly Configure: "evo_telemedicine_configure";
|
|
15
|
+
/** Consultar trilha detalhada (events). */
|
|
16
|
+
readonly AuditRead: "evo_telemedicine_audit_read";
|
|
17
|
+
};
|
|
18
|
+
export type EvoTelemedicinePermissions = (typeof EvoTelemedicinePermissions)[keyof typeof EvoTelemedicinePermissions];
|
|
19
|
+
/** `action_type` do quick-reply `/qr` que redireciona para `/api/public/v1/enter/{cap}` (redirect puro, reexecutável). */
|
|
20
|
+
export declare const TELEMEDICINE_JOIN_ACTION_TYPE = "telemedicine_join";
|
|
21
|
+
/** Handler do lembrete/CTA de entrada — igual a `TaskAutoHandlerEnum.TelemedicineJoinReminder`. */
|
|
22
|
+
export declare const TELEMEDICINE_JOIN_REMINDER_HANDLER = "telemedicine_join_reminder";
|
|
23
|
+
/**
|
|
24
|
+
* Defaults de janela do MVP (spec §8.2/§8.3/D23) — configuráveis só em nível de
|
|
25
|
+
* plataforma. Em minutos, salvo indicação.
|
|
26
|
+
*/
|
|
27
|
+
export declare const TELEMEDICINE_WINDOW_DEFAULTS: {
|
|
28
|
+
/** Médico prepara/entra desde N minutos antes do início previsto. */
|
|
29
|
+
readonly doctor_access_before_minutes: 30;
|
|
30
|
+
/** Paciente abre o fluxo desde N minutos antes do início previsto. */
|
|
31
|
+
readonly patient_access_before_minutes: 15;
|
|
32
|
+
/** Se nunca iniciou: expira N minutos após o fim previsto. */
|
|
33
|
+
readonly unused_expires_after_end_minutes: 120;
|
|
34
|
+
/** Reconexão após última presença do médico. */
|
|
35
|
+
readonly reconnect_grace_minutes: 10;
|
|
36
|
+
/** Code one-time de exchange (`launch_code`). */
|
|
37
|
+
readonly launch_code_ttl_minutes: 5;
|
|
38
|
+
/** Access da sessão pública do browser (`browser_session`), renovável de forma rotativa. */
|
|
39
|
+
readonly browser_session_ttl_minutes: 15;
|
|
40
|
+
/** Verificação de identidade: N falhas na janela bloqueiam o grant. */
|
|
41
|
+
readonly identity_max_failures: 5;
|
|
42
|
+
readonly identity_failure_window_minutes: 15;
|
|
43
|
+
readonly identity_block_minutes: 30;
|
|
44
|
+
/** URL assinada de artefato. */
|
|
45
|
+
readonly signed_url_max_minutes: 5;
|
|
46
|
+
/** Bits aleatórios mínimos de capability/code. */
|
|
47
|
+
readonly secret_min_bits: 128;
|
|
48
|
+
};
|
|
49
|
+
/** Estado clínico da teleconsulta (spec §10). Presença é separada (`ParticipantState`). */
|
|
50
|
+
export declare const TeleconsultationStatusEnum: {
|
|
51
|
+
/** Vínculo criado, janela fechada. */
|
|
52
|
+
readonly Scheduled: "scheduled";
|
|
53
|
+
/** Janela aberta, nenhum encontro ativo. */
|
|
54
|
+
readonly Open: "open";
|
|
55
|
+
/** Ao menos uma sessão física ativa ou presença clínica em curso. */
|
|
56
|
+
readonly Live: "live";
|
|
57
|
+
/** Consulta iniciada, médico sem presença dentro da tolerância. */
|
|
58
|
+
readonly Reconnecting: "reconnecting";
|
|
59
|
+
/** Encerramento em andamento; novos joins proibidos. */
|
|
60
|
+
readonly Ending: "ending";
|
|
61
|
+
readonly Ended: "ended";
|
|
62
|
+
readonly Cancelled: "cancelled";
|
|
63
|
+
readonly Expired: "expired";
|
|
64
|
+
};
|
|
65
|
+
export type TeleconsultationStatus = (typeof TeleconsultationStatusEnum)[keyof typeof TeleconsultationStatusEnum];
|
|
66
|
+
/** Terminais: nunca ressuscitam (webhook atrasado, reschedule, join). */
|
|
67
|
+
export declare const TELECONSULTATION_TERMINAL_STATUSES: readonly TeleconsultationStatus[];
|
|
68
|
+
export declare const WaitingPolicyEnum: {
|
|
69
|
+
/** Default. Médico admite manualmente. */
|
|
70
|
+
readonly ManualAdmit: "manual_admit";
|
|
71
|
+
/** Entrada automática só com médico `connected` e `identity_level = strong`; nunca em sala vazia. */
|
|
72
|
+
readonly AutoWhenDoctorPresent: "auto_when_doctor_present";
|
|
73
|
+
};
|
|
74
|
+
export type WaitingPolicy = (typeof WaitingPolicyEnum)[keyof typeof WaitingPolicyEnum];
|
|
75
|
+
export declare const TeleconsultationModeEnum: {
|
|
76
|
+
readonly AudioVideo: "audio_video";
|
|
77
|
+
readonly AudioOnlyAllowed: "audio_only_allowed";
|
|
78
|
+
};
|
|
79
|
+
export type TeleconsultationMode = (typeof TeleconsultationModeEnum)[keyof typeof TeleconsultationModeEnum];
|
|
80
|
+
export declare const TeleconsultationProviderEnum: {
|
|
81
|
+
readonly RealtimeKit: "realtimekit";
|
|
82
|
+
};
|
|
83
|
+
export type TeleconsultationProvider = (typeof TeleconsultationProviderEnum)[keyof typeof TeleconsultationProviderEnum];
|
|
84
|
+
export declare const ParticipantRoleEnum: {
|
|
85
|
+
readonly Doctor: "doctor";
|
|
86
|
+
readonly Patient: "patient";
|
|
87
|
+
};
|
|
88
|
+
export type ParticipantRole = (typeof ParticipantRoleEnum)[keyof typeof ParticipantRoleEnum];
|
|
89
|
+
/** Presença — separada do estado clínico da teleconsulta. */
|
|
90
|
+
export declare const ParticipantStateEnum: {
|
|
91
|
+
readonly Invited: "invited";
|
|
92
|
+
readonly Verified: "verified";
|
|
93
|
+
readonly Waiting: "waiting";
|
|
94
|
+
readonly Connected: "connected";
|
|
95
|
+
readonly Disconnected: "disconnected";
|
|
96
|
+
readonly Left: "left";
|
|
97
|
+
};
|
|
98
|
+
export type ParticipantState = (typeof ParticipantStateEnum)[keyof typeof ParticipantStateEnum];
|
|
99
|
+
/** Subconjunto de `ParticipantState` que o cliente pode reportar em `POST /presence`. */
|
|
100
|
+
export declare const PresenceStateEnum: {
|
|
101
|
+
readonly Waiting: "waiting";
|
|
102
|
+
readonly Connected: "connected";
|
|
103
|
+
readonly Disconnected: "disconnected";
|
|
104
|
+
readonly Left: "left";
|
|
105
|
+
};
|
|
106
|
+
export type PresenceState = (typeof PresenceStateEnum)[keyof typeof PresenceStateEnum];
|
|
107
|
+
/**
|
|
108
|
+
* Nível de verificação da identidade do paciente (spec §8.3): `strong` = nome +
|
|
109
|
+
* DOB conferidos; `weak` = só nome (paciente sem DOB) — proíbe `auto_admit`.
|
|
110
|
+
*/
|
|
111
|
+
export declare const IdentityLevelEnum: {
|
|
112
|
+
readonly None: "none";
|
|
113
|
+
readonly Weak: "weak";
|
|
114
|
+
readonly Strong: "strong";
|
|
115
|
+
};
|
|
116
|
+
export type IdentityLevel = (typeof IdentityLevelEnum)[keyof typeof IdentityLevelEnum];
|
|
117
|
+
export declare const RecordingStatusEnum: {
|
|
118
|
+
readonly Idle: "idle";
|
|
119
|
+
readonly ConsentPending: "consent_pending";
|
|
120
|
+
readonly Recording: "recording";
|
|
121
|
+
readonly Stopping: "stopping";
|
|
122
|
+
readonly Failed: "failed";
|
|
123
|
+
};
|
|
124
|
+
export type RecordingStatus = (typeof RecordingStatusEnum)[keyof typeof RecordingStatusEnum];
|
|
125
|
+
export declare const TranscriptionStatusEnum: {
|
|
126
|
+
readonly NotRequested: "not_requested";
|
|
127
|
+
readonly Queued: "queued";
|
|
128
|
+
readonly Processing: "processing";
|
|
129
|
+
readonly Ready: "ready";
|
|
130
|
+
readonly Failed: "failed";
|
|
131
|
+
readonly Deleted: "deleted";
|
|
132
|
+
};
|
|
133
|
+
export type TranscriptionStatus = (typeof TranscriptionStatusEnum)[keyof typeof TranscriptionStatusEnum];
|
|
134
|
+
export declare const ConsentSubjectEnum: {
|
|
135
|
+
readonly Terms: "terms";
|
|
136
|
+
readonly Privacy: "privacy";
|
|
137
|
+
readonly Recording: "recording";
|
|
138
|
+
readonly Transcription: "transcription";
|
|
139
|
+
};
|
|
140
|
+
export type ConsentSubject = (typeof ConsentSubjectEnum)[keyof typeof ConsentSubjectEnum];
|
|
141
|
+
export declare const ConsentDecisionEnum: {
|
|
142
|
+
readonly Accepted: "accepted";
|
|
143
|
+
readonly Declined: "declined";
|
|
144
|
+
readonly Withdrawn: "withdrawn";
|
|
145
|
+
};
|
|
146
|
+
export type ConsentDecision = (typeof ConsentDecisionEnum)[keyof typeof ConsentDecisionEnum];
|
|
147
|
+
export declare const ConsentActorTypeEnum: {
|
|
148
|
+
readonly Patient: "patient";
|
|
149
|
+
readonly Doctor: "doctor";
|
|
150
|
+
};
|
|
151
|
+
export type ConsentActorType = (typeof ConsentActorTypeEnum)[keyof typeof ConsentActorTypeEnum];
|
|
152
|
+
export declare const ArtifactTypeEnum: {
|
|
153
|
+
readonly RecordingAudioVideo: "recording_audio_video";
|
|
154
|
+
readonly RecordingAudio: "recording_audio";
|
|
155
|
+
readonly Transcript: "transcript";
|
|
156
|
+
};
|
|
157
|
+
export type ArtifactType = (typeof ArtifactTypeEnum)[keyof typeof ArtifactTypeEnum];
|
|
158
|
+
export declare const ArtifactStatusEnum: {
|
|
159
|
+
readonly Pending: "pending";
|
|
160
|
+
readonly Processing: "processing";
|
|
161
|
+
readonly Ready: "ready";
|
|
162
|
+
readonly Failed: "failed";
|
|
163
|
+
readonly Deleting: "deleting";
|
|
164
|
+
readonly Deleted: "deleted";
|
|
165
|
+
};
|
|
166
|
+
export type ArtifactStatus = (typeof ArtifactStatusEnum)[keyof typeof ArtifactStatusEnum];
|
|
167
|
+
export declare const AccessGrantKindEnum: {
|
|
168
|
+
/** Capability de 128 bits no link `/qr`; reexecutável na janela da teleconsulta. */
|
|
169
|
+
readonly QrCapability: "qr_capability";
|
|
170
|
+
/** Code one-time de exchange (5 min) — médico (`/launch`) ou filho do `/enter`. */
|
|
171
|
+
readonly LaunchCode: "launch_code";
|
|
172
|
+
/** Sessão do browser (cookie `__session`), 15 min, rotativa. */
|
|
173
|
+
readonly BrowserSession: "browser_session";
|
|
174
|
+
};
|
|
175
|
+
export type AccessGrantKind = (typeof AccessGrantKindEnum)[keyof typeof AccessGrantKindEnum];
|
|
176
|
+
export declare const AccessGrantStateEnum: {
|
|
177
|
+
readonly Active: "active";
|
|
178
|
+
readonly Consumed: "consumed";
|
|
179
|
+
readonly Blocked: "blocked";
|
|
180
|
+
readonly Revoked: "revoked";
|
|
181
|
+
readonly Expired: "expired";
|
|
182
|
+
};
|
|
183
|
+
export type AccessGrantState = (typeof AccessGrantStateEnum)[keyof typeof AccessGrantStateEnum];
|
|
184
|
+
/** Canal pelo qual o CTA de acesso do paciente é (re)enviado. `manual` só devolve a URL mascarada (smoke). */
|
|
185
|
+
export declare const AccessSendChannelKindEnum: {
|
|
186
|
+
readonly WhatsApp: "whatsapp";
|
|
187
|
+
readonly Email: "email";
|
|
188
|
+
readonly Manual: "manual";
|
|
189
|
+
};
|
|
190
|
+
export type AccessSendChannelKind = (typeof AccessSendChannelKindEnum)[keyof typeof AccessSendChannelKindEnum];
|
|
191
|
+
export declare const EndedByTypeEnum: {
|
|
192
|
+
readonly User: "user";
|
|
193
|
+
readonly System: "system";
|
|
194
|
+
};
|
|
195
|
+
export type EndedByType = (typeof EndedByTypeEnum)[keyof typeof EndedByTypeEnum];
|
|
196
|
+
export declare const TeleconsultationEventActorTypeEnum: {
|
|
197
|
+
readonly User: "user";
|
|
198
|
+
readonly Patient: "patient";
|
|
199
|
+
readonly System: "system";
|
|
200
|
+
readonly Provider: "provider";
|
|
201
|
+
};
|
|
202
|
+
export type TeleconsultationEventActorType = (typeof TeleconsultationEventActorTypeEnum)[keyof typeof TeleconsultationEventActorTypeEnum];
|
|
203
|
+
export declare const TeleconsultationEventSourceEnum: {
|
|
204
|
+
readonly Api: "api";
|
|
205
|
+
readonly Webhook: "webhook";
|
|
206
|
+
readonly AppointmentReconciler: "appointment_reconciler";
|
|
207
|
+
readonly RetentionJob: "retention_job";
|
|
208
|
+
/** `telemed_sweep`: expiração de não usadas, timeout de reconexão, outbox órfã. */
|
|
209
|
+
readonly Sweep: "sweep";
|
|
210
|
+
};
|
|
211
|
+
export type TeleconsultationEventSource = (typeof TeleconsultationEventSourceEnum)[keyof typeof TeleconsultationEventSourceEnum];
|
|
212
|
+
/** Tipos de evento append-only (data-model §5 + acréscimos do plan). */
|
|
213
|
+
export declare const TeleconsultationEventTypeEnum: {
|
|
214
|
+
readonly TeleconsultationCreated: "teleconsultation.created";
|
|
215
|
+
readonly TeleconsultationRescheduled: "teleconsultation.rescheduled";
|
|
216
|
+
readonly TeleconsultationCancelled: "teleconsultation.cancelled";
|
|
217
|
+
readonly TeleconsultationExpired: "teleconsultation.expired";
|
|
218
|
+
/** Alteração tardia na agenda com consulta já iniciada — tratamento operacional, não apaga o encontro. */
|
|
219
|
+
readonly TeleconsultationDiverged: "teleconsultation.diverged";
|
|
220
|
+
readonly AccessCreated: "access.created";
|
|
221
|
+
readonly AccessRevoked: "access.revoked";
|
|
222
|
+
readonly AccessExchanged: "access.exchanged";
|
|
223
|
+
readonly AccessVerificationFailed: "access.verification_failed";
|
|
224
|
+
readonly AccessBlocked: "access.blocked";
|
|
225
|
+
readonly HostClaimed: "host.claimed";
|
|
226
|
+
readonly HostReassigned: "host.reassigned";
|
|
227
|
+
readonly WaitingPolicyChanged: "waiting_policy.changed";
|
|
228
|
+
readonly DoctorPrepared: "doctor.prepared";
|
|
229
|
+
readonly DoctorJoined: "doctor.joined";
|
|
230
|
+
readonly DoctorDisconnected: "doctor.disconnected";
|
|
231
|
+
readonly DoctorRejoined: "doctor.rejoined";
|
|
232
|
+
readonly DoctorLeft: "doctor.left";
|
|
233
|
+
readonly PatientVerified: "patient.verified";
|
|
234
|
+
readonly PatientWaiting: "patient.waiting";
|
|
235
|
+
readonly PatientAdmitted: "patient.admitted";
|
|
236
|
+
readonly PatientRejected: "patient.rejected";
|
|
237
|
+
readonly PatientJoined: "patient.joined";
|
|
238
|
+
readonly PatientDisconnected: "patient.disconnected";
|
|
239
|
+
readonly PatientRejoined: "patient.rejoined";
|
|
240
|
+
readonly PatientLeft: "patient.left";
|
|
241
|
+
readonly RecordingConsentRequested: "recording.consent_requested";
|
|
242
|
+
readonly RecordingConsentAccepted: "recording.consent_accepted";
|
|
243
|
+
readonly RecordingConsentDeclined: "recording.consent_declined";
|
|
244
|
+
readonly RecordingConsentWithdrawn: "recording.consent_withdrawn";
|
|
245
|
+
readonly RecordingStarted: "recording.started";
|
|
246
|
+
readonly RecordingStopped: "recording.stopped";
|
|
247
|
+
readonly RecordingFailed: "recording.failed";
|
|
248
|
+
readonly TranscriptionQueued: "transcription.queued";
|
|
249
|
+
readonly TranscriptionReady: "transcription.ready";
|
|
250
|
+
readonly TranscriptionFailed: "transcription.failed";
|
|
251
|
+
readonly TranscriptionDeleted: "transcription.deleted";
|
|
252
|
+
readonly ConsultationStarted: "consultation.started";
|
|
253
|
+
readonly ConsultationReconnecting: "consultation.reconnecting";
|
|
254
|
+
readonly ConsultationEnded: "consultation.ended";
|
|
255
|
+
readonly ArtifactAccessed: "artifact.accessed";
|
|
256
|
+
readonly ArtifactDeleted: "artifact.deleted";
|
|
257
|
+
readonly EntitlementDenied: "entitlement.denied";
|
|
258
|
+
readonly RolloutDenied: "rollout.denied";
|
|
259
|
+
readonly PermissionDenied: "permission.denied";
|
|
260
|
+
/** Evento do provider desconhecido/ignorado — registrado, não processado. */
|
|
261
|
+
readonly WebhookObserved: "webhook.observed";
|
|
262
|
+
};
|
|
263
|
+
export type TeleconsultationEventType = (typeof TeleconsultationEventTypeEnum)[keyof typeof TeleconsultationEventTypeEnum];
|
|
264
|
+
/** Outbox durável do webhook (data-model §6): claim/lease como o task-runner. */
|
|
265
|
+
export declare const WebhookEventStatusEnum: {
|
|
266
|
+
readonly Pending: "pending";
|
|
267
|
+
readonly Claimed: "claimed";
|
|
268
|
+
readonly Completed: "completed";
|
|
269
|
+
readonly Failed: "failed";
|
|
270
|
+
};
|
|
271
|
+
export type WebhookEventStatus = (typeof WebhookEventStatusEnum)[keyof typeof WebhookEventStatusEnum];
|
|
272
|
+
export declare const LegalTextStatusEnum: {
|
|
273
|
+
readonly Draft: "draft";
|
|
274
|
+
readonly Published: "published";
|
|
275
|
+
readonly Retired: "retired";
|
|
276
|
+
};
|
|
277
|
+
export type LegalTextStatus = (typeof LegalTextStatusEnum)[keyof typeof LegalTextStatusEnum];
|
|
278
|
+
export declare const TranscriptionProviderEnum: {
|
|
279
|
+
readonly None: "none";
|
|
280
|
+
readonly RealtimeKit: "realtimekit";
|
|
281
|
+
};
|
|
282
|
+
export type TranscriptionProvider = (typeof TranscriptionProviderEnum)[keyof typeof TranscriptionProviderEnum];
|
|
283
|
+
export interface ITeleconsultationEndedBy {
|
|
284
|
+
type: EndedByType;
|
|
285
|
+
/** userId quando `type = user`. */
|
|
286
|
+
id?: string;
|
|
287
|
+
/** Ex.: `doctor_end`, `reconnect_timeout`, `appointment_cancelled`, `unused_expired`, `emergency_kill`. */
|
|
288
|
+
reason: string;
|
|
289
|
+
}
|
|
290
|
+
/** Snapshot do entitlement no momento da criação — o gate vivo continua sendo `tenant.modules`. */
|
|
291
|
+
export interface ITeleconsultationEntitlementSnapshot {
|
|
292
|
+
version: number;
|
|
293
|
+
capabilities: Record<string, boolean | number | string>;
|
|
294
|
+
}
|
|
295
|
+
export interface ITeleconsultationEventActor {
|
|
296
|
+
type: TeleconsultationEventActorType;
|
|
297
|
+
/** userId, participantId ou id opaco do provider — nunca nome/telefone. */
|
|
298
|
+
id?: string;
|
|
299
|
+
}
|
|
300
|
+
/** Metadata allowlisted — sem PII e sem conteúdo médico. */
|
|
301
|
+
export type TeleconsultationEventMetadata = Record<string, string | number | boolean>;
|
|
302
|
+
/** `.../teleconsultations/{teleconsultationId}` (data-model §1). */
|
|
303
|
+
export interface ITeleconsultation extends IFireDoc {
|
|
304
|
+
calendar_id: string;
|
|
305
|
+
appointment_id: string;
|
|
306
|
+
patient_id: string;
|
|
307
|
+
scheduled_professional_id?: string;
|
|
308
|
+
/** Claim transacional (D22): primeiro elegível vence; reassignment exige `configure` + motivo + evento. */
|
|
309
|
+
claimed_host_user_id?: string;
|
|
310
|
+
claimed_host_at?: Date | null;
|
|
311
|
+
mode: TeleconsultationMode;
|
|
312
|
+
status: TeleconsultationStatus;
|
|
313
|
+
waiting_policy: WaitingPolicy;
|
|
314
|
+
scheduled_start_at: Date;
|
|
315
|
+
scheduled_end_at: Date;
|
|
316
|
+
doctor_access_from: Date;
|
|
317
|
+
patient_access_from: Date;
|
|
318
|
+
unused_expires_at: Date;
|
|
319
|
+
reconnect_until?: Date | null;
|
|
320
|
+
started_at?: Date | null;
|
|
321
|
+
ended_at?: Date | null;
|
|
322
|
+
ended_by?: ITeleconsultationEndedBy | null;
|
|
323
|
+
provider: TeleconsultationProvider;
|
|
324
|
+
/** Id opaco do meeting no provider — nunca vai em external link nem no SPA. */
|
|
325
|
+
provider_meeting_id?: string;
|
|
326
|
+
active_provider_session_id?: string;
|
|
327
|
+
recording_status: RecordingStatus;
|
|
328
|
+
transcription_status: TranscriptionStatus;
|
|
329
|
+
entitlement_snapshot: ITeleconsultationEntitlementSnapshot;
|
|
330
|
+
/**
|
|
331
|
+
* Geração no `appointment-index`: incrementa quando o appointment volta a ser
|
|
332
|
+
* telemedicina depois de um estado terminal (nova teleconsulta, novo id).
|
|
333
|
+
*/
|
|
334
|
+
generation: number;
|
|
335
|
+
/** Contagem de reagendamentos (SEQUENCE do ICS). */
|
|
336
|
+
reschedule_count?: number;
|
|
337
|
+
/** Última versão/data do appointment aplicada — descarta evento de reconciliação antigo. */
|
|
338
|
+
last_reconciled_appointment_version?: number | string | null;
|
|
339
|
+
last_reconciled_at?: Date | null;
|
|
340
|
+
/** Concorrência otimista: todo comando de estado é transação + `version`. */
|
|
341
|
+
version: number;
|
|
342
|
+
created_at: Date;
|
|
343
|
+
updated_at: Date;
|
|
344
|
+
}
|
|
345
|
+
/** `.../participants/{participantId}` (data-model §2). Id lógico estável; reconexão reutiliza o mesmo participante. */
|
|
346
|
+
export interface ITeleconsultationParticipant extends IFireDoc {
|
|
347
|
+
teleconsultation_id: string;
|
|
348
|
+
role: ParticipantRole;
|
|
349
|
+
/** userId quando `role = doctor`. */
|
|
350
|
+
actor_user_id?: string;
|
|
351
|
+
/** patientId quando `role = patient`. */
|
|
352
|
+
patient_id?: string;
|
|
353
|
+
/** Id do participante no provider (pode ser renovado; o id lógico é o doc). */
|
|
354
|
+
provider_participant_id?: string;
|
|
355
|
+
/** `custom_participant_id` opaco enviado ao provider — nunca o patientId. */
|
|
356
|
+
opaque_custom_participant_id: string;
|
|
357
|
+
state: ParticipantState;
|
|
358
|
+
identity_level?: IdentityLevel;
|
|
359
|
+
admitted_at?: Date | null;
|
|
360
|
+
connected_at?: Date | null;
|
|
361
|
+
last_seen_at?: Date | null;
|
|
362
|
+
disconnected_at?: Date | null;
|
|
363
|
+
reconnect_count: number;
|
|
364
|
+
created_at: Date;
|
|
365
|
+
updated_at: Date;
|
|
366
|
+
}
|
|
367
|
+
export interface ITeleconsultationConsentEvidence {
|
|
368
|
+
ui_locale: string;
|
|
369
|
+
/** Hash da sessão pública — nunca o cookie/sid bruto. */
|
|
370
|
+
session_id_hash: string;
|
|
371
|
+
}
|
|
372
|
+
/** `.../consents/{consentId}` (data-model §3). Guarda versão/hash do texto, não o texto. */
|
|
373
|
+
export interface ITeleconsultationConsent extends IFireDoc {
|
|
374
|
+
teleconsultation_id: string;
|
|
375
|
+
subject: ConsentSubject;
|
|
376
|
+
decision: ConsentDecision;
|
|
377
|
+
terms_version: string;
|
|
378
|
+
/** `content_hash` do legal text vigente na solicitação. */
|
|
379
|
+
terms_content_hash?: string;
|
|
380
|
+
participant_id: string;
|
|
381
|
+
actor_type: ConsentActorType;
|
|
382
|
+
occurred_at: Date;
|
|
383
|
+
correlation_id: string;
|
|
384
|
+
/** Vincula aceite/recusa/retirada de gravação à solicitação específica (data-model §11). */
|
|
385
|
+
recording_request_id?: string;
|
|
386
|
+
evidence: ITeleconsultationConsentEvidence;
|
|
387
|
+
}
|
|
388
|
+
/** `.../artifacts/{artifactId}` (data-model §4). Download só por endpoint `artifacts_read` + URL assinada ≤ 5 min. */
|
|
389
|
+
export interface ITeleconsultationArtifact extends IFireDoc {
|
|
390
|
+
teleconsultation_id: string;
|
|
391
|
+
type: ArtifactType;
|
|
392
|
+
/** Segmento (1..n) — mais de uma sessão física do provider = vários segmentos da mesma teleconsulta. */
|
|
393
|
+
segment: number;
|
|
394
|
+
status: ArtifactStatus;
|
|
395
|
+
provider_artifact_id?: string;
|
|
396
|
+
provider_session_id?: string;
|
|
397
|
+
recording_request_id?: string;
|
|
398
|
+
storage_bucket?: string;
|
|
399
|
+
storage_object?: string;
|
|
400
|
+
content_type?: string;
|
|
401
|
+
size_bytes?: number;
|
|
402
|
+
checksum?: string;
|
|
403
|
+
started_at?: Date | null;
|
|
404
|
+
ended_at?: Date | null;
|
|
405
|
+
/** Retenção: o sweep deleta o objeto e só então marca `deleted` (auditoria preservada). */
|
|
406
|
+
expires_at?: Date | null;
|
|
407
|
+
error_code?: string;
|
|
408
|
+
created_at: Date;
|
|
409
|
+
updated_at: Date;
|
|
410
|
+
}
|
|
411
|
+
/** `.../events/{eventId}` (data-model §5) — append-only. */
|
|
412
|
+
export interface ITeleconsultationEvent extends IFireDoc {
|
|
413
|
+
teleconsultation_id: string;
|
|
414
|
+
type: TeleconsultationEventType;
|
|
415
|
+
occurred_at: Date;
|
|
416
|
+
actor: ITeleconsultationEventActor;
|
|
417
|
+
source: TeleconsultationEventSource;
|
|
418
|
+
correlation_id: string;
|
|
419
|
+
causation_id?: string;
|
|
420
|
+
idempotency_key?: string;
|
|
421
|
+
from_status?: TeleconsultationStatus | string;
|
|
422
|
+
to_status?: TeleconsultationStatus | string;
|
|
423
|
+
metadata?: TeleconsultationEventMetadata;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* `.../webhook-events/{providerEventId}` (data-model §6). Dedup + outbox durável:
|
|
427
|
+
* a recepção grava `pending` ANTES do 2xx; o worker faz claim, processa
|
|
428
|
+
* idempotentemente e marca `completed`. Sem payload bruto — só campos allowlisted.
|
|
429
|
+
*/
|
|
430
|
+
export interface ITeleconsultationWebhookEvent extends IFireDoc {
|
|
431
|
+
teleconsultation_id?: string;
|
|
432
|
+
provider: TeleconsultationProvider;
|
|
433
|
+
/** Id do evento no provider (= doc id; ex.: `rtk-uuid`). */
|
|
434
|
+
provider_event_id: string;
|
|
435
|
+
event_type: string;
|
|
436
|
+
/** Hash do corpo bruto (integridade/dedup) — nunca o corpo. */
|
|
437
|
+
payload_hash?: string;
|
|
438
|
+
/** Campos allowlisted do payload (ids opacos, status) — sem PII. */
|
|
439
|
+
sanitized_payload?: Record<string, string | number | boolean | null>;
|
|
440
|
+
status: WebhookEventStatus;
|
|
441
|
+
received_at: Date;
|
|
442
|
+
claimed_at?: Date | null;
|
|
443
|
+
claimed_by?: string;
|
|
444
|
+
lease_until?: Date | null;
|
|
445
|
+
processed_at?: Date | null;
|
|
446
|
+
attempt: number;
|
|
447
|
+
next_attempt_at?: Date | null;
|
|
448
|
+
result?: string;
|
|
449
|
+
error_code?: string;
|
|
450
|
+
correlation_id: string;
|
|
451
|
+
/** TTL nativo do Firestore. */
|
|
452
|
+
expires_at: Date;
|
|
453
|
+
}
|
|
454
|
+
/** `.../access-grants/{grantId}` (data-model §7). Segredo nunca persistido bruto. */
|
|
455
|
+
export interface ITeleconsultationAccessGrant extends IFireDoc {
|
|
456
|
+
teleconsultation_id: string;
|
|
457
|
+
role: ParticipantRole;
|
|
458
|
+
kind: AccessGrantKind;
|
|
459
|
+
/** HMAC (chave rotacionável) do segredo; comparação constant-time. */
|
|
460
|
+
secret_hash: string;
|
|
461
|
+
/** Hash do destinatário (telefone/e-mail) — evita reenvio para contato diferente do agendamento. */
|
|
462
|
+
recipient_ref_hash?: string;
|
|
463
|
+
actor_user_id?: string;
|
|
464
|
+
participant_id?: string;
|
|
465
|
+
state: AccessGrantState;
|
|
466
|
+
expires_at: Date;
|
|
467
|
+
consumed_at?: Date | null;
|
|
468
|
+
revoked_at?: Date | null;
|
|
469
|
+
revoked_by?: string;
|
|
470
|
+
last_used_at?: Date | null;
|
|
471
|
+
failed_attempts: number;
|
|
472
|
+
failed_window_started_at?: Date | null;
|
|
473
|
+
blocked_until?: Date | null;
|
|
474
|
+
/** `launch_code` filho de `qr_capability`; `browser_session` filho do code/capability. */
|
|
475
|
+
parent_grant_id?: string;
|
|
476
|
+
/** Canal do envio que originou o grant (`qr_capability`). */
|
|
477
|
+
channel_kind?: AccessSendChannelKind;
|
|
478
|
+
/** Doc `quick-reply-actions/{actionId}` ligado ao grant — cancelado no revoke. */
|
|
479
|
+
quick_reply_action_id?: string;
|
|
480
|
+
version: number;
|
|
481
|
+
created_at: Date;
|
|
482
|
+
updated_at: Date;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* `.../appointment-index/{calendarId}__{appointmentId}` (plan §2). Unicidade da
|
|
486
|
+
* teleconsulta ativa por appointment; o reconciliador transaciona sobre este doc.
|
|
487
|
+
*/
|
|
488
|
+
export interface ITelemedicineAppointmentIndex extends IFireDoc {
|
|
489
|
+
calendar_id: string;
|
|
490
|
+
appointment_id: string;
|
|
491
|
+
active_teleconsultation_id: string | null;
|
|
492
|
+
generation: number;
|
|
493
|
+
last_reconciled_appointment_version?: number | string | null;
|
|
494
|
+
updated_at: Date;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* `platform/evo-telemedicine/legal-texts/{subject}-{locale}-{version}` (data-model §9).
|
|
498
|
+
* Publish explícito, nunca overwrite. NÃO estende `IFireGlobalDoc`: aqui `version`
|
|
499
|
+
* é a versão do TEXTO (string, ex.: `v1`), não o contador de concorrência.
|
|
500
|
+
*/
|
|
501
|
+
export interface ITelemedicineLegalText {
|
|
502
|
+
readonly id: string;
|
|
503
|
+
subject: ConsentSubject;
|
|
504
|
+
locale: string;
|
|
505
|
+
version: string;
|
|
506
|
+
title: string;
|
|
507
|
+
/** HTML sanitizado; placeholders allowlisted (`{{clinic_name}}`, `{{clinic_contact}}`). */
|
|
508
|
+
content_html: string;
|
|
509
|
+
content_hash: string;
|
|
510
|
+
published_at?: Date | null;
|
|
511
|
+
effective_at?: Date | null;
|
|
512
|
+
status: LegalTextStatus;
|
|
513
|
+
placeholders?: string[];
|
|
514
|
+
created_at?: Date | null;
|
|
515
|
+
updated_at?: Date | null;
|
|
516
|
+
}
|
|
517
|
+
/** `platform/evo-telemedicine/config/rollout` (plan §2). Deny se ausente; cache 30 s. */
|
|
518
|
+
export interface ITelemedicineRollout extends IFireGlobalDoc {
|
|
519
|
+
create_enabled: boolean;
|
|
520
|
+
join_enabled: boolean;
|
|
521
|
+
recording_enabled: boolean;
|
|
522
|
+
/** Só pode ser `true` em produção após o gate de D12. */
|
|
523
|
+
transcription_enabled: boolean;
|
|
524
|
+
/** Bloqueia tudo, inclusive consultas ao vivo (D19). */
|
|
525
|
+
emergency_kill: boolean;
|
|
526
|
+
updated_at: Date;
|
|
527
|
+
updated_by: string;
|
|
528
|
+
}
|
|
529
|
+
/** `platform/evo-telemedicine/config/transcription` (plan F9). */
|
|
530
|
+
export interface ITelemedicineTranscriptionConfig extends IFireGlobalDoc {
|
|
531
|
+
provider: TranscriptionProvider;
|
|
532
|
+
/** `realtimekit` com `false` só funciona em staging. */
|
|
533
|
+
production_gate_approved: boolean;
|
|
534
|
+
approved_by?: string;
|
|
535
|
+
approved_at?: Date | null;
|
|
536
|
+
}
|
|
537
|
+
/** `platform/evo-telemedicine/grant-index/{hmac(cap)}` (plan §2). Só resolve o path; o grant tenant-scoped é a verdade. */
|
|
538
|
+
export interface ITelemedicineGrantIndex extends IFireGlobalDoc {
|
|
539
|
+
tenant: string;
|
|
540
|
+
teleconsultation_id: string;
|
|
541
|
+
grant_id: string;
|
|
542
|
+
/** TTL nativo. */
|
|
543
|
+
expires_at: Date;
|
|
544
|
+
}
|
|
545
|
+
export declare const EntitlementAuditActionEnum: {
|
|
546
|
+
readonly Set: "set";
|
|
547
|
+
readonly Override: "override";
|
|
548
|
+
readonly Revoke: "revoke";
|
|
549
|
+
};
|
|
550
|
+
export type EntitlementAuditAction = (typeof EntitlementAuditActionEnum)[keyof typeof EntitlementAuditActionEnum];
|
|
551
|
+
export interface IEntitlementAuditActor {
|
|
552
|
+
type: "user" | "system" | "script";
|
|
553
|
+
id?: string;
|
|
554
|
+
}
|
|
555
|
+
/** Fora do doc do tenant, como pede o data-model. `before/after` são a projeção sanitizada (sem preço/contrato). */
|
|
556
|
+
export interface ITelemedicineEntitlementAudit extends IFireDoc {
|
|
557
|
+
module: string;
|
|
558
|
+
action: EntitlementAuditAction;
|
|
559
|
+
before?: ITenantModuleEntitlement | null;
|
|
560
|
+
after: ITenantModuleEntitlement;
|
|
561
|
+
actor: IEntitlementAuditActor;
|
|
562
|
+
reason: string;
|
|
563
|
+
occurred_at: Date;
|
|
564
|
+
correlation_id?: string;
|
|
565
|
+
}
|
|
566
|
+
export declare const TelemedicineErrorCode: {
|
|
567
|
+
/** 403 — entitlement ausente/inativo (sem bypass de super admin). */
|
|
568
|
+
readonly TenantModuleDisabled: "TENANT_MODULE_DISABLED";
|
|
569
|
+
/** 403 — kill switch operacional (`create|join|recording|transcription`). */
|
|
570
|
+
readonly RolloutDisabled: "ROLLOUT_DISABLED";
|
|
571
|
+
/** 403 — `emergency_kill` ligado. */
|
|
572
|
+
readonly EmergencyKill: "EMERGENCY_KILL";
|
|
573
|
+
/** 403 — RBAC. */
|
|
574
|
+
readonly PermissionDenied: "PERMISSION_DENIED";
|
|
575
|
+
/** 403 — capability do entitlement ausente/false (`recording`, `transcription`, `auto_admit`). */
|
|
576
|
+
readonly CapabilityDisabled: "CAPABILITY_DISABLED";
|
|
577
|
+
/** 404 — teleconsulta/artefato/grant inexistente (ou genérico, em rota pública). */
|
|
578
|
+
readonly NotFound: "NOT_FOUND";
|
|
579
|
+
/** 409 — fora da janela (antes de `*_access_from` ou após `unused_expires_at`). */
|
|
580
|
+
readonly AccessWindowClosed: "ACCESS_WINDOW_CLOSED";
|
|
581
|
+
/** 409 — outro médico já fez o claim de host. */
|
|
582
|
+
readonly HostClaimedByOther: "HOST_CLAIMED_BY_OTHER";
|
|
583
|
+
/** 409 — comando exige médico claimant presente (admit/end/recording). */
|
|
584
|
+
readonly HostRequired: "HOST_REQUIRED";
|
|
585
|
+
/** 409 — termos/privacidade (ou gravação) não aceitos na versão vigente. */
|
|
586
|
+
readonly ConsentRequired: "CONSENT_REQUIRED";
|
|
587
|
+
/** 409 — paciente ainda não verificou identidade. */
|
|
588
|
+
readonly IdentityRequired: "IDENTITY_REQUIRED";
|
|
589
|
+
/** 401 — verificação de identidade falhou (erro neutro: não diz qual campo). */
|
|
590
|
+
readonly IdentityVerificationFailed: "IDENTITY_VERIFICATION_FAILED";
|
|
591
|
+
/** 429 — grant bloqueado por excesso de falhas. */
|
|
592
|
+
readonly GrantBlocked: "GRANT_BLOCKED";
|
|
593
|
+
/** 401 — grant/code inválido, consumido, expirado ou revogado (genérico por design). */
|
|
594
|
+
readonly GrantInvalid: "GRANT_INVALID";
|
|
595
|
+
/** 401 — cookie `__session` ausente/inválido/expirado. */
|
|
596
|
+
readonly SessionInvalid: "SESSION_INVALID";
|
|
597
|
+
/** 410 — estado terminal (`ended|cancelled|expired`). */
|
|
598
|
+
readonly TeleconsultationTerminal: "TELECONSULTATION_TERMINAL";
|
|
599
|
+
/** 409 — transição de estado não permitida (spec §10). */
|
|
600
|
+
readonly InvalidTransition: "INVALID_TRANSITION";
|
|
601
|
+
/** 409 — `expected_version` divergente. */
|
|
602
|
+
readonly VersionConflict: "VERSION_CONFLICT";
|
|
603
|
+
/** 409 — política de espera só muda até o paciente entrar. */
|
|
604
|
+
readonly WaitingPolicyLocked: "WAITING_POLICY_LOCKED";
|
|
605
|
+
/** 409 — já existe gravação ativa/pendente. */
|
|
606
|
+
readonly RecordingActive: "RECORDING_ACTIVE";
|
|
607
|
+
/** 502 — provider falhou ao gravar (não derruba a consulta). */
|
|
608
|
+
readonly RecordingFailed: "RECORDING_FAILED";
|
|
609
|
+
/** 403 — transcrição em produção sem gate aprovado (D12). */
|
|
610
|
+
readonly TranscriptionGateClosed: "TRANSCRIPTION_GATE_CLOSED";
|
|
611
|
+
/** 409 — artefato não está `ready`. */
|
|
612
|
+
readonly ArtifactNotReady: "ARTIFACT_NOT_READY";
|
|
613
|
+
/** 502 — erro do provider de mídia. */
|
|
614
|
+
readonly ProviderError: "PROVIDER_ERROR";
|
|
615
|
+
/** 429 — rate limit por IP-hash/grant. */
|
|
616
|
+
readonly RateLimited: "RATE_LIMITED";
|
|
617
|
+
/** 400 — body/params inválidos. */
|
|
618
|
+
readonly ValidationError: "VALIDATION_ERROR";
|
|
619
|
+
};
|
|
620
|
+
export type TelemedicineErrorCode = (typeof TelemedicineErrorCode)[keyof typeof TelemedicineErrorCode];
|
|
621
|
+
export interface ITelemedicineErrorResponse {
|
|
622
|
+
ok: false;
|
|
623
|
+
error: TelemedicineErrorCode;
|
|
624
|
+
message?: string;
|
|
625
|
+
error_id?: string;
|
|
626
|
+
}
|
|
627
|
+
export interface ITeleconsultationParticipantDto {
|
|
628
|
+
participant_id: string;
|
|
629
|
+
role: ParticipantRole;
|
|
630
|
+
state: ParticipantState;
|
|
631
|
+
identity_level?: IdentityLevel;
|
|
632
|
+
admitted_at?: string | null;
|
|
633
|
+
connected_at?: string | null;
|
|
634
|
+
last_seen_at?: string | null;
|
|
635
|
+
disconnected_at?: string | null;
|
|
636
|
+
reconnect_count: number;
|
|
637
|
+
}
|
|
638
|
+
/** Estado do CTA de acesso do paciente, para a recepção — destinatário só mascarado. */
|
|
639
|
+
export interface ITeleconsultationAccessSummaryDto {
|
|
640
|
+
grant_id?: string;
|
|
641
|
+
grant_state?: AccessGrantState;
|
|
642
|
+
channel_kind?: AccessSendChannelKind;
|
|
643
|
+
/** Ex.: `+55 11 9****-1234`, `l***@dominio.com`. */
|
|
644
|
+
recipient_masked?: string;
|
|
645
|
+
last_sent_at?: string | null;
|
|
646
|
+
expires_at?: string | null;
|
|
647
|
+
}
|
|
648
|
+
/** `GET /v1/appointments/:calendarId/:appointmentId/teleconsultation` (telemed_admin). */
|
|
649
|
+
export interface ITeleconsultationSummaryDto {
|
|
650
|
+
id: string;
|
|
651
|
+
calendar_id: string;
|
|
652
|
+
appointment_id: string;
|
|
653
|
+
patient_id: string;
|
|
654
|
+
scheduled_professional_id?: string;
|
|
655
|
+
claimed_host_user_id?: string;
|
|
656
|
+
claimed_host_at?: string | null;
|
|
657
|
+
mode: TeleconsultationMode;
|
|
658
|
+
status: TeleconsultationStatus;
|
|
659
|
+
waiting_policy: WaitingPolicy;
|
|
660
|
+
scheduled_start_at: string;
|
|
661
|
+
scheduled_end_at: string;
|
|
662
|
+
doctor_access_from: string;
|
|
663
|
+
patient_access_from: string;
|
|
664
|
+
unused_expires_at: string;
|
|
665
|
+
reconnect_until?: string | null;
|
|
666
|
+
started_at?: string | null;
|
|
667
|
+
ended_at?: string | null;
|
|
668
|
+
ended_by?: ITeleconsultationEndedBy | null;
|
|
669
|
+
recording_status: RecordingStatus;
|
|
670
|
+
transcription_status: TranscriptionStatus;
|
|
671
|
+
entitlement_snapshot: ITeleconsultationEntitlementSnapshot;
|
|
672
|
+
/** Capabilities EFETIVAS agora (entitlement vivo AND rollout): `recording`, `transcription`, `auto_admit`. */
|
|
673
|
+
capabilities_now: Record<string, boolean>;
|
|
674
|
+
generation: number;
|
|
675
|
+
version: number;
|
|
676
|
+
participants?: ITeleconsultationParticipantDto[];
|
|
677
|
+
access?: ITeleconsultationAccessSummaryDto;
|
|
678
|
+
}
|
|
679
|
+
/** `POST /v1/teleconsultations/:id/launch` → `{ launch_url }` (fragment `#code=`; SPA faz o exchange). */
|
|
680
|
+
export interface ILaunchResponseDto {
|
|
681
|
+
ok: true;
|
|
682
|
+
launch_url: string;
|
|
683
|
+
/** Expiração do code one-time (5 min). */
|
|
684
|
+
expires_at: string;
|
|
685
|
+
claimed_host_user_id: string;
|
|
686
|
+
}
|
|
687
|
+
export interface IRoomSessionWindowDto {
|
|
688
|
+
scheduled_start_at: string;
|
|
689
|
+
scheduled_end_at: string;
|
|
690
|
+
doctor_access_from: string;
|
|
691
|
+
patient_access_from: string;
|
|
692
|
+
unused_expires_at: string;
|
|
693
|
+
reconnect_until?: string | null;
|
|
694
|
+
}
|
|
695
|
+
export interface IRoomConsentRefDto {
|
|
696
|
+
subject: ConsentSubject;
|
|
697
|
+
terms_version: string;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* `GET /api/room/v1/session` — estado SANITIZADO: sem tenant id, sem ids do
|
|
701
|
+
* provider; nome do profissional/clínica só depois da verificação.
|
|
702
|
+
*/
|
|
703
|
+
export interface IRoomSessionDto {
|
|
704
|
+
ok: true;
|
|
705
|
+
role: ParticipantRole;
|
|
706
|
+
participant_id: string;
|
|
707
|
+
participant_state: ParticipantState;
|
|
708
|
+
teleconsultation_status: TeleconsultationStatus;
|
|
709
|
+
mode: TeleconsultationMode;
|
|
710
|
+
waiting_policy: WaitingPolicy;
|
|
711
|
+
window: IRoomSessionWindowDto;
|
|
712
|
+
identity_level: IdentityLevel;
|
|
713
|
+
/** Paciente precisa passar por `POST /identity/verify` antes do join. */
|
|
714
|
+
identity_required: boolean;
|
|
715
|
+
recording_status: RecordingStatus;
|
|
716
|
+
transcription_status: TranscriptionStatus;
|
|
717
|
+
/** Textos vigentes que ainda precisam de aceite antes do join. */
|
|
718
|
+
required_consents: IRoomConsentRefDto[];
|
|
719
|
+
accepted_consents: IRoomConsentRefDto[];
|
|
720
|
+
/** Capabilities efetivas para esta sessão (entitlement AND rollout AND papel). */
|
|
721
|
+
capabilities: Record<string, boolean>;
|
|
722
|
+
professional_display_name?: string;
|
|
723
|
+
clinic_display_name?: string;
|
|
724
|
+
/** Expiração do access da sessão (15 min, rotativo via `/session/refresh`). */
|
|
725
|
+
session_expires_at: string;
|
|
726
|
+
server_time: string;
|
|
727
|
+
}
|
|
728
|
+
/** `POST /api/room/v1/join` — token do provider fica em MEMÓRIA do SPA; nunca em storage. */
|
|
729
|
+
export interface IRoomJoinDto {
|
|
730
|
+
ok: true;
|
|
731
|
+
provider_token: string;
|
|
732
|
+
/** Id opaco do meeting (não é o `provider_meeting_id`). */
|
|
733
|
+
meeting_id_opaque: string;
|
|
734
|
+
preset: string;
|
|
735
|
+
participant_id: string;
|
|
736
|
+
custom_participant_id: string;
|
|
737
|
+
/** true quando o paciente cai na waiting room (`manual_admit` ou médico ausente). */
|
|
738
|
+
waiting: boolean;
|
|
739
|
+
/** Expiração do token do provider, quando conhecida. */
|
|
740
|
+
token_expires_at?: string;
|
|
741
|
+
}
|
|
742
|
+
/** `POST /api/room/v1/admit` — o SPA só chama `acceptWaitingRoomRequest` DEPOIS de receber isto. */
|
|
743
|
+
export interface IAdmissionGrantDto {
|
|
744
|
+
ok: true;
|
|
745
|
+
participant_id: string;
|
|
746
|
+
provider_participant_id: string;
|
|
747
|
+
admitted_at: string;
|
|
748
|
+
teleconsultation_status: TeleconsultationStatus;
|
|
749
|
+
}
|
|
750
|
+
export interface ITeleconsultationArtifactDto {
|
|
751
|
+
id: string;
|
|
752
|
+
type: ArtifactType;
|
|
753
|
+
segment: number;
|
|
754
|
+
status: ArtifactStatus;
|
|
755
|
+
content_type?: string;
|
|
756
|
+
size_bytes?: number;
|
|
757
|
+
started_at?: string | null;
|
|
758
|
+
ended_at?: string | null;
|
|
759
|
+
expires_at?: string | null;
|
|
760
|
+
error_code?: string;
|
|
761
|
+
created_at: string;
|
|
762
|
+
}
|
|
763
|
+
/** `POST /v1/teleconsultations/:id/artifacts/:artifactId/signed-url` — URL ≤ 5 min; evento `artifact.accessed`. */
|
|
764
|
+
export interface ISignedUrlResponseDto {
|
|
765
|
+
ok: true;
|
|
766
|
+
url: string;
|
|
767
|
+
expires_at: string;
|
|
768
|
+
}
|
|
769
|
+
export interface ITeleconsultationEventDto {
|
|
770
|
+
id: string;
|
|
771
|
+
type: TeleconsultationEventType;
|
|
772
|
+
occurred_at: string;
|
|
773
|
+
actor: ITeleconsultationEventActor;
|
|
774
|
+
source: TeleconsultationEventSource;
|
|
775
|
+
correlation_id: string;
|
|
776
|
+
causation_id?: string;
|
|
777
|
+
from_status?: string;
|
|
778
|
+
to_status?: string;
|
|
779
|
+
metadata?: TeleconsultationEventMetadata;
|
|
780
|
+
}
|
|
781
|
+
/** `GET /v1/teleconsultations/:id/events` — paginação por cursor. */
|
|
782
|
+
export interface ITeleconsultationEventsPageDto {
|
|
783
|
+
ok: true;
|
|
784
|
+
events: ITeleconsultationEventDto[];
|
|
785
|
+
next_cursor?: string;
|
|
786
|
+
}
|
|
787
|
+
export interface ITelemedicineLegalTextDto {
|
|
788
|
+
subject: ConsentSubject;
|
|
789
|
+
locale: string;
|
|
790
|
+
version: string;
|
|
791
|
+
title: string;
|
|
792
|
+
content_html: string;
|
|
793
|
+
content_hash: string;
|
|
794
|
+
effective_at?: string | null;
|
|
795
|
+
}
|
|
796
|
+
/** `GET /api/room/v1/legal-texts`. */
|
|
797
|
+
export interface ILegalTextsResponseDto {
|
|
798
|
+
ok: true;
|
|
799
|
+
texts: ITelemedicineLegalTextDto[];
|
|
800
|
+
}
|
|
801
|
+
/** `POST /api/room/v1/identity/verify` — sucesso; falha é `IDENTITY_VERIFICATION_FAILED` neutro. */
|
|
802
|
+
export interface IIdentityVerifyResponseDto {
|
|
803
|
+
ok: true;
|
|
804
|
+
identity_level: IdentityLevel;
|
|
805
|
+
}
|
|
806
|
+
/** `POST /v1/teleconsultations/:id/access/send`. */
|
|
807
|
+
export interface IAccessSendResponseDto {
|
|
808
|
+
ok: true;
|
|
809
|
+
grant_id: string;
|
|
810
|
+
channel_kind: AccessSendChannelKind;
|
|
811
|
+
recipient_masked?: string;
|
|
812
|
+
expires_at: string;
|
|
813
|
+
/** Só para `channel_kind = manual` (smoke): URL mascarada, nunca a capability inteira. */
|
|
814
|
+
url_masked?: string;
|
|
815
|
+
/** Id da task `telemedicine_join.send` criada, quando houver canal. */
|
|
816
|
+
task_id?: string;
|
|
817
|
+
}
|
|
818
|
+
export interface IWaitingPolicyCommand {
|
|
819
|
+
waiting_policy: WaitingPolicy;
|
|
820
|
+
expected_version?: number;
|
|
821
|
+
}
|
|
822
|
+
export interface IReassignHostCommand {
|
|
823
|
+
to_user_id: string;
|
|
824
|
+
reason: string;
|
|
825
|
+
expected_version?: number;
|
|
826
|
+
}
|
|
827
|
+
export interface IAccessSendCommand {
|
|
828
|
+
channel_kind: AccessSendChannelKind;
|
|
829
|
+
/** Revoga a capability anterior antes de emitir a nova. */
|
|
830
|
+
resend?: boolean;
|
|
831
|
+
}
|
|
832
|
+
export interface IAccessRevokeCommand {
|
|
833
|
+
/** Ausente = todos os grants ativos do paciente na teleconsulta. */
|
|
834
|
+
grant_id?: string;
|
|
835
|
+
reason: string;
|
|
836
|
+
}
|
|
837
|
+
export interface IEndCommand {
|
|
838
|
+
reason?: string;
|
|
839
|
+
expected_version?: number;
|
|
840
|
+
}
|
|
841
|
+
/** `POST /api/room/v1/exchange` — code one-time do fragment `#code=`. */
|
|
842
|
+
export interface IExchangeCommand {
|
|
843
|
+
code: string;
|
|
844
|
+
}
|
|
845
|
+
/** `POST /api/room/v1/identity/verify` — DOB normalizada `YYYY-MM-DD`; comparação exata após normalização. */
|
|
846
|
+
export interface IIdentityVerifyCommand {
|
|
847
|
+
display_name: string;
|
|
848
|
+
birth_date?: string;
|
|
849
|
+
}
|
|
850
|
+
/** `POST /api/room/v1/consents` — termos/privacidade (gravação usa `IRecordingConsentCommand`). */
|
|
851
|
+
export interface IConsentCommand {
|
|
852
|
+
subject: ConsentSubject;
|
|
853
|
+
terms_version: string;
|
|
854
|
+
decision: Extract<ConsentDecision, "accepted" | "declined">;
|
|
855
|
+
}
|
|
856
|
+
/** `POST /api/room/v1/presence`. */
|
|
857
|
+
export interface IPresenceCommand {
|
|
858
|
+
state: PresenceState;
|
|
859
|
+
provider_participant_id?: string;
|
|
860
|
+
}
|
|
861
|
+
/** `POST /api/room/v1/admit` e `/reject`. */
|
|
862
|
+
export interface IAdmitCommand {
|
|
863
|
+
participant_id: string;
|
|
864
|
+
}
|
|
865
|
+
export interface IRejectCommand {
|
|
866
|
+
participant_id: string;
|
|
867
|
+
reason?: string;
|
|
868
|
+
}
|
|
869
|
+
/** `POST /api/room/v1/recording/request` (médico com `record`) — idempotente por `recording_request_id`. */
|
|
870
|
+
export interface IRecordingRequestCommand {
|
|
871
|
+
recording_request_id: string;
|
|
872
|
+
}
|
|
873
|
+
/** `POST /api/room/v1/recording/accept|decline|withdraw` (paciente) — versão do texto = a da solicitação. */
|
|
874
|
+
export interface IRecordingConsentCommand {
|
|
875
|
+
recording_request_id: string;
|
|
876
|
+
terms_version: string;
|
|
877
|
+
}
|
|
878
|
+
/** `POST /api/room/v1/recording/stop` (médico) — repetível. */
|
|
879
|
+
export interface IRecordingStopCommand {
|
|
880
|
+
recording_request_id?: string;
|
|
881
|
+
}
|
|
882
|
+
export interface ITelemetryEvent {
|
|
883
|
+
name: string;
|
|
884
|
+
at: string;
|
|
885
|
+
attrs?: Record<string, string | number | boolean>;
|
|
886
|
+
}
|
|
887
|
+
/** `POST /api/room/v1/telemetry` — nomes allowlisted no backend; sem PII. */
|
|
888
|
+
export interface ITelemetryCommand {
|
|
889
|
+
events: ITelemetryEvent[];
|
|
890
|
+
}
|