@fiado/type-kit 3.185.0 → 3.187.0

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 (109) hide show
  1. package/bin/index.d.ts +2 -0
  2. package/bin/index.js +7 -1
  3. package/bin/loanCollectorAssignment/dtos/PriorityWeights.d.ts +10 -0
  4. package/bin/loanCollectorAssignment/dtos/PriorityWeights.js +43 -0
  5. package/bin/loanCollectorAssignment/dtos/requests/AutoAssignRequest.d.ts +9 -0
  6. package/bin/loanCollectorAssignment/dtos/requests/AutoAssignRequest.js +39 -0
  7. package/bin/loanCollectorAssignment/dtos/requests/CreateAssignmentRuleRequest.d.ts +12 -0
  8. package/bin/loanCollectorAssignment/dtos/requests/CreateAssignmentRuleRequest.js +46 -0
  9. package/bin/loanCollectorAssignment/dtos/requests/ReassignRequest.d.ts +7 -0
  10. package/bin/loanCollectorAssignment/dtos/requests/ReassignRequest.js +27 -0
  11. package/bin/loanCollectorAssignment/dtos/requests/RedistributeRequest.d.ts +7 -0
  12. package/bin/loanCollectorAssignment/dtos/requests/RedistributeRequest.js +27 -0
  13. package/bin/loanCollectorAssignment/dtos/requests/UpdateAssignmentRuleRequest.d.ts +12 -0
  14. package/bin/loanCollectorAssignment/dtos/requests/UpdateAssignmentRuleRequest.js +49 -0
  15. package/bin/loanCollectorAssignment/dtos/responses/AssignmentRuleResponse.d.ts +15 -0
  16. package/bin/loanCollectorAssignment/dtos/responses/AssignmentRuleResponse.js +2 -0
  17. package/bin/loanCollectorAssignment/dtos/responses/CollectorAssignmentResponse.d.ts +16 -0
  18. package/bin/loanCollectorAssignment/dtos/responses/CollectorAssignmentResponse.js +2 -0
  19. package/bin/loanCollectorAssignment/dtos/responses/CollectorLoadResponse.d.ts +11 -0
  20. package/bin/loanCollectorAssignment/dtos/responses/CollectorLoadResponse.js +2 -0
  21. package/bin/loanCollectorAssignment/dtos/responses/RedistributeSummaryResponse.d.ts +9 -0
  22. package/bin/loanCollectorAssignment/dtos/responses/RedistributeSummaryResponse.js +2 -0
  23. package/bin/loanCollectorAssignment/enums/AssignmentStatusEnum.d.ts +10 -0
  24. package/bin/loanCollectorAssignment/enums/AssignmentStatusEnum.js +14 -0
  25. package/bin/loanCollectorAssignment/enums/AssignmentStrategyEnum.d.ts +12 -0
  26. package/bin/loanCollectorAssignment/enums/AssignmentStrategyEnum.js +16 -0
  27. package/bin/loanCollectorAssignment/index.d.ts +12 -0
  28. package/bin/loanCollectorAssignment/index.js +32 -0
  29. package/bin/loanOfferings/dtos/CreditPlan.d.ts +52 -0
  30. package/bin/loanOfferings/dtos/CreditPlan.js +184 -0
  31. package/bin/loanOfferings/dtos/Financier.d.ts +30 -0
  32. package/bin/loanOfferings/dtos/Financier.js +103 -0
  33. package/bin/loanOfferings/dtos/RetailerCreditPlan.d.ts +15 -0
  34. package/bin/loanOfferings/dtos/RetailerCreditPlan.js +71 -0
  35. package/bin/loanOfferings/dtos/requests/ChangeCreditPlanStatusRequest.d.ts +8 -0
  36. package/bin/loanOfferings/dtos/requests/ChangeCreditPlanStatusRequest.js +27 -0
  37. package/bin/loanOfferings/dtos/requests/ChangeFinancierStatusRequest.d.ts +8 -0
  38. package/bin/loanOfferings/dtos/requests/ChangeFinancierStatusRequest.js +27 -0
  39. package/bin/loanOfferings/dtos/requests/CreateCreditPlanRequest.d.ts +27 -0
  40. package/bin/loanOfferings/dtos/requests/CreateCreditPlanRequest.js +137 -0
  41. package/bin/loanOfferings/dtos/requests/CreateFinancierRequest.d.ts +17 -0
  42. package/bin/loanOfferings/dtos/requests/CreateFinancierRequest.js +70 -0
  43. package/bin/loanOfferings/dtos/requests/ReorderFinancierRequest.d.ts +7 -0
  44. package/bin/loanOfferings/dtos/requests/ReorderFinancierRequest.js +27 -0
  45. package/bin/loanOfferings/dtos/requests/SimulateCreditPlanRequest.d.ts +11 -0
  46. package/bin/loanOfferings/dtos/requests/SimulateCreditPlanRequest.js +49 -0
  47. package/bin/loanOfferings/dtos/requests/UpdateCreditPlanRequest.d.ts +25 -0
  48. package/bin/loanOfferings/dtos/requests/UpdateCreditPlanRequest.js +134 -0
  49. package/bin/loanOfferings/dtos/requests/UpdateFinancierRequest.d.ts +12 -0
  50. package/bin/loanOfferings/dtos/requests/UpdateFinancierRequest.js +53 -0
  51. package/bin/loanOfferings/dtos/responses/CreditPlanResponse.d.ts +35 -0
  52. package/bin/loanOfferings/dtos/responses/CreditPlanResponse.js +2 -0
  53. package/bin/loanOfferings/dtos/responses/FinancierResponse.d.ts +23 -0
  54. package/bin/loanOfferings/dtos/responses/FinancierResponse.js +2 -0
  55. package/bin/loanOfferings/dtos/responses/RetailerCreditPlanResponse.d.ts +14 -0
  56. package/bin/loanOfferings/dtos/responses/RetailerCreditPlanResponse.js +2 -0
  57. package/bin/loanOfferings/dtos/responses/SimulationResultResponse.d.ts +44 -0
  58. package/bin/loanOfferings/dtos/responses/SimulationResultResponse.js +2 -0
  59. package/bin/loanOfferings/enums/CreditPlanLevelEnum.d.ts +12 -0
  60. package/bin/loanOfferings/enums/CreditPlanLevelEnum.js +16 -0
  61. package/bin/loanOfferings/enums/CreditPlanStatusEnum.d.ts +8 -0
  62. package/bin/loanOfferings/enums/CreditPlanStatusEnum.js +12 -0
  63. package/bin/loanOfferings/enums/FinancierStatusEnum.d.ts +9 -0
  64. package/bin/loanOfferings/enums/FinancierStatusEnum.js +13 -0
  65. package/bin/loanOfferings/enums/FinancierTypeEnum.d.ts +9 -0
  66. package/bin/loanOfferings/enums/FinancierTypeEnum.js +13 -0
  67. package/bin/loanOfferings/enums/ProductTierEnum.d.ts +15 -0
  68. package/bin/loanOfferings/enums/ProductTierEnum.js +19 -0
  69. package/bin/loanOfferings/enums/SaleTypeEnum.d.ts +13 -0
  70. package/bin/loanOfferings/enums/SaleTypeEnum.js +17 -0
  71. package/bin/loanOfferings/index.d.ts +21 -0
  72. package/bin/loanOfferings/index.js +41 -0
  73. package/package.json +1 -1
  74. package/src/index.ts +6 -0
  75. package/src/loanCollectorAssignment/dtos/PriorityWeights.ts +27 -0
  76. package/src/loanCollectorAssignment/dtos/requests/AutoAssignRequest.ts +23 -0
  77. package/src/loanCollectorAssignment/dtos/requests/CreateAssignmentRuleRequest.ts +29 -0
  78. package/src/loanCollectorAssignment/dtos/requests/ReassignRequest.ts +13 -0
  79. package/src/loanCollectorAssignment/dtos/requests/RedistributeRequest.ts +13 -0
  80. package/src/loanCollectorAssignment/dtos/requests/UpdateAssignmentRuleRequest.ts +32 -0
  81. package/src/loanCollectorAssignment/dtos/responses/AssignmentRuleResponse.ts +16 -0
  82. package/src/loanCollectorAssignment/dtos/responses/CollectorAssignmentResponse.ts +17 -0
  83. package/src/loanCollectorAssignment/dtos/responses/CollectorLoadResponse.ts +11 -0
  84. package/src/loanCollectorAssignment/dtos/responses/RedistributeSummaryResponse.ts +10 -0
  85. package/src/loanCollectorAssignment/enums/AssignmentStatusEnum.ts +10 -0
  86. package/src/loanCollectorAssignment/enums/AssignmentStrategyEnum.ts +12 -0
  87. package/src/loanCollectorAssignment/index.ts +19 -0
  88. package/src/loanOfferings/dtos/CreditPlan.ts +171 -0
  89. package/src/loanOfferings/dtos/Financier.ts +91 -0
  90. package/src/loanOfferings/dtos/RetailerCreditPlan.ts +49 -0
  91. package/src/loanOfferings/dtos/requests/ChangeCreditPlanStatusRequest.ts +13 -0
  92. package/src/loanOfferings/dtos/requests/ChangeFinancierStatusRequest.ts +13 -0
  93. package/src/loanOfferings/dtos/requests/CreateCreditPlanRequest.ts +118 -0
  94. package/src/loanOfferings/dtos/requests/CreateFinancierRequest.ts +57 -0
  95. package/src/loanOfferings/dtos/requests/ReorderFinancierRequest.ts +13 -0
  96. package/src/loanOfferings/dtos/requests/SimulateCreditPlanRequest.ts +32 -0
  97. package/src/loanOfferings/dtos/requests/UpdateCreditPlanRequest.ts +117 -0
  98. package/src/loanOfferings/dtos/requests/UpdateFinancierRequest.ts +41 -0
  99. package/src/loanOfferings/dtos/responses/CreditPlanResponse.ts +36 -0
  100. package/src/loanOfferings/dtos/responses/FinancierResponse.ts +24 -0
  101. package/src/loanOfferings/dtos/responses/RetailerCreditPlanResponse.ts +14 -0
  102. package/src/loanOfferings/dtos/responses/SimulationResultResponse.ts +45 -0
  103. package/src/loanOfferings/enums/CreditPlanLevelEnum.ts +12 -0
  104. package/src/loanOfferings/enums/CreditPlanStatusEnum.ts +8 -0
  105. package/src/loanOfferings/enums/FinancierStatusEnum.ts +9 -0
  106. package/src/loanOfferings/enums/FinancierTypeEnum.ts +9 -0
  107. package/src/loanOfferings/enums/ProductTierEnum.ts +15 -0
  108. package/src/loanOfferings/enums/SaleTypeEnum.ts +13 -0
  109. package/src/loanOfferings/index.ts +28 -0
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductTierEnum = void 0;
4
+ /**
5
+ * Gama del equipo (modelo-datos §4.1 `RetailProduct.tier` · §6.1 `eligibleTiers`).
6
+ *
7
+ * NOTA (supuesto F1): conceptualmente esta gama pertenece al dominio de catálogo retail
8
+ * (`retail-catalog-business`), cuyo dominio type-kit aún no existe. Se define aquí para poder
9
+ * tipar `CreditPlan.eligibleTiers` y `Financier.eligibleTiers` sin bloquear. Al publicarse el
10
+ * dominio `retailCatalog`, consolidar allí y reexportar (coordinar con la pista Retail).
11
+ * @enum {string}
12
+ */
13
+ var ProductTierEnum;
14
+ (function (ProductTierEnum) {
15
+ ProductTierEnum["LOW"] = "LOW";
16
+ ProductTierEnum["MID"] = "MID";
17
+ ProductTierEnum["HIGH"] = "HIGH";
18
+ ProductTierEnum["PREMIUM"] = "PREMIUM";
19
+ })(ProductTierEnum || (exports.ProductTierEnum = ProductTierEnum = {}));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tipo de venta al que aplica un plan de crédito (M6 §4 · modelo-datos §6.1).
3
+ * Un plan puede configurarse para uno o más tipos (por eso `CreditPlan.saleTypes` es array).
4
+ * @enum {string}
5
+ */
6
+ export declare enum SaleTypeEnum {
7
+ /** Cliente sin historial previo con SureKeep (primera compra). */
8
+ NEW = "NEW",
9
+ /** Cliente que ya tuvo un crédito con SureKeep (recompra / renovación). */
10
+ REPURCHASE = "REPURCHASE",
11
+ /** Empleado de VentasLuga que compra para uso personal (condiciones preferenciales). */
12
+ EMPLOYEE = "EMPLOYEE"
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SaleTypeEnum = void 0;
4
+ /**
5
+ * Tipo de venta al que aplica un plan de crédito (M6 §4 · modelo-datos §6.1).
6
+ * Un plan puede configurarse para uno o más tipos (por eso `CreditPlan.saleTypes` es array).
7
+ * @enum {string}
8
+ */
9
+ var SaleTypeEnum;
10
+ (function (SaleTypeEnum) {
11
+ /** Cliente sin historial previo con SureKeep (primera compra). */
12
+ SaleTypeEnum["NEW"] = "NEW";
13
+ /** Cliente que ya tuvo un crédito con SureKeep (recompra / renovación). */
14
+ SaleTypeEnum["REPURCHASE"] = "REPURCHASE";
15
+ /** Empleado de VentasLuga que compra para uso personal (condiciones preferenciales). */
16
+ SaleTypeEnum["EMPLOYEE"] = "EMPLOYEE";
17
+ })(SaleTypeEnum || (exports.SaleTypeEnum = SaleTypeEnum = {}));
@@ -0,0 +1,21 @@
1
+ export * from './enums/CreditPlanLevelEnum';
2
+ export * from './enums/SaleTypeEnum';
3
+ export * from './enums/ProductTierEnum';
4
+ export * from './enums/CreditPlanStatusEnum';
5
+ export * from './enums/FinancierTypeEnum';
6
+ export * from './enums/FinancierStatusEnum';
7
+ export * from './dtos/CreditPlan';
8
+ export * from './dtos/Financier';
9
+ export * from './dtos/RetailerCreditPlan';
10
+ export * from './dtos/requests/CreateCreditPlanRequest';
11
+ export * from './dtos/requests/UpdateCreditPlanRequest';
12
+ export * from './dtos/requests/ChangeCreditPlanStatusRequest';
13
+ export * from './dtos/requests/SimulateCreditPlanRequest';
14
+ export * from './dtos/requests/CreateFinancierRequest';
15
+ export * from './dtos/requests/UpdateFinancierRequest';
16
+ export * from './dtos/requests/ChangeFinancierStatusRequest';
17
+ export * from './dtos/requests/ReorderFinancierRequest';
18
+ export * from './dtos/responses/CreditPlanResponse';
19
+ export * from './dtos/responses/FinancierResponse';
20
+ export * from './dtos/responses/RetailerCreditPlanResponse';
21
+ export * from './dtos/responses/SimulationResultResponse';
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Enums
18
+ __exportStar(require("./enums/CreditPlanLevelEnum"), exports);
19
+ __exportStar(require("./enums/SaleTypeEnum"), exports);
20
+ __exportStar(require("./enums/ProductTierEnum"), exports);
21
+ __exportStar(require("./enums/CreditPlanStatusEnum"), exports);
22
+ __exportStar(require("./enums/FinancierTypeEnum"), exports);
23
+ __exportStar(require("./enums/FinancierStatusEnum"), exports);
24
+ // Entity DTOs
25
+ __exportStar(require("./dtos/CreditPlan"), exports);
26
+ __exportStar(require("./dtos/Financier"), exports);
27
+ __exportStar(require("./dtos/RetailerCreditPlan"), exports);
28
+ // Request DTOs
29
+ __exportStar(require("./dtos/requests/CreateCreditPlanRequest"), exports);
30
+ __exportStar(require("./dtos/requests/UpdateCreditPlanRequest"), exports);
31
+ __exportStar(require("./dtos/requests/ChangeCreditPlanStatusRequest"), exports);
32
+ __exportStar(require("./dtos/requests/SimulateCreditPlanRequest"), exports);
33
+ __exportStar(require("./dtos/requests/CreateFinancierRequest"), exports);
34
+ __exportStar(require("./dtos/requests/UpdateFinancierRequest"), exports);
35
+ __exportStar(require("./dtos/requests/ChangeFinancierStatusRequest"), exports);
36
+ __exportStar(require("./dtos/requests/ReorderFinancierRequest"), exports);
37
+ // Response DTOs
38
+ __exportStar(require("./dtos/responses/CreditPlanResponse"), exports);
39
+ __exportStar(require("./dtos/responses/FinancierResponse"), exports);
40
+ __exportStar(require("./dtos/responses/RetailerCreditPlanResponse"), exports);
41
+ __exportStar(require("./dtos/responses/SimulationResultResponse"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.185.0",
3
+ "version": "3.187.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
package/src/index.ts CHANGED
@@ -105,5 +105,11 @@ export * as EmailVerification from './emailVerification';
105
105
  export * as RetailOrg from './retailOrg';
106
106
  // LoanConfig: DTOs/enums del lambda loan-config-business (comp 09 — parámetros operativos del SOFOM).
107
107
  export * as LoanConfig from './loanConfig';
108
+ // LoanOfferings: DTOs/enums del lambda loan-offerings-business (comp 07 — planes de crédito,
109
+ // financieras, M:N retailer↔plan y simulador de cuota; SureKeep Fase 1 — pista Loan).
110
+ export * as LoanOfferings from './loanOfferings';
111
+ // LoanCollectorAssignment: DTOs/enums del lambda loan-collector-assignment-business (comp 08 — reglas de
112
+ // asignación de cartera de cobranza + asignaciones crédito↔cobrador; SureKeep Fase 1 — pista Loan).
113
+ export * as LoanCollectorAssignment from './loanCollectorAssignment';
108
114
  export * from './messaging';
109
115
  export * from './complaint';
@@ -0,0 +1,27 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsInt, Max, Min } from 'class-validator';
3
+
4
+ /**
5
+ * Pesos del ranking ponderado del algoritmo (modelo-datos §7.1). Cada peso es 0..100; la regla
6
+ * cross-campo `storeMatch + loadAvailable + seniority === 100` la valida el manager del lambda
7
+ * (WeightsSumInvalidError) — class-validator no cubre validaciones entre campos.
8
+ */
9
+ export class PriorityWeights {
10
+ @Expose()
11
+ @IsInt()
12
+ @Min(0)
13
+ @Max(100)
14
+ storeMatch!: number;
15
+
16
+ @Expose()
17
+ @IsInt()
18
+ @Min(0)
19
+ @Max(100)
20
+ loadAvailable!: number;
21
+
22
+ @Expose()
23
+ @IsInt()
24
+ @Min(0)
25
+ @Max(100)
26
+ seniority!: number;
27
+ }
@@ -0,0 +1,23 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString } from 'class-validator';
3
+
4
+ /**
5
+ * Body de POST /private/collector-assignments/auto-assign (hot path). Lo invoca loan-credit-business
6
+ * al crearse un crédito (F3+); en F1 se prueba con `creditId` dummy. Elige cobrador y persiste ACTIVE.
7
+ */
8
+ export class AutoAssignRequest {
9
+ @Expose()
10
+ @IsString()
11
+ @IsNotEmpty()
12
+ retailerId!: string;
13
+
14
+ @Expose()
15
+ @IsString()
16
+ @IsNotEmpty()
17
+ creditId!: string;
18
+
19
+ @Expose()
20
+ @IsString()
21
+ @IsNotEmpty()
22
+ storeId!: string;
23
+ }
@@ -0,0 +1,29 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsBoolean, IsEnum, IsInt, IsOptional, Min, ValidateNested } from 'class-validator';
3
+ import { AssignmentStrategyEnum } from '../../enums/AssignmentStrategyEnum';
4
+ import { PriorityWeights } from '../PriorityWeights';
5
+
6
+ /**
7
+ * Body de POST /retailers/:retailerId/assignment-rules. Crea una regla de asignación.
8
+ * Los pesos deben sumar 100 (lo valida el manager). `active: true` desactiva la regla activa anterior.
9
+ */
10
+ export class CreateAssignmentRuleRequest {
11
+ @Expose()
12
+ @IsEnum(AssignmentStrategyEnum)
13
+ strategy!: AssignmentStrategyEnum;
14
+
15
+ @Expose()
16
+ @IsOptional()
17
+ @IsInt()
18
+ @Min(1)
19
+ maxLoadPerCollector?: number | null;
20
+
21
+ @Expose()
22
+ @ValidateNested()
23
+ @Type(() => PriorityWeights)
24
+ priorityWeights!: PriorityWeights;
25
+
26
+ @Expose()
27
+ @IsBoolean()
28
+ active!: boolean;
29
+ }
@@ -0,0 +1,13 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString } from 'class-validator';
3
+
4
+ /**
5
+ * Body de POST /retailers/:retailerId/collector-assignments/:assignmentId/reassign (reasignación manual).
6
+ * `reason` obligatorio (auditoría de acción crítica — modelo-datos §10).
7
+ */
8
+ export class ReassignRequest {
9
+ @Expose()
10
+ @IsString()
11
+ @IsNotEmpty()
12
+ reason!: string;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsNotEmpty, IsString } from 'class-validator';
3
+
4
+ /**
5
+ * Body de POST /retailers/:retailerId/collectors/:userId/redistribute. Redistribuye la cartera activa de
6
+ * un cobrador (ej. al desactivarlo). `reason` obligatorio (ej. `USER_INACTIVATED`) — auditoría §10.
7
+ */
8
+ export class RedistributeRequest {
9
+ @Expose()
10
+ @IsString()
11
+ @IsNotEmpty()
12
+ reason!: string;
13
+ }
@@ -0,0 +1,32 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsBoolean, IsEnum, IsInt, IsOptional, Min, ValidateNested } from 'class-validator';
3
+ import { AssignmentStrategyEnum } from '../../enums/AssignmentStrategyEnum';
4
+ import { PriorityWeights } from '../PriorityWeights';
5
+
6
+ /**
7
+ * Body de PUT /retailers/:retailerId/assignment-rules/:ruleId. Update parcial: todos los campos opcionales.
8
+ * Si se envían `priorityWeights`, deben sumar 100 (lo valida el manager).
9
+ */
10
+ export class UpdateAssignmentRuleRequest {
11
+ @Expose()
12
+ @IsOptional()
13
+ @IsEnum(AssignmentStrategyEnum)
14
+ strategy?: AssignmentStrategyEnum;
15
+
16
+ @Expose()
17
+ @IsOptional()
18
+ @IsInt()
19
+ @Min(1)
20
+ maxLoadPerCollector?: number | null;
21
+
22
+ @Expose()
23
+ @IsOptional()
24
+ @ValidateNested()
25
+ @Type(() => PriorityWeights)
26
+ priorityWeights?: PriorityWeights;
27
+
28
+ @Expose()
29
+ @IsOptional()
30
+ @IsBoolean()
31
+ active?: boolean;
32
+ }
@@ -0,0 +1,16 @@
1
+ import { AssignmentStrategyEnum } from '../../enums/AssignmentStrategyEnum';
2
+ import { PriorityWeights } from '../PriorityWeights';
3
+
4
+ /** Shape de salida de una regla de asignación (modelo-datos §7.1). */
5
+ export interface AssignmentRuleResponse {
6
+ ruleId: string;
7
+ retailerId: string;
8
+ strategy: AssignmentStrategyEnum;
9
+ maxLoadPerCollector: number | null;
10
+ priorityWeights: PriorityWeights;
11
+ active: boolean;
12
+ createdBy: string;
13
+ updatedBy: string;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
@@ -0,0 +1,17 @@
1
+ import { AssignmentStatusEnum } from '../../enums/AssignmentStatusEnum';
2
+
3
+ /** Shape de salida de una asignación crédito↔cobrador (modelo-datos §7.2). */
4
+ export interface CollectorAssignmentResponse {
5
+ assignmentId: string;
6
+ retailerId: string;
7
+ creditId: string;
8
+ storeId: string;
9
+ collectorUserId: string;
10
+ assignedAt: string;
11
+ status: AssignmentStatusEnum;
12
+ reassignedFromUserId: string | null;
13
+ createdBy: string;
14
+ updatedBy: string;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Carga actual de un cobrador (flow 07.2 / GET /retailers/:retailerId/collector-loads).
3
+ * `activeAssignments` = COUNT de asignaciones ACTIVE (GSI collectorUserId-assignedAt-index).
4
+ * `threshold` = maxLoadPerCollector de la regla activa (null si no hay tope).
5
+ */
6
+ export interface CollectorLoadResponse {
7
+ collectorUserId: string;
8
+ activeAssignments: number;
9
+ threshold: number | null;
10
+ storeIds: string[];
11
+ }
@@ -0,0 +1,10 @@
1
+ /** Resultado de redistribuir la cartera activa de un cobrador (flow 07.4). */
2
+ export interface RedistributeSummaryResponse {
3
+ reassignedCount: number;
4
+ errors: RedistributeError[];
5
+ }
6
+
7
+ export interface RedistributeError {
8
+ creditId: string;
9
+ reason: string;
10
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Estado de una asignación crédito↔cobrador (modelo-datos §7.2). Historial append-only:
3
+ * 1 crédito = 1 `ACTIVE`; reasignación → row vieja `REASSIGNED`; release/liquidado → `INACTIVE`.
4
+ * @enum {string}
5
+ */
6
+ export enum AssignmentStatusEnum {
7
+ ACTIVE = 'ACTIVE',
8
+ INACTIVE = 'INACTIVE',
9
+ REASSIGNED = 'REASSIGNED',
10
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Estrategia de asignación de cartera de cobranza (modelo-datos §7.1 / M6 §7.5).
3
+ * DEC-008 (loan-collector-assignment): se soportan las 4 + ranking híbrido (strategy + priorityWeights).
4
+ * A RATIFICAR con Jaime/senior: M6 §7.5 solo respalda 3 — `ROUND_ROBIN` es adición del spec 08.
5
+ * @enum {string}
6
+ */
7
+ export enum AssignmentStrategyEnum {
8
+ BY_STORE = 'BY_STORE',
9
+ BY_LOAD = 'BY_LOAD',
10
+ BY_SENIORITY = 'BY_SENIORITY',
11
+ ROUND_ROBIN = 'ROUND_ROBIN',
12
+ }
@@ -0,0 +1,19 @@
1
+ // Enums
2
+ export * from './enums/AssignmentStrategyEnum';
3
+ export * from './enums/AssignmentStatusEnum';
4
+
5
+ // Shared DTOs
6
+ export * from './dtos/PriorityWeights';
7
+
8
+ // Request DTOs
9
+ export * from './dtos/requests/CreateAssignmentRuleRequest';
10
+ export * from './dtos/requests/UpdateAssignmentRuleRequest';
11
+ export * from './dtos/requests/AutoAssignRequest';
12
+ export * from './dtos/requests/ReassignRequest';
13
+ export * from './dtos/requests/RedistributeRequest';
14
+
15
+ // Response DTOs
16
+ export * from './dtos/responses/AssignmentRuleResponse';
17
+ export * from './dtos/responses/CollectorAssignmentResponse';
18
+ export * from './dtos/responses/CollectorLoadResponse';
19
+ export * from './dtos/responses/RedistributeSummaryResponse';
@@ -0,0 +1,171 @@
1
+ import { Expose } from 'class-transformer';
2
+ import {
3
+ ArrayNotEmpty,
4
+ IsArray,
5
+ IsBoolean,
6
+ IsEnum,
7
+ IsInt,
8
+ IsNumber,
9
+ IsOptional,
10
+ IsString,
11
+ Matches,
12
+ Max,
13
+ Min,
14
+ } from 'class-validator';
15
+ import { regexIso8601 } from '../../helpers/constans/regex';
16
+ import { CreditPlanLevelEnum } from '../enums/CreditPlanLevelEnum';
17
+ import { CreditPlanStatusEnum } from '../enums/CreditPlanStatusEnum';
18
+ import { ProductTierEnum } from '../enums/ProductTierEnum';
19
+ import { SaleTypeEnum } from '../enums/SaleTypeEnum';
20
+
21
+ /**
22
+ * CreditPlan — plan de crédito del catálogo SOFOM SureKeep (modelo-datos §6.1 · M6 §4).
23
+ * Entidad completa del dominio `loan-offerings-business` (SureKeep Fase 1 — pista Loan).
24
+ *
25
+ * Convenciones: montos en **cents** (entero); porcentajes **decimal sobre 1** (`0.40` = 40%);
26
+ * TNA decimal (`2.60` = 260%). El PLAN es dueño de los umbrales SCI por nivel
27
+ * (`minSciScore`/`maxSciScore`, resolución 2026-07-15) y del techo de enganche `maxDownPaymentPct`.
28
+ */
29
+ export class CreditPlan {
30
+ @Expose()
31
+ @IsString()
32
+ planId!: string;
33
+
34
+ /** Código único por tenant: `BRONZE_NEW` | `SILVER_NEW` | `GOLD_NEW` | `EMPLOYEE`. */
35
+ @Expose()
36
+ @IsString()
37
+ code!: string;
38
+
39
+ @Expose()
40
+ @IsString()
41
+ name!: string;
42
+
43
+ @Expose()
44
+ @IsString()
45
+ description!: string;
46
+
47
+ @Expose()
48
+ @IsEnum(CreditPlanLevelEnum)
49
+ level!: CreditPlanLevelEnum;
50
+
51
+ /** Array: un plan puede aplicar a varios tipos de venta (M6 §4). */
52
+ @Expose()
53
+ @IsArray()
54
+ @ArrayNotEmpty()
55
+ @IsEnum(SaleTypeEnum, { each: true })
56
+ saleTypes!: SaleTypeEnum[];
57
+
58
+ /** Gamas elegibles del plan; `null` = todas. */
59
+ @Expose()
60
+ @IsOptional()
61
+ @IsArray()
62
+ @IsEnum(ProductTierEnum, { each: true })
63
+ eligibleTiers!: ProductTierEnum[] | null;
64
+
65
+ /** Enganche MÍNIMO como decimal sobre 1 (`0.40` = 40%). */
66
+ @Expose()
67
+ @IsNumber()
68
+ @Min(0)
69
+ @Max(1)
70
+ minDownPaymentPct!: number;
71
+
72
+ /** Techo de enganche (decimal sobre 1); `null` = sin techo definido (F1: TBD). */
73
+ @Expose()
74
+ @IsOptional()
75
+ @IsNumber()
76
+ @Min(0)
77
+ @Max(1)
78
+ maxDownPaymentPct!: number | null;
79
+
80
+ /** Plazos válidos en semanas (subconjunto del catálogo maestro). */
81
+ @Expose()
82
+ @IsArray()
83
+ @ArrayNotEmpty()
84
+ @IsInt({ each: true })
85
+ @Min(1, { each: true })
86
+ termWeeksOptions!: number[];
87
+
88
+ @Expose()
89
+ @IsInt()
90
+ @Min(0)
91
+ maxFinancedAmountCents!: number;
92
+
93
+ /** Tasa Nominal Anual como decimal (`2.60` = 260%); rango de negocio [2.00, 2.60]. */
94
+ @Expose()
95
+ @IsNumber()
96
+ @Min(0)
97
+ tnaAnnual!: number;
98
+
99
+ /** IVA sobre intereses (decimal); fijo `0.16` en México. */
100
+ @Expose()
101
+ @IsNumber()
102
+ @Min(0)
103
+ @Max(1)
104
+ ivaOnInterest!: number;
105
+
106
+ /** Comisión de apertura (decimal sobre 1); default `0`. */
107
+ @Expose()
108
+ @IsNumber()
109
+ @Min(0)
110
+ @Max(1)
111
+ openingCommissionPct!: number;
112
+
113
+ /** Corrimiento de cuotas al pagar fuera de fecha (M6 §4 "Corrimiento"). */
114
+ @Expose()
115
+ @IsBoolean()
116
+ paymentShift!: boolean;
117
+
118
+ /** Cota inferior del rango SCI del nivel (0-100); `null` mientras TBD. */
119
+ @Expose()
120
+ @IsOptional()
121
+ @IsInt()
122
+ @Min(0)
123
+ @Max(100)
124
+ minSciScore!: number | null;
125
+
126
+ /** Cota superior del rango SCI del nivel (0-100); `null` mientras TBD. */
127
+ @Expose()
128
+ @IsOptional()
129
+ @IsInt()
130
+ @Min(0)
131
+ @Max(100)
132
+ maxSciScore!: number | null;
133
+
134
+ /** Versión del plan; incrementa en cada publicación de cambios. */
135
+ @Expose()
136
+ @IsInt()
137
+ @Min(1)
138
+ version!: number;
139
+
140
+ @Expose()
141
+ @IsOptional()
142
+ @IsString()
143
+ validFrom!: string | null;
144
+
145
+ @Expose()
146
+ @IsOptional()
147
+ @IsString()
148
+ validUntil!: string | null;
149
+
150
+ @Expose()
151
+ @IsEnum(CreditPlanStatusEnum)
152
+ status!: CreditPlanStatusEnum;
153
+
154
+ @Expose()
155
+ @IsString()
156
+ createdBy!: string;
157
+
158
+ @Expose()
159
+ @IsString()
160
+ updatedBy!: string;
161
+
162
+ @Expose()
163
+ @IsString()
164
+ @Matches(regexIso8601, { message: 'createdAt debe ser una fecha ISO 8601' })
165
+ createdAt!: string;
166
+
167
+ @Expose()
168
+ @IsString()
169
+ @Matches(regexIso8601, { message: 'updatedAt debe ser una fecha ISO 8601' })
170
+ updatedAt!: string;
171
+ }
@@ -0,0 +1,91 @@
1
+ import { Expose } from 'class-transformer';
2
+ import {
3
+ IsArray,
4
+ IsEnum,
5
+ IsInt,
6
+ IsObject,
7
+ IsOptional,
8
+ IsString,
9
+ Matches,
10
+ Min,
11
+ } from 'class-validator';
12
+ import { regexIso8601 } from '../../helpers/constans/regex';
13
+ import { FinancierStatusEnum } from '../enums/FinancierStatusEnum';
14
+ import { FinancierTypeEnum } from '../enums/FinancierTypeEnum';
15
+ import { ProductTierEnum } from '../enums/ProductTierEnum';
16
+
17
+ /**
18
+ * Financier — financiera del catálogo mostrado al cliente (modelo-datos §6.3 · M6 §6).
19
+ * Entidad completa del dominio `loan-offerings-business` (SureKeep Fase 1 — pista Loan).
20
+ * SureKeep (INTERNAL) va primero (`displayOrder=1`); las externas después.
21
+ */
22
+ export class Financier {
23
+ @Expose()
24
+ @IsString()
25
+ financierId!: string;
26
+
27
+ /** Grafía canónica: `SUREKEEP` | `PAYJOY` | `KREDIYA` | `LESPAGO`. */
28
+ @Expose()
29
+ @IsString()
30
+ code!: string;
31
+
32
+ @Expose()
33
+ @IsString()
34
+ name!: string;
35
+
36
+ @Expose()
37
+ @IsEnum(FinancierTypeEnum)
38
+ type!: FinancierTypeEnum;
39
+
40
+ /** Orden de presentación en el wizard (M1 paso 4). Reorder renumera. */
41
+ @Expose()
42
+ @IsInt()
43
+ @Min(1)
44
+ displayOrder!: number;
45
+
46
+ /** Texto mostrado en el wizard (ej. "RECOMENDADO"). */
47
+ @Expose()
48
+ @IsString()
49
+ label!: string;
50
+
51
+ /** Solo EXTERNAL: URL de derivación; `null` para INTERNAL. */
52
+ @Expose()
53
+ @IsOptional()
54
+ @IsString()
55
+ externalRedirectUrl!: string | null;
56
+
57
+ /** Gamas que la financiera acepta por defecto; `null` = todas. */
58
+ @Expose()
59
+ @IsOptional()
60
+ @IsArray()
61
+ @IsEnum(ProductTierEnum, { each: true })
62
+ eligibleTiers!: ProductTierEnum[] | null;
63
+
64
+ /** Configuración específica por financiera; `null` si no aplica. */
65
+ @Expose()
66
+ @IsOptional()
67
+ @IsObject()
68
+ config!: Record<string, unknown> | null;
69
+
70
+ @Expose()
71
+ @IsEnum(FinancierStatusEnum)
72
+ status!: FinancierStatusEnum;
73
+
74
+ @Expose()
75
+ @IsString()
76
+ createdBy!: string;
77
+
78
+ @Expose()
79
+ @IsString()
80
+ updatedBy!: string;
81
+
82
+ @Expose()
83
+ @IsString()
84
+ @Matches(regexIso8601, { message: 'createdAt debe ser una fecha ISO 8601' })
85
+ createdAt!: string;
86
+
87
+ @Expose()
88
+ @IsString()
89
+ @Matches(regexIso8601, { message: 'updatedAt debe ser una fecha ISO 8601' })
90
+ updatedAt!: string;
91
+ }