evo360-types 1.3.444 → 1.3.448

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.
@@ -161,6 +161,31 @@ export declare const zLeadSchema: z.ZodObject<{
161
161
  }, z.ZodTypeAny, "passthrough">>>>;
162
162
  chat_contact_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
163
163
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ /**
165
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
166
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
167
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
168
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
169
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
170
+ */
171
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
172
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
173
+ id: z.ZodString;
174
+ label: z.ZodOptional<z.ZodString>;
175
+ ref: z.ZodOptional<z.ZodAny>;
176
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
177
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
178
+ id: z.ZodString;
179
+ label: z.ZodOptional<z.ZodString>;
180
+ ref: z.ZodOptional<z.ZodAny>;
181
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
182
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
183
+ id: z.ZodString;
184
+ label: z.ZodOptional<z.ZodString>;
185
+ ref: z.ZodOptional<z.ZodAny>;
186
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
187
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
188
+ externalLinkKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
164
189
  tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
165
190
  name: z.ZodString;
166
191
  color: z.ZodOptional<z.ZodString>;
@@ -307,6 +332,31 @@ export declare const zLeadSchema: z.ZodObject<{
307
332
  }, z.ZodTypeAny, "passthrough">>>>;
308
333
  chat_contact_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
309
334
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ /**
336
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
337
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
338
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
339
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
340
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
341
+ */
342
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
343
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
344
+ id: z.ZodString;
345
+ label: z.ZodOptional<z.ZodString>;
346
+ ref: z.ZodOptional<z.ZodAny>;
347
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
348
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
349
+ id: z.ZodString;
350
+ label: z.ZodOptional<z.ZodString>;
351
+ ref: z.ZodOptional<z.ZodAny>;
352
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
353
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
354
+ id: z.ZodString;
355
+ label: z.ZodOptional<z.ZodString>;
356
+ ref: z.ZodOptional<z.ZodAny>;
357
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
358
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
359
+ externalLinkKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
310
360
  tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
311
361
  name: z.ZodString;
312
362
  color: z.ZodOptional<z.ZodString>;
@@ -453,6 +503,31 @@ export declare const zLeadSchema: z.ZodObject<{
453
503
  }, z.ZodTypeAny, "passthrough">>>>;
454
504
  chat_contact_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
455
505
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
506
+ /**
507
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
508
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
509
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
510
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
511
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
512
+ */
513
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
514
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
515
+ id: z.ZodString;
516
+ label: z.ZodOptional<z.ZodString>;
517
+ ref: z.ZodOptional<z.ZodAny>;
518
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
519
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
520
+ id: z.ZodString;
521
+ label: z.ZodOptional<z.ZodString>;
522
+ ref: z.ZodOptional<z.ZodAny>;
523
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
524
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
525
+ id: z.ZodString;
526
+ label: z.ZodOptional<z.ZodString>;
527
+ ref: z.ZodOptional<z.ZodAny>;
528
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
529
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
530
+ externalLinkKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
456
531
  tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
457
532
  name: z.ZodString;
458
533
  color: z.ZodOptional<z.ZodString>;
@@ -4,12 +4,13 @@ exports.zLeadSchema = exports.zLeadReactivationSchema = exports.zLeadDistChannel
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../../shared/zod-schemas");
6
6
  const zod_schemas_2 = require("../../evo-people/zod-schemas");
7
- const zod_schemas_3 = require("../dic/zod-schemas");
7
+ const zod_schemas_3 = require("../../evo-task/zod-schemas");
8
+ const zod_schemas_4 = require("../dic/zod-schemas");
8
9
  exports.zLeadStatusSchema = zod_1.z.enum(["active", "inactive", "draft"]);
9
10
  exports.zLeadQualificationSchema = zod_1.z.object({
10
11
  code: zod_1.z.string().min(1).max(20),
11
12
  name: zod_1.z.string().min(1).max(255),
12
- funnelLevel: zod_schemas_3.zQualificationFunnelLevelSchema,
13
+ funnelLevel: zod_schemas_4.zQualificationFunnelLevelSchema,
13
14
  ref: zod_1.z.any(),
14
15
  updated_at: zod_1.z.coerce.date().nullable().optional(),
15
16
  });
