evo360-types 1.3.634 → 1.3.637

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.
Files changed (61) hide show
  1. package/dist/apps/evo-activity/zod-schemas.d.ts +6 -6
  2. package/dist/apps/evo-chat/chatbee/zod-schemas.d.ts +6 -6
  3. package/dist/apps/evo-chat/contact/zod-schemas.d.ts +6 -6
  4. package/dist/apps/evo-chat/dic/ticket-close/zod-schemas.d.ts +12 -12
  5. package/dist/apps/evo-chat/message/zod-schemas.d.ts +6 -6
  6. package/dist/apps/evo-crm/dic/zod-schemas.d.ts +70 -18
  7. package/dist/apps/evo-crm/dic/zod-schemas.js +17 -1
  8. package/dist/apps/evo-crm/dic/zod-schemas.ts +20 -0
  9. package/dist/apps/evo-crm/lead/zod-schemas.d.ts +240 -6
  10. package/dist/apps/evo-crm/lead/zod-schemas.js +6 -0
  11. package/dist/apps/evo-crm/lead/zod-schemas.ts +6 -0
  12. package/dist/apps/evo-csq/zod-schemas.d.ts +52 -52
  13. package/dist/apps/evo-finops/zod-schemas.d.ts +439 -7
  14. package/dist/apps/evo-hub-ia/channel/zod-schemas.d.ts +2 -2
  15. package/dist/apps/evo-hub-ia/v1/zod-schemas.d.ts +28 -28
  16. package/dist/apps/evo-integrations/zod-schemas.d.ts +24 -16
  17. package/dist/apps/evo-integrations/zod-schemas.js +8 -1
  18. package/dist/apps/evo-integrations/zod-schemas.ts +9 -0
  19. package/dist/apps/evo-med/appointment/zod-schemas.d.ts +83 -6
  20. package/dist/apps/evo-med/appointment/zod-schemas.js +19 -1
  21. package/dist/apps/evo-med/appointment/zod-schemas.ts +21 -0
  22. package/dist/apps/evo-med/calendar/zod-schemas.d.ts +6 -6
  23. package/dist/apps/evo-med/dic/zod-schemas.d.ts +14 -14
  24. package/dist/apps/evo-med/insurance/zod-schemas.d.ts +6 -6
  25. package/dist/apps/evo-med/people/zod-schemas.d.ts +1118 -20
  26. package/dist/apps/evo-med/people/zod-schemas.js +6 -0
  27. package/dist/apps/evo-med/people/zod-schemas.ts +6 -0
  28. package/dist/apps/evo-med/procedure/zod-schemas.d.ts +12 -12
  29. package/dist/apps/evo-notif-user/zod-schemas.d.ts +18 -18
  30. package/dist/apps/evo-notifications/zod-schemas.d.ts +936 -0
  31. package/dist/apps/evo-people/zod-schemas.d.ts +24 -24
  32. package/dist/apps/evo-survey/zod-schemas.d.ts +79 -79
  33. package/dist/apps/evo-task/zod-schemas.d.ts +453 -78
  34. package/dist/apps/evo-task/zod-schemas.js +66 -1
  35. package/dist/apps/evo-task/zod-schemas.ts +71 -0
  36. package/dist/apps/evo-tenant/zod-schemas.d.ts +18 -5
  37. package/dist/apps/evo-tenant/zod-schemas.js +3 -0
  38. package/dist/apps/evo-tenant/zod-schemas.ts +3 -0
  39. package/dist/apps/hub-automation/zod-schemas.d.ts +327 -327
  40. package/dist/apps/shared/zod-schemas.d.ts +3 -3
  41. package/dist/types/evo-crm/dic/index.d.ts +16 -1
  42. package/dist/types/evo-crm/dic/index.ts +23 -1
  43. package/dist/types/evo-crm/fb_collections.d.ts +1 -0
  44. package/dist/types/evo-crm/fb_collections.js +5 -1
  45. package/dist/types/evo-crm/fb_collections.ts +4 -0
  46. package/dist/types/evo-crm/lead/index.d.ts +6 -0
  47. package/dist/types/evo-crm/lead/index.ts +6 -0
  48. package/dist/types/evo-integrations/index.d.ts +16 -0
  49. package/dist/types/evo-integrations/index.js +18 -1
  50. package/dist/types/evo-integrations/index.ts +26 -0
  51. package/dist/types/evo-med/appointment/index.d.ts +22 -0
  52. package/dist/types/evo-med/appointment/index.js +7 -1
  53. package/dist/types/evo-med/appointment/index.ts +30 -0
  54. package/dist/types/evo-med/people/index.d.ts +6 -0
  55. package/dist/types/evo-med/people/index.ts +6 -0
  56. package/dist/types/evo-tenant/index.d.ts +7 -0
  57. package/dist/types/evo-tenant/index.ts +7 -0
  58. package/dist/types/shared/external-links.d.ts +98 -0
  59. package/dist/types/shared/external-links.js +64 -1
  60. package/dist/types/shared/external-links.ts +118 -0
  61. package/package.json +1 -1
