evo360-types 1.3.438 → 1.3.444
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-med/calendar/zod-schemas.d.ts +2544 -372
- package/dist/apps/evo-med/calendar/zod-schemas.js +57 -11
- package/dist/apps/evo-med/calendar/zod-schemas.ts +60 -11
- package/dist/types/evo-med/calendar/index.d.ts +67 -11
- package/dist/types/evo-med/calendar/index.js +12 -1
- package/dist/types/evo-med/calendar/index.ts +77 -11
- package/package.json +1 -1
|
@@ -7,29 +7,75 @@ const zod_schemas_2 = require("../people/zod-schemas");
|
|
|
7
7
|
const zod_schemas_3 = require("../../evo-integrations/zod-schemas");
|
|
8
8
|
// ----- Notification config (feat-048) — molde do `sync_config`: estruturado +
|
|
9
9
|
// `.passthrough()` p/ tolerar campos futuros sem republish.
|
|
10
|
+
//
|
|
11
|
+
// Todo campo opcional aqui é `.nullable()`: o editor do FE materializa "não
|
|
12
|
+
// escolhido" como `null` explícito (`department_id: wa.department_id ?? null` em
|
|
13
|
+
// `utils/calendarNotificationConfig.ts`), e `.passthrough()` NÃO cobre isso —
|
|
14
|
+
// ele só tolera chaves não declaradas, não valor null em chave declarada. Sem
|
|
15
|
+
// `.nullable()` o doc inteiro do calendário reprova, e quem usa `parseDoc`
|
|
16
|
+
// estrito (ex.: AppointmentRouterDialog) fica sem calendário e não renderiza.
|
|
10
17
|
const zNotificationWhatsappConfigSchema = zod_1.z
|
|
11
18
|
.object({
|
|
12
19
|
enabled: zod_1.z.boolean(),
|
|
13
|
-
channel_id: zod_1.z.string().min(1).max(60).optional(),
|
|
14
|
-
department_id: zod_1.z.string().min(1).max(60).optional(),
|
|
15
|
-
reminder_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
16
|
-
on_confirm_quick_reply_id: zod_1.z.string().min(1).max(120).optional(),
|
|
17
|
-
on_reschedule_quick_reply_id: zod_1.z
|
|
20
|
+
channel_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
21
|
+
department_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
22
|
+
reminder_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
23
|
+
on_confirm_quick_reply_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
24
|
+
on_reschedule_quick_reply_id: zod_1.z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(120)
|
|
28
|
+
.nullable()
|
|
29
|
+
.optional(),
|
|
18
30
|
})
|
|
19
31
|
.passthrough();
|
|
20
32
|
const zNotificationEmailConfigSchema = zod_1.z
|
|
21
33
|
.object({
|
|
22
34
|
enabled: zod_1.z.boolean(),
|
|
23
|
-
channel_id: zod_1.z.string().min(1).max(60).optional(),
|
|
24
|
-
reminder_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
25
|
-
on_confirm_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
26
|
-
on_reschedule_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
35
|
+
channel_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
36
|
+
reminder_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
37
|
+
on_confirm_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
38
|
+
on_reschedule_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
39
|
+
})
|
|
40
|
+
.passthrough();
|
|
41
|
+
// feat-092: mapa GENÉRICO de configs de notificação (config × canal × template).
|
|
42
|
+
// Tudo opcional + `.passthrough()`; SEM `.default()` (o data-validator grava só as
|
|
43
|
+
// chaves do input → um default não persistiria). Chave/canal são strings abertas
|
|
44
|
+
// (z.record) ⇒ extensível a novos eventos/canais sem republish.
|
|
45
|
+
const zNotificationCtaSchema = zod_1.z
|
|
46
|
+
.object({
|
|
47
|
+
key: zod_1.z.string().min(1).max(60),
|
|
48
|
+
template_id: zod_1.z.string().min(1).max(120),
|
|
49
|
+
template_type: zod_1.z.string().min(1).max(40).optional(),
|
|
50
|
+
})
|
|
51
|
+
.passthrough();
|
|
52
|
+
const zNotificationChannelEntrySchema = zod_1.z
|
|
53
|
+
.object({
|
|
54
|
+
enabled: zod_1.z.boolean().nullable().optional(),
|
|
55
|
+
channel_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
56
|
+
department_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
57
|
+
template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
58
|
+
template_type: zod_1.z.string().min(1).max(40).nullable().optional(),
|
|
59
|
+
ctas: zod_1.z.array(zNotificationCtaSchema).nullable().optional(),
|
|
60
|
+
})
|
|
61
|
+
.passthrough();
|
|
62
|
+
const zNotificationEntrySchema = zod_1.z
|
|
63
|
+
.object({
|
|
64
|
+
enabled: zod_1.z.boolean().nullable().optional(),
|
|
65
|
+
channels: zod_1.z
|
|
66
|
+
.record(zod_1.z.string(), zNotificationChannelEntrySchema)
|
|
67
|
+
.nullable()
|
|
68
|
+
.optional(),
|
|
27
69
|
})
|
|
28
70
|
.passthrough();
|
|
29
71
|
exports.zMedCalendarNotificationConfigSchema = zod_1.z
|
|
30
72
|
.object({
|
|
31
|
-
whatsapp: zNotificationWhatsappConfigSchema.optional(),
|
|
32
|
-
email: zNotificationEmailConfigSchema.optional(),
|
|
73
|
+
whatsapp: zNotificationWhatsappConfigSchema.nullable().optional(),
|
|
74
|
+
email: zNotificationEmailConfigSchema.nullable().optional(),
|
|
75
|
+
configs: zod_1.z
|
|
76
|
+
.record(zod_1.z.string(), zNotificationEntrySchema)
|
|
77
|
+
.nullable()
|
|
78
|
+
.optional(),
|
|
33
79
|
})
|
|
34
80
|
.passthrough();
|
|
35
81
|
exports.zMedCalendarSchema = zod_schemas_1.zFireDocSchema
|
|
@@ -5,31 +5,80 @@ import { zMedCalendarIntegrationSchema } from "../../evo-integrations/zod-schema
|
|
|
5
5
|
|
|
6
6
|
// ----- Notification config (feat-048) — molde do `sync_config`: estruturado +
|
|
7
7
|
// `.passthrough()` p/ tolerar campos futuros sem republish.
|
|
8
|
+
//
|
|
9
|
+
// Todo campo opcional aqui é `.nullable()`: o editor do FE materializa "não
|
|
10
|
+
// escolhido" como `null` explícito (`department_id: wa.department_id ?? null` em
|
|
11
|
+
// `utils/calendarNotificationConfig.ts`), e `.passthrough()` NÃO cobre isso —
|
|
12
|
+
// ele só tolera chaves não declaradas, não valor null em chave declarada. Sem
|
|
13
|
+
// `.nullable()` o doc inteiro do calendário reprova, e quem usa `parseDoc`
|
|
14
|
+
// estrito (ex.: AppointmentRouterDialog) fica sem calendário e não renderiza.
|
|
8
15
|
const zNotificationWhatsappConfigSchema = z
|
|
9
16
|
.object({
|
|
10
17
|
enabled: z.boolean(),
|
|
11
|
-
channel_id: z.string().min(1).max(60).optional(),
|
|
12
|
-
department_id: z.string().min(1).max(60).optional(),
|
|
13
|
-
reminder_template_id: z.string().min(1).max(120).optional(),
|
|
14
|
-
on_confirm_quick_reply_id: z.string().min(1).max(120).optional(),
|
|
15
|
-
on_reschedule_quick_reply_id: z
|
|
18
|
+
channel_id: z.string().min(1).max(60).nullable().optional(),
|
|
19
|
+
department_id: z.string().min(1).max(60).nullable().optional(),
|
|
20
|
+
reminder_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
21
|
+
on_confirm_quick_reply_id: z.string().min(1).max(120).nullable().optional(),
|
|
22
|
+
on_reschedule_quick_reply_id: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(120)
|
|
26
|
+
.nullable()
|
|
27
|
+
.optional(),
|
|
16
28
|
})
|
|
17
29
|
.passthrough();
|
|
18
30
|
|
|
19
31
|
const zNotificationEmailConfigSchema = z
|
|
20
32
|
.object({
|
|
21
33
|
enabled: z.boolean(),
|
|
22
|
-
channel_id: z.string().min(1).max(60).optional(),
|
|
23
|
-
reminder_template_id: z.string().min(1).max(120).optional(),
|
|
24
|
-
on_confirm_template_id: z.string().min(1).max(120).optional(),
|
|
25
|
-
on_reschedule_template_id: z.string().min(1).max(120).optional(),
|
|
34
|
+
channel_id: z.string().min(1).max(60).nullable().optional(),
|
|
35
|
+
reminder_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
36
|
+
on_confirm_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
37
|
+
on_reschedule_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
38
|
+
})
|
|
39
|
+
.passthrough();
|
|
40
|
+
|
|
41
|
+
// feat-092: mapa GENÉRICO de configs de notificação (config × canal × template).
|
|
42
|
+
// Tudo opcional + `.passthrough()`; SEM `.default()` (o data-validator grava só as
|
|
43
|
+
// chaves do input → um default não persistiria). Chave/canal são strings abertas
|
|
44
|
+
// (z.record) ⇒ extensível a novos eventos/canais sem republish.
|
|
45
|
+
const zNotificationCtaSchema = z
|
|
46
|
+
.object({
|
|
47
|
+
key: z.string().min(1).max(60),
|
|
48
|
+
template_id: z.string().min(1).max(120),
|
|
49
|
+
template_type: z.string().min(1).max(40).optional(),
|
|
50
|
+
})
|
|
51
|
+
.passthrough();
|
|
52
|
+
|
|
53
|
+
const zNotificationChannelEntrySchema = z
|
|
54
|
+
.object({
|
|
55
|
+
enabled: z.boolean().nullable().optional(),
|
|
56
|
+
channel_id: z.string().min(1).max(60).nullable().optional(),
|
|
57
|
+
department_id: z.string().min(1).max(60).nullable().optional(),
|
|
58
|
+
template_id: z.string().min(1).max(120).nullable().optional(),
|
|
59
|
+
template_type: z.string().min(1).max(40).nullable().optional(),
|
|
60
|
+
ctas: z.array(zNotificationCtaSchema).nullable().optional(),
|
|
61
|
+
})
|
|
62
|
+
.passthrough();
|
|
63
|
+
|
|
64
|
+
const zNotificationEntrySchema = z
|
|
65
|
+
.object({
|
|
66
|
+
enabled: z.boolean().nullable().optional(),
|
|
67
|
+
channels: z
|
|
68
|
+
.record(z.string(), zNotificationChannelEntrySchema)
|
|
69
|
+
.nullable()
|
|
70
|
+
.optional(),
|
|
26
71
|
})
|
|
27
72
|
.passthrough();
|
|
28
73
|
|
|
29
74
|
export const zMedCalendarNotificationConfigSchema = z
|
|
30
75
|
.object({
|
|
31
|
-
whatsapp: zNotificationWhatsappConfigSchema.optional(),
|
|
32
|
-
email: zNotificationEmailConfigSchema.optional(),
|
|
76
|
+
whatsapp: zNotificationWhatsappConfigSchema.nullable().optional(),
|
|
77
|
+
email: zNotificationEmailConfigSchema.nullable().optional(),
|
|
78
|
+
configs: z
|
|
79
|
+
.record(z.string(), zNotificationEntrySchema)
|
|
80
|
+
.nullable()
|
|
81
|
+
.optional(),
|
|
33
82
|
})
|
|
34
83
|
.passthrough();
|
|
35
84
|
|
|
@@ -15,28 +15,84 @@ export interface IMedCalendarNotificationConfig {
|
|
|
15
15
|
whatsapp?: {
|
|
16
16
|
enabled: boolean;
|
|
17
17
|
/** Doc id do canal evo-chat/whatsapp por onde o lembrete sai. */
|
|
18
|
-
channel_id?: string;
|
|
19
|
-
department_id?: string;
|
|
18
|
+
channel_id?: string | null;
|
|
19
|
+
department_id?: string | null;
|
|
20
20
|
/** HSM que carrega o texto do lembrete (a Meta guarda o corpo; nós só passamos as variáveis). */
|
|
21
|
-
reminder_template_id?: string;
|
|
21
|
+
reminder_template_id?: string | null;
|
|
22
22
|
/** Quick-reply a responder quando o paciente confirmar (consumido pela feat-056). */
|
|
23
|
-
on_confirm_quick_reply_id?: string;
|
|
23
|
+
on_confirm_quick_reply_id?: string | null;
|
|
24
24
|
/** Quick-reply a responder quando o paciente pedir remarcação (feat-056). */
|
|
25
|
-
on_reschedule_quick_reply_id?: string;
|
|
26
|
-
};
|
|
25
|
+
on_reschedule_quick_reply_id?: string | null;
|
|
26
|
+
} | null;
|
|
27
27
|
/** E-mail: envia o lembrete via template de e-mail (corpo renderizado pelo engine). */
|
|
28
28
|
email?: {
|
|
29
29
|
enabled: boolean;
|
|
30
30
|
/** Doc id do canal de e-mail. */
|
|
31
|
-
channel_id?: string;
|
|
31
|
+
channel_id?: string | null;
|
|
32
32
|
/** Template do e-mail de lembrete. */
|
|
33
|
-
reminder_template_id?: string;
|
|
33
|
+
reminder_template_id?: string | null;
|
|
34
34
|
/** Template do e-mail enviado após confirmação (feat-056). */
|
|
35
|
-
on_confirm_template_id?: string;
|
|
35
|
+
on_confirm_template_id?: string | null;
|
|
36
36
|
/** Template do e-mail enviado após pedido de remarcação (feat-056). */
|
|
37
|
-
on_reschedule_template_id?: string;
|
|
38
|
-
};
|
|
37
|
+
on_reschedule_template_id?: string | null;
|
|
38
|
+
} | null;
|
|
39
|
+
/**
|
|
40
|
+
* Mapa GENÉRICO de configs de notificação (feat-092). A chave (`configKey`) é
|
|
41
|
+
* livre; o SIGNIFICADO (`appointment_reminder` | `appointment_created` | …) mora
|
|
42
|
+
* em quem CONSULTA, não no schema. Não envia nada por si só — é referência para
|
|
43
|
+
* agentes que, conforme suas políticas de execução, decidem enviar. Ausência ou
|
|
44
|
+
* config incompleta ⇒ o leitor não faz nada. Coexiste com os blocos `whatsapp`/
|
|
45
|
+
* `email` legados (que os consumidores atuais ainda leem).
|
|
46
|
+
*/
|
|
47
|
+
configs?: {
|
|
48
|
+
[configKey: string]: IMedCalendarNotificationEntry;
|
|
49
|
+
} | null;
|
|
50
|
+
}
|
|
51
|
+
/** Uma config de notificação (feat-092): um evento/momento × seus canais. */
|
|
52
|
+
export interface IMedCalendarNotificationEntry {
|
|
53
|
+
/** Opt-in do config inteiro. Ausente/false ⇒ leitor ignora. */
|
|
54
|
+
enabled?: boolean | null;
|
|
55
|
+
/** Canais habilitados, keyed por tipo ('whatsapp' | 'email' | futuro). */
|
|
56
|
+
channels?: {
|
|
57
|
+
[channelKind: string]: IMedCalendarNotificationChannelEntry;
|
|
58
|
+
} | null;
|
|
39
59
|
}
|
|
60
|
+
/** Config de um canal dentro de um config de notificação (feat-092). */
|
|
61
|
+
export interface IMedCalendarNotificationChannelEntry {
|
|
62
|
+
/** Opt-in do canal. Ausente/false ⇒ leitor ignora este canal. */
|
|
63
|
+
enabled?: boolean | null;
|
|
64
|
+
/** Doc id do canal por onde a mensagem sai. Sem herança — usa o que estiver aqui. */
|
|
65
|
+
channel_id?: string | null;
|
|
66
|
+
/** Departamento que recebe/roteia (opcional). */
|
|
67
|
+
department_id?: string | null;
|
|
68
|
+
/** Template principal da mensagem (HSM name no WA / template_id lógico no email). */
|
|
69
|
+
template_id?: string | null;
|
|
70
|
+
/** Tipo do template principal: 'hsm' | 'email' | … O leitor pode inferir pelo canal. */
|
|
71
|
+
template_type?: string | null;
|
|
72
|
+
/** Botões/ações da mensagem → artefato de resposta de cada um. */
|
|
73
|
+
ctas?: IMedCalendarNotificationCta[] | null;
|
|
74
|
+
}
|
|
75
|
+
/** Um CTA (botão/ação) e o artefato enviado quando o paciente o aciona (feat-092). */
|
|
76
|
+
export interface IMedCalendarNotificationCta {
|
|
77
|
+
/** Identificador livre da ação: 'confirm' | 'reschedule' | 'cancel' | … */
|
|
78
|
+
key: string;
|
|
79
|
+
/** Template/quick-reply de resposta ao acionar o CTA. */
|
|
80
|
+
template_id: string;
|
|
81
|
+
/** Tipo do artefato: 'quick_reply' | 'hsm' | 'email' | … */
|
|
82
|
+
template_type?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Chaves canônicas conhecidas de `configs` (feat-092) — SÓ referência para
|
|
86
|
+
* autocomplete/UI. O schema NÃO restringe (a chave é string aberta) e os leitores
|
|
87
|
+
* ignoram chaves desconhecidas.
|
|
88
|
+
*/
|
|
89
|
+
export declare const MedCalendarNotificationConfigKeys: {
|
|
90
|
+
readonly AppointmentReminder: "appointment_reminder";
|
|
91
|
+
readonly AppointmentCreated: "appointment_created";
|
|
92
|
+
readonly AppointmentRescheduled: "appointment_rescheduled";
|
|
93
|
+
readonly AppointmentCancelled: "appointment_cancelled";
|
|
94
|
+
};
|
|
95
|
+
export type MedCalendarNotificationConfigKey = (typeof MedCalendarNotificationConfigKeys)[keyof typeof MedCalendarNotificationConfigKeys];
|
|
40
96
|
export interface IMedCalendar extends IFireDoc {
|
|
41
97
|
calendarId: string;
|
|
42
98
|
color?: string;
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.EvoMedCalendarPermissions = void 0;
|
|
17
|
+
exports.MedCalendarNotificationConfigKeys = exports.EvoMedCalendarPermissions = void 0;
|
|
18
18
|
__exportStar(require("../../evo-people/fb_collections"), exports);
|
|
19
19
|
// Permissões para o calendário
|
|
20
20
|
exports.EvoMedCalendarPermissions = {
|
|
@@ -24,3 +24,14 @@ exports.EvoMedCalendarPermissions = {
|
|
|
24
24
|
Update: "evo_med_calendar_write",
|
|
25
25
|
Delete: "evo_med_calendar_write",
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Chaves canônicas conhecidas de `configs` (feat-092) — SÓ referência para
|
|
29
|
+
* autocomplete/UI. O schema NÃO restringe (a chave é string aberta) e os leitores
|
|
30
|
+
* ignoram chaves desconhecidas.
|
|
31
|
+
*/
|
|
32
|
+
exports.MedCalendarNotificationConfigKeys = {
|
|
33
|
+
AppointmentReminder: "appointment_reminder",
|
|
34
|
+
AppointmentCreated: "appointment_created",
|
|
35
|
+
AppointmentRescheduled: "appointment_rescheduled",
|
|
36
|
+
AppointmentCancelled: "appointment_cancelled",
|
|
37
|
+
};
|
|
@@ -20,34 +20,100 @@ export type EvoMedCalendarPermissions =
|
|
|
20
20
|
// e, futuramente, pela feat-056 (resposta ao confirmar/remarcar). Molde do bloco
|
|
21
21
|
// `integration.sync_config`: estruturado, validado por zod, com `.passthrough()`
|
|
22
22
|
// para tolerar campos futuros sem republish.
|
|
23
|
+
//
|
|
24
|
+
// `| null` em todo campo opcional NÃO é decorativo: o editor do FE grava "não
|
|
25
|
+
// escolhido" como `null` explícito (ver `utils/calendarNotificationConfig.ts`),
|
|
26
|
+
// e `.passthrough()` não cobre valor null em chave declarada — só chave
|
|
27
|
+
// desconhecida. Sem isso o doc do calendário inteiro reprova no zod.
|
|
23
28
|
export interface IMedCalendarNotificationConfig {
|
|
24
29
|
/** WhatsApp: envia o lembrete via HSM + botões de confirmar/remarcar. */
|
|
25
30
|
whatsapp?: {
|
|
26
31
|
enabled: boolean;
|
|
27
32
|
/** Doc id do canal evo-chat/whatsapp por onde o lembrete sai. */
|
|
28
|
-
channel_id?: string;
|
|
29
|
-
department_id?: string;
|
|
33
|
+
channel_id?: string | null;
|
|
34
|
+
department_id?: string | null;
|
|
30
35
|
/** HSM que carrega o texto do lembrete (a Meta guarda o corpo; nós só passamos as variáveis). */
|
|
31
|
-
reminder_template_id?: string;
|
|
36
|
+
reminder_template_id?: string | null;
|
|
32
37
|
/** Quick-reply a responder quando o paciente confirmar (consumido pela feat-056). */
|
|
33
|
-
on_confirm_quick_reply_id?: string;
|
|
38
|
+
on_confirm_quick_reply_id?: string | null;
|
|
34
39
|
/** Quick-reply a responder quando o paciente pedir remarcação (feat-056). */
|
|
35
|
-
on_reschedule_quick_reply_id?: string;
|
|
36
|
-
};
|
|
40
|
+
on_reschedule_quick_reply_id?: string | null;
|
|
41
|
+
} | null;
|
|
37
42
|
/** E-mail: envia o lembrete via template de e-mail (corpo renderizado pelo engine). */
|
|
38
43
|
email?: {
|
|
39
44
|
enabled: boolean;
|
|
40
45
|
/** Doc id do canal de e-mail. */
|
|
41
|
-
channel_id?: string;
|
|
46
|
+
channel_id?: string | null;
|
|
42
47
|
/** Template do e-mail de lembrete. */
|
|
43
|
-
reminder_template_id?: string;
|
|
48
|
+
reminder_template_id?: string | null;
|
|
44
49
|
/** Template do e-mail enviado após confirmação (feat-056). */
|
|
45
|
-
on_confirm_template_id?: string;
|
|
50
|
+
on_confirm_template_id?: string | null;
|
|
46
51
|
/** Template do e-mail enviado após pedido de remarcação (feat-056). */
|
|
47
|
-
on_reschedule_template_id?: string;
|
|
48
|
-
};
|
|
52
|
+
on_reschedule_template_id?: string | null;
|
|
53
|
+
} | null;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Mapa GENÉRICO de configs de notificação (feat-092). A chave (`configKey`) é
|
|
57
|
+
* livre; o SIGNIFICADO (`appointment_reminder` | `appointment_created` | …) mora
|
|
58
|
+
* em quem CONSULTA, não no schema. Não envia nada por si só — é referência para
|
|
59
|
+
* agentes que, conforme suas políticas de execução, decidem enviar. Ausência ou
|
|
60
|
+
* config incompleta ⇒ o leitor não faz nada. Coexiste com os blocos `whatsapp`/
|
|
61
|
+
* `email` legados (que os consumidores atuais ainda leem).
|
|
62
|
+
*/
|
|
63
|
+
configs?: { [configKey: string]: IMedCalendarNotificationEntry } | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Uma config de notificação (feat-092): um evento/momento × seus canais. */
|
|
67
|
+
export interface IMedCalendarNotificationEntry {
|
|
68
|
+
/** Opt-in do config inteiro. Ausente/false ⇒ leitor ignora. */
|
|
69
|
+
enabled?: boolean | null;
|
|
70
|
+
/** Canais habilitados, keyed por tipo ('whatsapp' | 'email' | futuro). */
|
|
71
|
+
channels?: {
|
|
72
|
+
[channelKind: string]: IMedCalendarNotificationChannelEntry;
|
|
73
|
+
} | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Config de um canal dentro de um config de notificação (feat-092). */
|
|
77
|
+
export interface IMedCalendarNotificationChannelEntry {
|
|
78
|
+
/** Opt-in do canal. Ausente/false ⇒ leitor ignora este canal. */
|
|
79
|
+
enabled?: boolean | null;
|
|
80
|
+
/** Doc id do canal por onde a mensagem sai. Sem herança — usa o que estiver aqui. */
|
|
81
|
+
channel_id?: string | null;
|
|
82
|
+
/** Departamento que recebe/roteia (opcional). */
|
|
83
|
+
department_id?: string | null;
|
|
84
|
+
/** Template principal da mensagem (HSM name no WA / template_id lógico no email). */
|
|
85
|
+
template_id?: string | null;
|
|
86
|
+
/** Tipo do template principal: 'hsm' | 'email' | … O leitor pode inferir pelo canal. */
|
|
87
|
+
template_type?: string | null;
|
|
88
|
+
/** Botões/ações da mensagem → artefato de resposta de cada um. */
|
|
89
|
+
ctas?: IMedCalendarNotificationCta[] | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Um CTA (botão/ação) e o artefato enviado quando o paciente o aciona (feat-092). */
|
|
93
|
+
export interface IMedCalendarNotificationCta {
|
|
94
|
+
/** Identificador livre da ação: 'confirm' | 'reschedule' | 'cancel' | … */
|
|
95
|
+
key: string;
|
|
96
|
+
/** Template/quick-reply de resposta ao acionar o CTA. */
|
|
97
|
+
template_id: string;
|
|
98
|
+
/** Tipo do artefato: 'quick_reply' | 'hsm' | 'email' | … */
|
|
99
|
+
template_type?: string;
|
|
49
100
|
}
|
|
50
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Chaves canônicas conhecidas de `configs` (feat-092) — SÓ referência para
|
|
104
|
+
* autocomplete/UI. O schema NÃO restringe (a chave é string aberta) e os leitores
|
|
105
|
+
* ignoram chaves desconhecidas.
|
|
106
|
+
*/
|
|
107
|
+
export const MedCalendarNotificationConfigKeys = {
|
|
108
|
+
AppointmentReminder: "appointment_reminder",
|
|
109
|
+
AppointmentCreated: "appointment_created",
|
|
110
|
+
AppointmentRescheduled: "appointment_rescheduled",
|
|
111
|
+
AppointmentCancelled: "appointment_cancelled",
|
|
112
|
+
} as const;
|
|
113
|
+
|
|
114
|
+
export type MedCalendarNotificationConfigKey =
|
|
115
|
+
(typeof MedCalendarNotificationConfigKeys)[keyof typeof MedCalendarNotificationConfigKeys];
|
|
116
|
+
|
|
51
117
|
// ----- MedCalendarTypes
|
|
52
118
|
export interface IMedCalendar extends IFireDoc {
|
|
53
119
|
calendarId: string;
|