@@ -38,6 +39,16 @@ exports.zLeadSchema = zod_schemas_2.zProfileSchema // Extend from ProfileSchema
38
39
  contact: zod_schemas_1.zContactSchema.nullable().optional(),
39
40
  chat_contact_id: zod_1.z.string().or(zod_1.z.number()).nullable().optional(),
40
41
  notes: zod_1.z.string().nullable().optional(),
42
+ /**
43
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
44
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
45
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
46
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
47
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
48
+ */
49
+ externalLinks: zod_1.z.array(zod_schemas_3.zExternalLinkSchema).optional(),
50
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
51
+ externalLinkKeys: zod_1.z.array(zod_1.z.string()).optional(),
41
52
  tags: zod_1.z.array(zod_schemas_1.zTagSchema).nullable().optional(),
42
53
  userRef: zod_1.z.any(),
43
54
  reactivation: exports.zLeadReactivationSchema.nullable().optional(),
@@ -5,6 +5,7 @@ import {
5
5
  zTagSchema,
6
6
  } from "../../shared/zod-schemas";
7
7
  import { zProfileSchema } from "../../evo-people/zod-schemas";
8
+ import { zExternalLinkSchema } from "../../evo-task/zod-schemas";
8
9
  import { zQualificationFunnelLevelSchema } from "../dic/zod-schemas";
9
10
 
10
11
  export const zLeadStatusSchema = z.enum(["active", "inactive", "draft"]);
@@ -44,6 +45,16 @@ export const zLeadSchema = zProfileSchema // Extend from ProfileSchema
44
45
  contact: zContactSchema.nullable().optional(),
45
46
  chat_contact_id: z.string().or(z.number()).nullable().optional(),
46
47
  notes: z.string().nullable().optional(),
48
+ /**
49
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
50
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
51
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
52
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
53
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
54
+ */
55
+ externalLinks: z.array(zExternalLinkSchema).optional(),
56
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
57
+ externalLinkKeys: z.array(z.string()).optional(),
47
58
  tags: z.array(zTagSchema).nullable().optional(),
48
59
  userRef: z.any(),
49
60
  reactivation: zLeadReactivationSchema.nullable().optional(),
@@ -791,8 +791,39 @@ export declare const zPatientSchema: z.ZodObject<{
791
791
  instagram: z.ZodOptional<z.ZodNullable<z.ZodString>>;
792
792
  instagram_username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
793
793
  }, z.ZodTypeAny, "passthrough">>>>;
794
+ /**
795
+ * @deprecated Vínculo escalar com o lead. Não representa o caso real de um
796
+ * lead com VÁRIOS pacientes (ex.: mãe que agenda para a família inteira).
797
+ * Substituído por `externalLinks` com `{ type: 'crm_lead', id }`, que é N↔N.
798
+ * Mantido em escrita dupla enquanto houver leitores (getLeadContext, filtro
799
+ * `lead_id` do índice Algolia, sidebar do Omni). feat-095.
800
+ */
794
801
  lead_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
802
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
795
803
  chat_contact_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
804
+ /**
805
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
806
+ * Mecanismo transversal e N↔N — um paciente pode responder a vários leads e
807
+ * um lead pode ter vários pacientes. feat-095.
808
+ */
809
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
810
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
811
+ id: z.ZodString;
812
+ label: z.ZodOptional<z.ZodString>;
813
+ ref: z.ZodOptional<z.ZodAny>;
814
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
815
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
816
+ id: z.ZodString;
817
+ label: z.ZodOptional<z.ZodString>;
818
+ ref: z.ZodOptional<z.ZodAny>;
819
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
820
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
821
+ id: z.ZodString;
822
+ label: z.ZodOptional<z.ZodString>;
823
+ ref: z.ZodOptional<z.ZodAny>;
824
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
825
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
826
+ externalLinkKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
796
827
  height_cm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
797
828
  weight_kg: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