@@ -25,8 +25,8 @@ export declare const zFireDocSchema: z.ZodObject<{
25
25
  id: string;
26
26
  tenant: string;
27
27
  ref?: any;
28
- model_ver?: number | undefined;
29
28
  created_at?: Date | null | undefined;
29
+ model_ver?: number | undefined;
30
30
  updated_at?: Date | null | undefined;
31
31
  deleted_at?: Date | null | undefined;
32
32
  }>;
@@ -40,14 +40,14 @@ export declare const zTagSchema: z.ZodObject<{
40
40
  name: string;
41
41
  hidden: boolean;
42
42
  base?: boolean | undefined;
43
- color?: string | undefined;
44
43
  category?: string | null | undefined;
44
+ color?: string | undefined;
45
45
  }, {
46
46
  name: string;
47
47
  hidden: boolean;
48
48
  base?: boolean | undefined;
49
- color?: string | undefined;
50
49
  category?: string | null | undefined;
50
+ color?: string | undefined;
51
51
  }>;
52
52
  export declare const zAddressSchema: z.ZodObject<{
53
53
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -1,5 +1,5 @@
1
1
  export * from "../fb_collections";
2
- import { FirestoreDocumentReference, IFireDoc, ITag } from "../../shared";
2
+ import { FirestoreDocumentReference, IFireDoc, ITag, LinkRelationPair, LinkRelationRole } from "../../shared";
3
3
  export declare const EvoCrmDicPermissions: {
4
4
  readonly List: "evo_crm_dic_read";
5
5
  readonly Get: "evo_crm_dic_read";
@@ -73,3 +73,18 @@ export interface IQualification extends IFireDoc {
73
73
  meta_event_value?: number | null;
74
74
  [key: string]: unknown;
75
75
  }
76
+ /**
77
+ * feat-193 — item do dicionário `link-relations` (rótulos e ordem). O doc id é o
78
+ * `code`. O inverso de cada papel é tabela de código em `@evo/model`, não daqui.
79
+ */
80
+ export interface ILinkRelation extends IFireDoc {
81
+ code: LinkRelationPair;
82
+ name: string;
83
+ role_a: LinkRelationRole;
84
+ role_b: LinkRelationRole;
85
+ label_a: string;
86
+ label_b: string;
87
+ symmetric: boolean;
88
+ order: number;
89
+ [key: string]: unknown;
90
+ }
@@ -1,6 +1,12 @@
1
1
  export * from "../fb_collections";
2
2
 
3
- import { FirestoreDocumentReference, IFireDoc, ITag } from "../../shared";
3
+ import {
4
+ FirestoreDocumentReference,
5
+ IFireDoc,
6
+ ITag,
7
+ LinkRelationPair,
8
+ LinkRelationRole,
9
+ } from "../../shared";
4
10
 
5
11
  // Permissões para o dicionário
6
12
  export const EvoCrmDicPermissions = {
@@ -125,3 +131,19 @@ export interface IQualification extends IFireDoc {
125
131
  meta_event_value?: number | null;
126
132
  [key: string]: unknown; // index signature
127
133
  }
134
+
135
+ /**
136
+ * feat-193 — item do dicionário `link-relations` (rótulos e ordem). O doc id é o
137
+ * `code`. O inverso de cada papel é tabela de código em `@evo/model`, não daqui.
138
+ */
139
+ export interface ILinkRelation extends IFireDoc {
140
+ code: LinkRelationPair;
141
+ name: string;
142
+ role_a: LinkRelationRole;
143
+ role_b: LinkRelationRole;
144
+ label_a: string;
145
+ label_b: string;
146
+ symmetric: boolean;
147
+ order: number;
148
+ [key: string]: unknown; // index signature
149
+ }
@@ -4,4 +4,5 @@ export declare const LEAD_QUALIFICATION_COLLECTION = "qualification";
4
4
  export declare const CHANNELS = "channels";
5
5
  export declare const DIST_CHANNEL_TYPES_COLLECTION = "dist-channel-types";
6
6
  export declare const DIST_CHANNELS_COLLECTION = "dist-channels";
7
+ export declare const LINK_RELATIONS_COLLECTION = "link-relations";
7
8
  export declare const LEADS_COLLECTION = "leads";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LEADS_COLLECTION = exports.DIST_CHANNELS_COLLECTION = exports.DIST_CHANNEL_TYPES_COLLECTION = exports.CHANNELS = exports.LEAD_QUALIFICATION_COLLECTION = exports.LEADS = exports.EVO_CRM_APP = void 0;
3
+ exports.LEADS_COLLECTION = exports.LINK_RELATIONS_COLLECTION = exports.DIST_CHANNELS_COLLECTION = exports.DIST_CHANNEL_TYPES_COLLECTION = exports.CHANNELS = exports.LEAD_QUALIFICATION_COLLECTION = exports.LEADS = exports.EVO_CRM_APP = void 0;
4
4
  //EVO CRM Application Doc
5
5
  exports.EVO_CRM_APP = "evo-crm";
6
6
  //dictionaries
@@ -9,5 +9,9 @@ exports.LEAD_QUALIFICATION_COLLECTION = "qualification";
9
9
  exports.CHANNELS = "channels";
10
10
  exports.DIST_CHANNEL_TYPES_COLLECTION = "dist-channel-types";
11
11
  exports.DIST_CHANNELS_COLLECTION = "dist-channels";
12
+ // feat-193 — rótulos e ordem dos pares de relação do vínculo lead/paciente.
13
+ // Path: tenants/{t}/apps/evo-crm/dics/leads/link-relations/{pair} (base tenant,
14
+ // global em `_global-ptBR`). O inverso de cada papel NÃO vem daqui: é tabela de código.
15
+ exports.LINK_RELATIONS_COLLECTION = "link-relations";
12
16
  // Leads
13
17
  exports.LEADS_COLLECTION = "leads";
@@ -8,6 +8,10 @@ export const LEAD_QUALIFICATION_COLLECTION = "qualification";
8
8
  export const CHANNELS = "channels";
9
9
  export const DIST_CHANNEL_TYPES_COLLECTION = "dist-channel-types";
10
10
  export const DIST_CHANNELS_COLLECTION = "dist-channels";
11
+ // feat-193 — rótulos e ordem dos pares de relação do vínculo lead/paciente.
12
+ // Path: tenants/{t}/apps/evo-crm/dics/leads/link-relations/{pair} (base tenant,
13
+ // global em `_global-ptBR`). O inverso de cada papel NÃO vem daqui: é tabela de código.
14
+ export const LINK_RELATIONS_COLLECTION = "link-relations";
11
15
 
12
16
  // Leads
13
17
  export const LEADS_COLLECTION = "leads";
@@ -111,6 +111,12 @@ export interface ILead extends IProfile {
111
111
  externalLinks?: IExternalLink[];
112
112
  /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
113
113
  externalLinkKeys?: string[];
114
+ /**
115
+ * feat-193 — quantos links deste doc estão `suggested` (fila de auditoria).
116
+ * Derivado de `externalLinks` junto com `externalLinkKeys`. AUSENTE = estoque
117
+ * não avaliado ("unknown"), nunca 0.
118
+ */
119
+ pending_links_count?: number;
114
120
  tags?: ITag[] | null;
115
121
  /** Campos complementares (code → valor), validados contra o dicionário `dics/leads/capture-data` (feat-196). */
116
122
  capture_data?: CaptureDataMap | null;
@@ -154,6 +154,12 @@ export interface ILead extends IProfile {
154
154
  externalLinks?: IExternalLink[];
155
155
  /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
156
156
  externalLinkKeys?: string[];
157
+ /**
158
+ * feat-193 — quantos links deste doc estão `suggested` (fila de auditoria).
159
+ * Derivado de `externalLinks` junto com `externalLinkKeys`. AUSENTE = estoque
160
+ * não avaliado ("unknown"), nunca 0.
161
+ */
162
+ pending_links_count?: number;
157
163
  tags?: ITag[] | null;
158
164
  /** Campos complementares (code → valor), validados contra o dicionário `dics/leads/capture-data` (feat-196). */
159
165
  capture_data?: CaptureDataMap | null;
@@ -232,3 +232,19 @@ export interface IMedCalendarIntegration {
232
232
  /** Override por capability — precedência mais alta no resolver de URL. */
233
233
  workflow_overrides?: Partial<Record<CapabilityName, string>>;
234
234
  }
235
+ /**
236
+ * Modo do passo de vínculo paciente↔lead dos escritores automáticos (sync,
237
+ * lembrete, envio). `off` = não calcula; `shadow` = calcula e loga `would_link`
238
+ * sem escrever (default quando ausente); `write` = grava. Rollback = `off`.
239
+ */
240
+ export declare const LinkModeEnum: {
241
+ readonly Off: "off";
242
+ readonly Shadow: "shadow";
243
+ readonly Write: "write";
244
+ };
245
+ export type LinkMode = (typeof LinkModeEnum)[keyof typeof LinkModeEnum];
246
+ /** Default quando o tenant não declara `integrations.link_mode`. */
247
+ export declare const DEFAULT_LINK_MODE: LinkMode;
248
+ export interface ITenantIntegrationsConfig {
249
+ link_mode?: LinkMode | null;
250
+ }
@@ -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.OBLIGATORY_CAPABILITIES = exports.SYNC_RUN_HANDLER = exports.SYNC_RUN_PUBSUB_TOPIC = exports.EvoIntegrationsPermissions = void 0;
17
+ exports.DEFAULT_LINK_MODE = exports.LinkModeEnum = exports.OBLIGATORY_CAPABILITIES = exports.SYNC_RUN_HANDLER = exports.SYNC_RUN_PUBSUB_TOPIC = exports.EvoIntegrationsPermissions = void 0;
18
18
  exports.isInternalCapability = isInternalCapability;
19
19
  exports.splitCapabilityName = splitCapabilityName;
20
20
  __exportStar(require("./fb_collections"), exports);
@@ -70,3 +70,20 @@ function splitCapabilityName(name) {
70
70
  const [entity, ...rest] = name.split(".");
71
71
  return { entity: entity, action: rest.join(".") };
72
72
  }
73
+ // ======================================================
74
+ // feat-193 — config de integração do TENANT (não do calendar/adapter).
75
+ // Vive em `ITenant.integrations` (doc `tenants/{t}`), lida pelo sync junto com a
76
+ // config do adapter. Provisionada por script/admin técnico, nunca pelo FE.
77
+ // ======================================================
78
+ /**
79
+ * Modo do passo de vínculo paciente↔lead dos escritores automáticos (sync,
80
+ * lembrete, envio). `off` = não calcula; `shadow` = calcula e loga `would_link`
81
+ * sem escrever (default quando ausente); `write` = grava. Rollback = `off`.
82
+ */
83
+ exports.LinkModeEnum = {
84
+ Off: "off",
85
+ Shadow: "shadow",
86
+ Write: "write",
87
+ };
88
+ /** Default quando o tenant não declara `integrations.link_mode`. */
89
+ exports.DEFAULT_LINK_MODE = exports.LinkModeEnum.Shadow;
@@ -350,3 +350,29 @@ export interface IMedCalendarIntegration {
350
350
  /** Override por capability — precedência mais alta no resolver de URL. */
351
351
  workflow_overrides?: Partial<Record<CapabilityName, string>>;
352
352
  }
353
+
354
+ // ======================================================
355
+ // feat-193 — config de integração do TENANT (não do calendar/adapter).
356
+ // Vive em `ITenant.integrations` (doc `tenants/{t}`), lida pelo sync junto com a
357
+ // config do adapter. Provisionada por script/admin técnico, nunca pelo FE.
358
+ // ======================================================
359
+
360
+ /**
361
+ * Modo do passo de vínculo paciente↔lead dos escritores automáticos (sync,
362
+ * lembrete, envio). `off` = não calcula; `shadow` = calcula e loga `would_link`
363
+ * sem escrever (default quando ausente); `write` = grava. Rollback = `off`.
364
+ */
365
+ export const LinkModeEnum = {
366
+ Off: "off",
367
+ Shadow: "shadow",
368
+ Write: "write",
369
+ } as const;
370
+
371
+ export type LinkMode = (typeof LinkModeEnum)[keyof typeof LinkModeEnum];
372
+
373
+ /** Default quando o tenant não declara `integrations.link_mode`. */
374
+ export const DEFAULT_LINK_MODE: LinkMode = LinkModeEnum.Shadow;
375
+
376
+ export interface ITenantIntegrationsConfig {
377
+ link_mode?: LinkMode | null;
378
+ }
@@ -165,6 +165,26 @@ export interface IAppointmentSpecialty {
165
165
  specialtyRef?: FirestoreDocumentReference;
166
166
  [key: string]: unknown;
167
167
  }
168
+ /** feat-193 F4 — origem de quem pediu o agendamento. */
169
+ export type AppointmentRequestedBySource = "ui_omni" | "ui_calendar" | "hubia" | "mcp";
170
+ export declare const AppointmentRequestedBySourceEnum: {
171
+ readonly UiOmni: "ui_omni";
172
+ readonly UiCalendar: "ui_calendar";
173
+ readonly HubIA: "hubia";
174
+ readonly Mcp: "mcp";
175
+ };
176
+ /**
177
+ * feat-193 F4 — quem pediu o agendamento. Gravado no create quando há contexto
178
+ * (lead da conversa no omni, HubIA, MCP); fora dele fica `null`. Campo LOCAL:
179
+ * a agenda externa não o conhece e o sync/write-through o preservam.
180
+ */
181
+ export interface IAppointmentRequestedBy {
182
+ lead_id: string | null;
183
+ chat_contact_id: string | null;
184
+ ticket_id: string | null;
185
+ display_name: string | null;
186
+ source: AppointmentRequestedBySource;
187
+ }
168
188
  export interface IAppointment extends IFireDoc {
169
189
  startDate: Date;
170
190
  endDate: Date;
@@ -203,6 +223,8 @@ export interface IAppointment extends IFireDoc {
203
223
  status_external_id?: string | null;
204
224
  isDraft: boolean;
205
225
  draftExpirationMinutes?: number | null;
226
+ /** feat-193 F4 — solicitante do agendamento. Ver `IAppointmentRequestedBy`. */
227
+ requested_by?: IAppointmentRequestedBy | null;
206
228
  tags?: ITag[] | null;
207
229
  [key: string]: unknown;
208
230
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaymentTypeEnum = exports.TelemedicineProviderEnum = exports.AppointmentModeEnum = exports.AppointmentPaymentStatusEnum = exports.EvoMedAppointmentPermissions = void 0;
3
+ exports.AppointmentRequestedBySourceEnum = exports.PaymentTypeEnum = exports.TelemedicineProviderEnum = exports.AppointmentModeEnum = exports.AppointmentPaymentStatusEnum = exports.EvoMedAppointmentPermissions = void 0;
4
4
  // Permissões para o agendamento
5
5
  exports.EvoMedAppointmentPermissions = {
6
6
  List: "evo_med_appointment_read",
@@ -43,3 +43,9 @@ exports.PaymentTypeEnum = {
43
43
  Patient: "patient",
44
44
  Insurance: "insurance",
45
45
  };
46
+ exports.AppointmentRequestedBySourceEnum = {
47
+ UiOmni: "ui_omni",
48
+ UiCalendar: "ui_calendar",
49
+ HubIA: "hubia",
50
+ Mcp: "mcp",
51
+ };
@@ -222,6 +222,33 @@ export interface IAppointmentSpecialty {
222
222
  }
223
223
 
224
224
  // Interface principal do Appointment
225
+ /** feat-193 F4 — origem de quem pediu o agendamento. */
226
+ export type AppointmentRequestedBySource =
227
+ | "ui_omni"
228
+ | "ui_calendar"
229
+ | "hubia"
230
+ | "mcp";
231
+
232
+ export const AppointmentRequestedBySourceEnum = {
233
+ UiOmni: "ui_omni",
234
+ UiCalendar: "ui_calendar",
235
+ HubIA: "hubia",
236
+ Mcp: "mcp",
237
+ } as const;
238
+
239
+ /**
240
+ * feat-193 F4 — quem pediu o agendamento. Gravado no create quando há contexto
241
+ * (lead da conversa no omni, HubIA, MCP); fora dele fica `null`. Campo LOCAL:
242
+ * a agenda externa não o conhece e o sync/write-through o preservam.
243
+ */
244
+ export interface IAppointmentRequestedBy {
245
+ lead_id: string | null;
246
+ chat_contact_id: string | null;
247
+ ticket_id: string | null;
248
+ display_name: string | null;
249
+ source: AppointmentRequestedBySource;
250
+ }
251
+
225
252
  export interface IAppointment extends IFireDoc {
226
253
  startDate: Date;
227
254
  endDate: Date;
@@ -263,6 +290,9 @@ export interface IAppointment extends IFireDoc {
263
290
  isDraft: boolean;
264
291
  draftExpirationMinutes?: number | null; // tempo em minutos para expiração do rascunho
265
292
 
293
+ /** feat-193 F4 — solicitante do agendamento. Ver `IAppointmentRequestedBy`. */
294
+ requested_by?: IAppointmentRequestedBy | null;
295
+
266
296
  tags?: ITag[] | null;
267
297
  [key: string]: unknown; // index signature
268
298
  }
@@ -174,6 +174,12 @@ export interface IPatient extends IProfile {
174
174
  externalLinks?: IExternalLink[];
175
175
  /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
176
176
  externalLinkKeys?: string[];
177
+ /**
178
+ * feat-193 — quantos links deste doc estão `suggested` (fila de auditoria).
179
+ * Derivado de `externalLinks` junto com `externalLinkKeys`. AUSENTE = estoque
180
+ * não avaliado ("unknown"), nunca 0.
181
+ */
182
+ pending_links_count?: number;
177
183
  height_cm?: number | null;
178
184
  weight_kg?: number | null;
179
185
  blood_type?: BloodType | null;
@@ -238,6 +238,12 @@ export interface IPatient extends IProfile {
238
238
  externalLinks?: IExternalLink[];
239
239
  /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
240
240
  externalLinkKeys?: string[];
241
+ /**
242
+ * feat-193 — quantos links deste doc estão `suggested` (fila de auditoria).
243
+ * Derivado de `externalLinks` junto com `externalLinkKeys`. AUSENTE = estoque
244
+ * não avaliado ("unknown"), nunca 0.
245
+ */
246
+ pending_links_count?: number;
241
247
  //informações médicas
242
248
  height_cm?: number | null; // Altura em centímetros
243
249
  weight_kg?: number | null; // Peso em kg
@@ -1,5 +1,6 @@
1
1
  export * from "./fb_collections";
2
2
  import type { FirestoreDocumentReference, IFireDoc } from "../shared";
3
+ import type { ITenantIntegrationsConfig } from "../evo-integrations";
3
4
  export declare const CoreTenantsPermissions: {
4
5
  readonly List: "core_tenants_read";
5
6
  readonly Get: "core_tenants_read";
@@ -89,4 +90,10 @@ export interface ITenant extends IFireDoc {
89
90
  * técnico auditado; nunca pelo FE.
90
91
  */
91
92
  modules?: Record<string, ITenantModuleEntitlement>;
93
+ /**
94
+ * feat-193 — config de integração do tenant (`link_mode` do passo de vínculo
95
+ * paciente↔lead). Ausente = defaults (`DEFAULT_LINK_MODE`). Provisionado por
96
+ * script/admin técnico; nunca pelo FE.
97
+ */
98
+ integrations?: ITenantIntegrationsConfig | null;
92
99
  }
@@ -1,5 +1,6 @@
1
1
  export * from "./fb_collections";
2
2
  import type { FirestoreDocumentReference, IFireDoc } from "../shared";
3
+ import type { ITenantIntegrationsConfig } from "../evo-integrations";
3
4
 
4
5
  // Permissões para o tenant
5
6
  export const CoreTenantsPermissions = {
@@ -122,4 +123,10 @@ export interface ITenant extends IFireDoc {
122
123
  * técnico auditado; nunca pelo FE.
123
124
  */
124
125
  modules?: Record<string, ITenantModuleEntitlement>;
126
+ /**
127
+ * feat-193 — config de integração do tenant (`link_mode` do passo de vínculo
128
+ * paciente↔lead). Ausente = defaults (`DEFAULT_LINK_MODE`). Provisionado por
129
+ * script/admin técnico; nunca pelo FE.
130
+ */
131
+ integrations?: ITenantIntegrationsConfig | null;
125
132
  }
@@ -37,11 +37,109 @@ export declare const ExternalOwnerSystemEnum: {
37
37
  readonly Nexus: "nexus";
38
38
  };
39
39
  export type ExternalOwnerSystem = (typeof ExternalOwnerSystemEnum)[keyof typeof ExternalOwnerSystemEnum];
40
+ /**
41
+ * feat-193 — natureza do vínculo lead/paciente (`crm_lead` <-> `med_patient`,
42
+ * `med_patient` <-> `med_patient`, `crm_lead` <-> `crm_lead`).
43
+ *
44
+ * `identity` = mesma pessoa; `representation` = "fala/agenda/paga por". Vínculo
45
+ * inferido nasce `representation`: é a afirmação mais fraca e sempre verdadeira.
46
+ * Só `identity` CONFIRMADA grava `patient.lead_id`, e há no máximo uma por paciente.
47
+ */
48
+ export declare const ExternalLinkKindEnum: {
49
+ readonly Identity: "identity";
50
+ readonly Representation: "representation";
51
+ };
52
+ export type ExternalLinkKind = (typeof ExternalLinkKindEnum)[keyof typeof ExternalLinkKindEnum];
53
+ /**
54
+ * feat-193 — ÚNICA fonte de verdade do estado do vínculo (não existe campo
55
+ * `confirmed`). Automação só cria `suggested` ou re-observa; confirmar, rejeitar,
56
+ * promover e rebaixar são ações humanas. `rejected` fica em `externalLinks` como
57
+ * lápide e sai de `externalLinkKeys`.
58
+ */
59
+ export declare const ExternalLinkStatusEnum: {
60
+ readonly Suggested: "suggested";
61
+ readonly Confirmed: "confirmed";
62
+ readonly Rejected: "rejected";
63
+ };
64
+ export type ExternalLinkStatus = (typeof ExternalLinkStatusEnum)[keyof typeof ExternalLinkStatusEnum];
65
+ /** feat-193 — origem de quem criou/observou/confirmou o vínculo. */
66
+ export declare const ExternalLinkSourceEnum: {
67
+ readonly UiAppointment: "ui_appointment";
68
+ readonly UiManual: "ui_manual";
69
+ readonly UiFamily: "ui_family";
70
+ readonly SyncInferred: "sync_inferred";
71
+ readonly ReminderInferred: "reminder_inferred";
72
+ readonly SendInferred: "send_inferred";
73
+ readonly LeadAutocreate: "lead_autocreate";
74
+ readonly Inherited: "inherited";
75
+ readonly Merge: "merge";
76
+ /** Aresta sintetizada a partir de um `patient.lead_id` sem `crm_lead:*`. */
77
+ readonly Legacy: "legacy";
78
+ };
79
+ export type ExternalLinkSource = (typeof ExternalLinkSourceEnum)[keyof typeof ExternalLinkSourceEnum];
80
+ /**
81
+ * feat-193 — par de relação (chave neutra de gênero). O rótulo exibido vem do
82
+ * dicionário `link-relations`; o inverso de cada papel é tabela de código.
83
+ */
84
+ export declare const LinkRelationPairEnum: {
85
+ readonly ParentChild: "parent_child";
86
+ readonly Spouse: "spouse";
87
+ readonly GuardianDependent: "guardian_dependent";
88
+ readonly Family: "family";
89
+ readonly CompanyEmployee: "company_employee";
90
+ readonly ThirdPartyCompany: "third_party_company";
91
+ readonly Other: "other";
92
+ };
93
+ export type LinkRelationPair = (typeof LinkRelationPairEnum)[keyof typeof LinkRelationPairEnum];
94
+ export declare const LinkRelationRoleEnum: {
95
+ readonly Parent: "parent";
96
+ readonly Child: "child";
97
+ readonly Spouse: "spouse";
98
+ readonly Guardian: "guardian";
99
+ readonly Dependent: "dependent";
100
+ readonly Family: "family";
101
+ readonly Company: "company";
102
+ readonly Employee: "employee";
103
+ readonly ThirdParty: "third_party";
104
+ readonly Represented: "represented";
105
+ readonly Other: "other";
106
+ };
107
+ export type LinkRelationRole = (typeof LinkRelationRoleEnum)[keyof typeof LinkRelationRoleEnum];
108
+ /**
109
+ * feat-193 — relação qualificada. `other_role` é o papel do objeto APONTADO em
110
+ * relação a quem guarda o link: no paciente B filho do lead A, o link para A
111
+ * carrega `{ pair: 'parent_child', other_role: 'parent' }`; no lead A, o link
112
+ * para B carrega `{ pair: 'parent_child', other_role: 'child' }`.
113
+ */
114
+ export interface IExternalLinkRelation {
115
+ pair: LinkRelationPair;
116
+ other_role: LinkRelationRole;
117
+ }
40
118
  export interface IExternalLink {
41
119
  type: ExternalObjectType;
42
120
  id: string;
43
121
  label?: string;
44
122
  ref?: FirestoreDocumentReference;
123
+ kind?: ExternalLinkKind;
124
+ relation?: IExternalLinkRelation | null;
125
+ status?: ExternalLinkStatus;
126
+ /**
127
+ * sha256(evidence_type|e164_completo|a_type:a_id|b_type:b_id|normalizer_version).
128
+ * Hash, sem PII. Uma rejeição só bloqueia a re-inferência da MESMA evidência.
129
+ */
130
+ evidence_fingerprint?: string | null;
131
+ created_source?: ExternalLinkSource;
132
+ created_by?: FirestoreDocumentReference | null;
133
+ created_at?: Date | null;
134
+ /** Última automação que reviu a evidência (nunca muda `status`/`kind`). */
135
+ last_observed_source?: ExternalLinkSource | null;
136
+ last_observed_at?: Date | null;
137
+ confirmed_source?: ExternalLinkSource | null;
138
+ confirmed_by?: FirestoreDocumentReference | null;
139
+ confirmed_at?: Date | null;
140
+ rejected_by?: FirestoreDocumentReference | null;
141
+ rejected_at?: Date | null;
142
+ rejection_reason?: string | null;
45
143
  /**
46
144
  * feat-125 — sistema dono do objeto quando ele NÃO vive no tenant.
47
145
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExternalOwnerSystemEnum = exports.ExternalObjectTypeEnum = void 0;
3
+ exports.LinkRelationRoleEnum = exports.LinkRelationPairEnum = exports.ExternalLinkSourceEnum = exports.ExternalLinkStatusEnum = exports.ExternalLinkKindEnum = exports.ExternalOwnerSystemEnum = exports.ExternalObjectTypeEnum = void 0;
4
4
  // ----- External object links (for unified UI views across modules)
5
5
  // Promoted from evo-task to shared for reuse in invoices, tasks, and other modules
6
6
  exports.ExternalObjectTypeEnum = {
@@ -39,3 +39,66 @@ exports.ExternalObjectTypeEnum = {
39
39
  exports.ExternalOwnerSystemEnum = {
40
40
  Nexus: "nexus",
41
41
  };
42
+ /**
43
+ * feat-193 — natureza do vínculo lead/paciente (`crm_lead` <-> `med_patient`,
44
+ * `med_patient` <-> `med_patient`, `crm_lead` <-> `crm_lead`).
45
+ *
46
+ * `identity` = mesma pessoa; `representation` = "fala/agenda/paga por". Vínculo
47
+ * inferido nasce `representation`: é a afirmação mais fraca e sempre verdadeira.
48
+ * Só `identity` CONFIRMADA grava `patient.lead_id`, e há no máximo uma por paciente.
49
+ */
50
+ exports.ExternalLinkKindEnum = {
51
+ Identity: "identity",
52
+ Representation: "representation",
53
+ };
54
+ /**
55
+ * feat-193 — ÚNICA fonte de verdade do estado do vínculo (não existe campo
56
+ * `confirmed`). Automação só cria `suggested` ou re-observa; confirmar, rejeitar,
57
+ * promover e rebaixar são ações humanas. `rejected` fica em `externalLinks` como
58
+ * lápide e sai de `externalLinkKeys`.
59
+ */
60
+ exports.ExternalLinkStatusEnum = {
61
+ Suggested: "suggested",
62
+ Confirmed: "confirmed",
63
+ Rejected: "rejected",
64
+ };
65
+ /** feat-193 — origem de quem criou/observou/confirmou o vínculo. */
66
+ exports.ExternalLinkSourceEnum = {
67
+ UiAppointment: "ui_appointment",
68
+ UiManual: "ui_manual",
69
+ UiFamily: "ui_family",
70
+ SyncInferred: "sync_inferred",
71
+ ReminderInferred: "reminder_inferred",
72
+ SendInferred: "send_inferred",
73
+ LeadAutocreate: "lead_autocreate",
74
+ Inherited: "inherited",
75
+ Merge: "merge",
76
+ /** Aresta sintetizada a partir de um `patient.lead_id` sem `crm_lead:*`. */
77
+ Legacy: "legacy",
78
+ };
79
+ /**
80
+ * feat-193 — par de relação (chave neutra de gênero). O rótulo exibido vem do
81
+ * dicionário `link-relations`; o inverso de cada papel é tabela de código.
82
+ */
83
+ exports.LinkRelationPairEnum = {
84
+ ParentChild: "parent_child",
85
+ Spouse: "spouse",
86
+ GuardianDependent: "guardian_dependent",
87
+ Family: "family",
88
+ CompanyEmployee: "company_employee",
89
+ ThirdPartyCompany: "third_party_company",
90
+ Other: "other",
91
+ };
92
+ exports.LinkRelationRoleEnum = {
93
+ Parent: "parent",
94
+ Child: "child",
95
+ Spouse: "spouse",
96
+ Guardian: "guardian",
97
+ Dependent: "dependent",
98
+ Family: "family",
99
+ Company: "company",
100
+ Employee: "employee",
101
+ ThirdParty: "third_party",
102
+ Represented: "represented",
103
+ Other: "other",
104
+ };