798
829
  blood_type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-", "Unknown"]>, z.ZodEffects<z.ZodLiteral<"unknown">, string, "unknown">]>>>;
@@ -1098,8 +1129,39 @@ export declare const zPatientSchema: z.ZodObject<{
1098
1129
  instagram: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1099
1130
  instagram_username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1100
1131
  }, z.ZodTypeAny, "passthrough">>>>;
1132
+ /**
1133
+ * @deprecated Vínculo escalar com o lead. Não representa o caso real de um
1134
+ * lead com VÁRIOS pacientes (ex.: mãe que agenda para a família inteira).
1135
+ * Substituído por `externalLinks` com `{ type: 'crm_lead', id }`, que é N↔N.
1136
+ * Mantido em escrita dupla enquanto houver leitores (getLeadContext, filtro
1137
+ * `lead_id` do índice Algolia, sidebar do Omni). feat-095.
1138
+ */
1101
1139
  lead_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1140
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
1102
1141
  chat_contact_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
1142
+ /**
1143
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
1144
+ * Mecanismo transversal e N↔N — um paciente pode responder a vários leads e
1145
+ * um lead pode ter vários pacientes. feat-095.
1146
+ */
1147
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1148
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
1149
+ id: z.ZodString;
1150
+ label: z.ZodOptional<z.ZodString>;
1151
+ ref: z.ZodOptional<z.ZodAny>;
1152
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1153
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
1154
+ id: z.ZodString;
1155
+ label: z.ZodOptional<z.ZodString>;
1156
+ ref: z.ZodOptional<z.ZodAny>;
1157
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1158
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
1159
+ id: z.ZodString;
1160
+ label: z.ZodOptional<z.ZodString>;
1161
+ ref: z.ZodOptional<z.ZodAny>;
1162
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
1163
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
1164
+ externalLinkKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1103
1165
  height_cm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1104
1166
  weight_kg: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1105
1167
  blood_type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-", "Unknown"]>, z.ZodEffects<z.ZodLiteral<"unknown">, string, "unknown">]>>>;
@@ -1405,8 +1467,39 @@ export declare const zPatientSchema: z.ZodObject<{
1405
1467
  instagram: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1406
1468
  instagram_username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1407
1469
  }, z.ZodTypeAny, "passthrough">>>>;
1470
+ /**
1471
+ * @deprecated Vínculo escalar com o lead. Não representa o caso real de um
1472
+ * lead com VÁRIOS pacientes (ex.: mãe que agenda para a família inteira).
1473
+ * Substituído por `externalLinks` com `{ type: 'crm_lead', id }`, que é N↔N.
1474
+ * Mantido em escrita dupla enquanto houver leitores (getLeadContext, filtro
1475
+ * `lead_id` do índice Algolia, sidebar do Omni). feat-095.
1476
+ */
1408
1477
  lead_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1478
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
1409
1479
  chat_contact_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
1480
+ /**
1481
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
1482
+ * Mecanismo transversal e N↔N — um paciente pode responder a vários leads e
1483
+ * um lead pode ter vários pacientes. feat-095.
1484
+ */
1485
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1486
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
1487
+ id: z.ZodString;
1488
+ label: z.ZodOptional<z.ZodString>;
1489
+ ref: z.ZodOptional<z.ZodAny>;
1490
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1491
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
1492
+ id: z.ZodString;
1493
+ label: z.ZodOptional<z.ZodString>;
1494
+ ref: z.ZodOptional<z.ZodAny>;
1495
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1496
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact", "evo_task", "campaign"]>;
1497
+ id: z.ZodString;
1498
+ label: z.ZodOptional<z.ZodString>;
1499
+ ref: z.ZodOptional<z.ZodAny>;
1500
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
1501
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
1502
+ externalLinkKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1410
1503
  height_cm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1411
1504
  weight_kg: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1412
1505
  blood_type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-", "Unknown"]>, z.ZodEffects<z.ZodLiteral<"unknown">, string, "unknown">]>>>;
@@ -125,8 +125,24 @@ exports.zPatientSchema = zod_schemas_4.zProfileSchema // Extend from ProfileSche
125
125
  sourceRef: zod_1.z.any().optional(),
126
126
  address: zod_schemas_2.zAddressSchema.nullable().optional(),
127
127
  contact: zod_schemas_2.zContactSchema.nullable().optional(),
128
+ /**
129
+ * @deprecated Vínculo escalar com o lead. Não representa o caso real de um
130
+ * lead com VÁRIOS pacientes (ex.: mãe que agenda para a família inteira).
131
+ * Substituído por `externalLinks` com `{ type: 'crm_lead', id }`, que é N↔N.
132
+ * Mantido em escrita dupla enquanto houver leitores (getLeadContext, filtro
133
+ * `lead_id` do índice Algolia, sidebar do Omni). feat-095.
134
+ */
128
135
  lead_id: zod_1.z.string().nullable().optional(),
136
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
129
137
  chat_contact_id: zod_1.z.string().or(zod_1.z.number()).nullable().optional(),
138
+ /**
139
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
140
+ * Mecanismo transversal e N↔N — um paciente pode responder a vários leads e
141
+ * um lead pode ter vários pacientes. feat-095.
142
+ */
143
+ externalLinks: zod_1.z.array(zod_schemas_3.zExternalLinkSchema).optional(),
144
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
145
+ externalLinkKeys: zod_1.z.array(zod_1.z.string()).optional(),
130
146
  height_cm: zod_1.z.number().nullable().optional(),
131
147
  weight_kg: zod_1.z.number().nullable().optional(),
132
148
  blood_type: exports.zBloodTypeSchema.nullable().optional(),
@@ -146,8 +146,24 @@ export const zPatientSchema = zProfileSchema // Extend from ProfileSchema
146
146
  sourceRef: z.any().optional(),
147
147
  address: zAddressSchema.nullable().optional(),
148
148
  contact: zContactSchema.nullable().optional(),
149
+ /**
150
+ * @deprecated Vínculo escalar com o lead. Não representa o caso real de um
151
+ * lead com VÁRIOS pacientes (ex.: mãe que agenda para a família inteira).
152
+ * Substituído por `externalLinks` com `{ type: 'crm_lead', id }`, que é N↔N.
153
+ * Mantido em escrita dupla enquanto houver leitores (getLeadContext, filtro
154
+ * `lead_id` do índice Algolia, sidebar do Omni). feat-095.
155
+ */
149
156
  lead_id: z.string().nullable().optional(),
157
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
150
158
  chat_contact_id: z.string().or(z.number()).nullable().optional(),
159
+ /**
160
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
161
+ * Mecanismo transversal e N↔N — um paciente pode responder a vários leads e
162
+ * um lead pode ter vários pacientes. feat-095.
163
+ */
164
+ externalLinks: z.array(zExternalLinkSchema).optional(),
165
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
166
+ externalLinkKeys: z.array(z.string()).optional(),
151
167
  height_cm: z.number().nullable().optional(),
152
168
  weight_kg: z.number().nullable().optional(),
153
169
  blood_type: zBloodTypeSchema.nullable().optional(),
@@ -1,5 +1,5 @@
1
1
  export * from "../fb_collections";
2
- import { FirestoreDocumentReference, IAddress, IContact, ITag } from "../../shared";
2
+ import { FirestoreDocumentReference, IAddress, IContact, IExternalLink, ITag } from "../../shared";
3
3
  import { IProfile } from "../../evo-people";
4
4
  import { QualificationFunnelLevel } from "../dic";
5
5
  export declare const EvoCrmLeadPermissions: {
@@ -101,6 +101,16 @@ export interface ILead extends IProfile {
101
101
  contact?: IContact | null;
102
102
  chat_contact_id?: string | number | null;
103
103
  notes?: string | null;
104
+ /**
105
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
106
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
107
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
108
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
109
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
110
+ */
111
+ externalLinks?: IExternalLink[];
112
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
113
+ externalLinkKeys?: string[];
104
114
  tags?: ITag[] | null;
105
115
  userRef?: FirestoreDocumentReference;
106
116
  ctwa_clid?: string | null;
@@ -4,6 +4,7 @@ import {
4
4
  FirestoreDocumentReference,
5
5
  IAddress,
6
6
  IContact,
7
+ IExternalLink,
7
8
  ITag,
8
9
  } from "../../shared";
9
10
  import { IProfile } from "../../evo-people";
@@ -142,6 +143,16 @@ export interface ILead extends IProfile {
142
143
  contact?: IContact | null;
143
144
  chat_contact_id?: string | number | null;
144
145
  notes?: string | null; // Anotações sobre o lead
146
+ /**
147
+ * Vínculos com outros objetos do sistema. O par lead↔paciente é gravado nos
148
+ * DOIS lados: aqui entram `{ type: 'med_patient', id, label: display_name do
149
+ * paciente }` e, no paciente, `{ type: 'crm_lead', id, label: display_name do
150
+ * lead }`. É N↔N: um lead pode ter vários pacientes (ex.: mãe que agenda para
151
+ * a família inteira) e um paciente pode responder a vários leads. feat-095.
152
+ */
153
+ externalLinks?: IExternalLink[];
154
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
155
+ externalLinkKeys?: string[];
145
156
  tags?: ITag[] | null;
146
157
  userRef?: FirestoreDocumentReference;
147
158
  // CTWA attribution (feat-034) — capturado do referral do 1º inbound vindo de anúncio Click-to-WhatsApp.
@@ -157,8 +157,23 @@ export interface IPatient extends IProfile {
157
157
  sourceRef?: FirestoreDocumentReference;
158
158
  address?: IAddress | null;
159
159
  contact?: IContact | null;
160
+ /**
161
+ * @deprecated Vínculo escalar com o lead — não representa um lead com VÁRIOS
162
+ * pacientes (ex.: mãe que agenda para a família inteira). Use `externalLinks`
163
+ * com `{ type: 'crm_lead', id }`. Mantido em escrita dupla enquanto houver
164
+ * leitores (getLeadContext, filtro `lead_id` do índice Algolia). feat-095.
165
+ */
160
166
  lead_id?: string | null;
167
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
161
168
  chat_contact_id?: string | number | null;
169
+ /**
170
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
171
+ * Transversal e N↔N: um paciente pode responder a vários leads e um lead pode
172
+ * ter vários pacientes. feat-095.
173
+ */
174
+ externalLinks?: IExternalLink[];
175
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
176
+ externalLinkKeys?: string[];
162
177
  height_cm?: number | null;
163
178
  weight_kg?: number | null;
164
179
  blood_type?: BloodType | null;
@@ -220,8 +220,23 @@ export interface IPatient extends IProfile {
220
220
  sourceRef?: FirestoreDocumentReference;
221
221
  address?: IAddress | null;
222
222
  contact?: IContact | null;
223
+ /**
224
+ * @deprecated Vínculo escalar com o lead — não representa um lead com VÁRIOS
225
+ * pacientes (ex.: mãe que agenda para a família inteira). Use `externalLinks`
226
+ * com `{ type: 'crm_lead', id }`. Mantido em escrita dupla enquanto houver
227
+ * leitores (getLeadContext, filtro `lead_id` do índice Algolia). feat-095.
228
+ */
223
229
  lead_id?: string | null;
230
+ /** @deprecated Ver `lead_id` — mesma migração para `externalLinks`. feat-095. */
224
231
  chat_contact_id?: string | number | null;
232
+ /**
233
+ * Vínculos com outros objetos do sistema (`crm_lead`, `med_appointment`, …).
234
+ * Transversal e N↔N: um paciente pode responder a vários leads e um lead pode
235
+ * ter vários pacientes. feat-095.
236
+ */
237
+ externalLinks?: IExternalLink[];
238
+ /** Derivado de `externalLinks` (`"type:id"`) pelo model — habilita `array-contains`. */
239
+ externalLinkKeys?: string[];
225
240
  //informações médicas
226
241
  height_cm?: number | null; // Altura em centímetros
227
242
  weight_kg?: number | null; // Peso em kg
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.444",
3
+ "version": "1.3.448",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",