@carbonbox/domain 0.7.21 → 0.7.23

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 (82) hide show
  1. package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationSegment.js +0 -2
  2. package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentIncludedSubsegments.js +0 -2
  3. package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/domain/value-objects/EventEditionLifecycleStageConfigurationStage.js +0 -2
  4. package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/event-edition-lifecycle-stages/domain/value-objects/EventEditionLifecycleStageIncludedSubsegments.js +0 -2
  5. package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/domain/value-objects/ProductCarbonFootprintSegmentConfigurationSegment.js +0 -2
  6. package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/domain/value-objects/ProductConfigurationCarbonFootprintSegmentIncludedSubsegments.js +0 -2
  7. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.js +16 -103
  8. package/build/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.js +15 -29
  9. package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.js +6 -131
  10. package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.js +6 -131
  11. package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.js +7 -149
  12. package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.js +9 -165
  13. package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.js +42 -50
  14. package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.js +8 -112
  15. package/build/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.js +11 -136
  16. package/build/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.js +11 -168
  17. package/build/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.js +11 -136
  18. package/build/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.js +35 -56
  19. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.js +6 -172
  20. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.js +6 -172
  21. package/build/main/index.js +25 -13
  22. package/build/types/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationSegment.d.ts.map +1 -1
  23. package/build/types/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentIncludedSubsegments.d.ts.map +1 -1
  24. package/build/types/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/domain/value-objects/EventEditionLifecycleStageConfigurationStage.d.ts.map +1 -1
  25. package/build/types/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/event-edition-lifecycle-stages/domain/value-objects/EventEditionLifecycleStageIncludedSubsegments.d.ts.map +1 -1
  26. package/build/types/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/domain/value-objects/ProductCarbonFootprintSegmentConfigurationSegment.d.ts.map +1 -1
  27. package/build/types/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/domain/value-objects/ProductConfigurationCarbonFootprintSegmentIncludedSubsegments.d.ts.map +1 -1
  28. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReference.d.ts +0 -2
  29. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  30. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts +0 -2
  31. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts.map +1 -1
  32. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +0 -2
  33. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  34. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts +0 -2
  35. package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts.map +1 -1
  36. package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +0 -2
  37. package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  38. package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts +0 -2
  39. package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts.map +1 -1
  40. package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReference.d.ts +0 -2
  41. package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReference.d.ts.map +1 -1
  42. package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReferencePrimitives.d.ts +0 -2
  43. package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReferencePrimitives.d.ts.map +1 -1
  44. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReference.d.ts +0 -2
  45. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  46. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts +0 -2
  47. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts.map +1 -1
  48. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts +0 -2
  49. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  50. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts +0 -2
  51. package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts.map +1 -1
  52. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts +7 -43
  53. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts.map +1 -1
  54. package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts +6 -8
  55. package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
  56. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts +1 -62
  57. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  58. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +1 -71
  59. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  60. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -78
  61. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  62. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts +5 -68
  63. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts.map +1 -1
  64. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts +20 -19
  65. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts.map +1 -1
  66. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts +2 -45
  67. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts.map +1 -1
  68. package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -62
  69. package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  70. package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -77
  71. package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  72. package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -62
  73. package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  74. package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts +15 -17
  75. package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
  76. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts +1 -81
  77. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  78. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts +1 -90
  79. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  80. package/build/types/main/index.d.ts +6 -0
  81. package/build/types/main/index.d.ts.map +1 -1
  82. package/package.json +1 -1
@@ -19,7 +19,6 @@ const EmissionSource_1 = require("../enums/EmissionSource");
19
19
  const ValueObject_1 = require("./ValueObject");
20
20
  const String_1 = require("./String");
21
21
  const AggregateId_1 = require("./AggregateId");
22
- const Code_1 = require("./Code");
23
22
  class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1.ValueObject {
24
23
  /**
25
24
  * Constructor protegido para que solo clases hijas puedan instanciar.
@@ -137,17 +136,8 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
137
136
  if (typeof reference.id !== 'string') {
138
137
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof reference.id);
139
138
  }
140
- if (typeof reference.code !== 'string') {
141
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof reference.code);
142
- }
143
- if (typeof reference.name !== 'string') {
144
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
145
- }
146
139
  String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
147
140
  AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
148
- String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
149
- Code_1.Code.guardAgainstInvalidCode(reference.code);
150
- String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
151
141
  }
152
142
  /**
153
143
  * Valida el array de fuentes de emisión.
@@ -225,23 +215,17 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
225
215
  return true;
226
216
  }
227
217
  /**
228
- * Obtiene una configuración por combinación de códigos de segmento y subsegmento.
218
+ * Obtiene una configuración por su ID.
229
219
  */
230
- getConfigurationBySegmentAndSubsegment(segmentCode, subsegmentCode) {
231
- const configuration = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").find((config) => {
232
- const matchesSegment = config.segment.code === segmentCode.trim();
233
- if (subsegmentCode === undefined) {
234
- return matchesSegment && config.subsegment === null;
235
- }
236
- return matchesSegment && config.subsegment?.code === subsegmentCode.trim();
237
- });
220
+ getConfigurationById(configurationId) {
221
+ const configuration = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").find((config) => config.id === configurationId.trim());
238
222
  return configuration || null;
239
223
  }
240
224
  /**
241
- * Verifica si existe una configuración con la combinación especificada.
225
+ * Verifica si existe una configuración con el ID especificado.
242
226
  */
243
- hasSegmentSubsegmentCombination(segmentCode, subsegmentCode) {
244
- return this.getConfigurationBySegmentAndSubsegment(segmentCode, subsegmentCode) !== null;
227
+ hasConfigurationId(configurationId) {
228
+ return this.getConfigurationById(configurationId) !== null;
245
229
  }
246
230
  /**
247
231
  * Obtiene una configuración por su índice.
@@ -253,16 +237,16 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
253
237
  return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f")[index];
254
238
  }
255
239
  /**
256
- * Obtiene todas las configuraciones por código de segmento.
240
+ * Obtiene todas las configuraciones por ID de segmento.
257
241
  */
258
- getConfigurationsBySegmentCode(segmentCode) {
259
- return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.segment.code === segmentCode.trim());
242
+ getConfigurationsBySegmentId(segmentId) {
243
+ return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.segment.id === segmentId.trim());
260
244
  }
261
245
  /**
262
- * Obtiene todas las configuraciones por código de subsegmento.
246
+ * Obtiene todas las configuraciones por ID de subsegmento.
263
247
  */
264
- getConfigurationsBySubsegmentCode(subsegmentCode) {
265
- return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.subsegment?.code === subsegmentCode.trim());
248
+ getConfigurationsBySubsegmentId(subsegmentId) {
249
+ return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.subsegment?.id === subsegmentId.trim());
266
250
  }
267
251
  /**
268
252
  * Obtiene todas las configuraciones que no tienen subsegmento (null).
@@ -287,27 +271,25 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
287
271
  */
288
272
  getAllSegmentSubsegmentCombinations() {
289
273
  return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").map((config) => ({
290
- segmentCode: config.segment.code,
291
- segmentName: config.segment.name,
292
- subsegmentCode: config.subsegment?.code || null,
293
- subsegmentName: config.subsegment?.name || null,
274
+ segmentId: config.segment.id,
275
+ subsegmentId: config.subsegment?.id || null,
294
276
  }));
295
277
  }
296
278
  /**
297
- * Obtiene todos los códigos únicos de segmentos.
279
+ * Obtiene todos los IDs únicos de segmentos.
298
280
  */
299
- getUniqueSegmentCodes() {
300
- const codes = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").map((config) => config.segment.code);
301
- return [...new Set(codes)];
281
+ getUniqueSegmentIds() {
282
+ const ids = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").map((config) => config.segment.id);
283
+ return [...new Set(ids)];
302
284
  }
303
285
  /**
304
- * Obtiene todos los códigos únicos de subsegmentos (excluyendo null).
286
+ * Obtiene todos los IDs únicos de subsegmentos (excluyendo null).
305
287
  */
306
- getUniqueSubsegmentCodes() {
307
- const codes = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f")
308
- .map((config) => config.subsegment?.code)
309
- .filter((code) => code !== undefined && code !== null);
310
- return [...new Set(codes)];
288
+ getUniqueSubsegmentIds() {
289
+ const ids = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f")
290
+ .map((config) => config.subsegment?.id)
291
+ .filter((id) => id !== undefined && id !== null);
292
+ return [...new Set(ids)];
311
293
  }
312
294
  /**
313
295
  * Obtiene todas las fuentes de emisión únicas.
@@ -317,12 +299,13 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
317
299
  return [...new Set(sources)];
318
300
  }
319
301
  /**
320
- * Busca configuraciones que coincidan con un patrón de búsqueda.
302
+ * Busca configuraciones que coincidan con un patrón de búsqueda por ID.
321
303
  */
322
304
  findConfigurationsMatching(searchText) {
323
305
  const lowerSearchText = searchText.toLowerCase().trim();
324
- return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.segment.name.toLowerCase().includes(lowerSearchText)
325
- || (config.subsegment?.name?.toLowerCase().includes(lowerSearchText) || false)
306
+ return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.id.toLowerCase().includes(lowerSearchText)
307
+ || config.segment.id.toLowerCase().includes(lowerSearchText)
308
+ || (config.subsegment?.id?.toLowerCase().includes(lowerSearchText) || false)
326
309
  || config.emissionSources.some((source) => source.toLowerCase().includes(lowerSearchText)));
327
310
  }
328
311
  /**
@@ -331,7 +314,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
331
314
  groupConfigurationsBySegment() {
332
315
  const groupMap = new Map();
333
316
  __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").forEach((config) => {
334
- const segmentKey = `${config.segment.code}_${config.segment.name}`;
317
+ const segmentKey = config.segment.id;
335
318
  const existing = groupMap.get(segmentKey) || [];
336
319
  existing.push(config);
337
320
  groupMap.set(segmentKey, existing);
@@ -384,8 +367,8 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
384
367
  */
385
368
  getStatistics() {
386
369
  const totalConfigurations = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").length;
387
- const uniqueSegments = this.getUniqueSegmentCodes().length;
388
- const uniqueSubsegments = this.getUniqueSubsegmentCodes().length;
370
+ const uniqueSegments = this.getUniqueSegmentIds().length;
371
+ const uniqueSubsegments = this.getUniqueSubsegmentIds().length;
389
372
  const configurationsWithSubsegment = this.getConfigurationsWithSubsegment().length;
390
373
  const configurationsWithoutSubsegment = this.getConfigurationsWithoutSubsegment().length;
391
374
  const uniqueEmissionSources = this.getUniqueEmissionSources().length;
@@ -432,7 +415,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
432
415
  * Compara referencias de segmento.
433
416
  */
434
417
  segmentReferencesAreEqual(segment1, segment2) {
435
- return segment1.code === segment2.code && segment1.name === segment2.name;
418
+ return segment1.id === segment2.id;
436
419
  }
437
420
  /**
438
421
  * Compara referencias de subsegmento (pueden ser null).
@@ -444,7 +427,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
444
427
  if (subseg1 === null || subseg2 === null) {
445
428
  return false;
446
429
  }
447
- return subseg1.code === subseg2.code && subseg1.name === subseg2.name;
430
+ return subseg1.id === subseg2.id;
448
431
  }
449
432
  /**
450
433
  * Compara arrays de fuentes de emisión.
@@ -463,9 +446,9 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
463
446
  hashCode() {
464
447
  const configHashes = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f")
465
448
  .map((config) => {
466
- const subsegmentCode = config.subsegment?.code || 'null';
449
+ const subsegmentId = config.subsegment?.id || 'null';
467
450
  const sourcesHash = config.emissionSources.sort().join(',');
468
- return `${config.segment.code}_${subsegmentCode}_${sourcesHash}`;
451
+ return `${config.id}_${config.segment.id}_${subsegmentId}_${sourcesHash}`;
469
452
  })
470
453
  .join('|');
471
454
  const optionsHash = __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_options, "f").allowEmpty ? 'allowEmpty' : 'requireElements';
@@ -479,13 +462,9 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
479
462
  id: config.id,
480
463
  segment: {
481
464
  id: config.segment.id,
482
- code: config.segment.code,
483
- name: config.segment.name,
484
465
  },
485
466
  subsegment: config.subsegment ? {
486
467
  id: config.subsegment.id,
487
- code: config.subsegment.code,
488
- name: config.subsegment.name,
489
468
  } : null,
490
469
  emissionSources: config.emissionSources,
491
470
  }));
@@ -10,13 +10,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _ProductConfigurationCarbonFootprintSegmentReference_id, _ProductConfigurationCarbonFootprintSegmentReference_code, _ProductConfigurationCarbonFootprintSegmentReference_name;
13
+ var _ProductConfigurationCarbonFootprintSegmentReference_id;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ProductConfigurationCarbonFootprintSegmentReference = void 0;
16
16
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
17
17
  const ObjectValueObject_1 = require("./ObjectValueObject");
18
18
  const String_1 = require("./String");
19
- const Code_1 = require("./Code");
20
19
  const AggregateId_1 = require("./AggregateId");
21
20
  class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObject_1.ObjectValueObject {
22
21
  /**
@@ -26,15 +25,11 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
26
25
  constructor(value, skipDomainValidation, propertyName = ProductConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME) {
27
26
  super(value, skipDomainValidation, propertyName, 'The provided value must be of type ProductConfigurationCarbonFootprintSegmentReference from the domain layer', { allowNull: false, allowUndefined: false });
28
27
  _ProductConfigurationCarbonFootprintSegmentReference_id.set(this, void 0);
29
- _ProductConfigurationCarbonFootprintSegmentReference_code.set(this, void 0);
30
- _ProductConfigurationCarbonFootprintSegmentReference_name.set(this, void 0);
31
28
  if (skipDomainValidation === false) {
32
29
  ProductConfigurationCarbonFootprintSegmentReference
33
30
  .validateProductConfigurationCarbonFootprintSegmentReference(value, propertyName);
34
31
  }
35
32
  __classPrivateFieldSet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, value.id.trim(), "f");
36
- __classPrivateFieldSet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, value.code.trim().toUpperCase(), "f");
37
- __classPrivateFieldSet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, value.name.trim(), "f");
38
33
  }
39
34
  /**
40
35
  * Validación estática para reutilización en factory methods y constructores.
@@ -42,8 +37,6 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
42
37
  static validateProductConfigurationCarbonFootprintSegmentReference(value, propertyName) {
43
38
  this.guardAgainstInvalidType(value, propertyName);
44
39
  this.guardAgainstInvalidId(value.id);
45
- this.guardAgainstInvalidSegmentCode(value.code);
46
- this.guardAgainstInvalidSegmentName(value.name);
47
40
  }
48
41
  /**
49
42
  * Valida que el objeto tenga la estructura correcta.
@@ -55,12 +48,6 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
55
48
  if (typeof value.id !== 'string') {
56
49
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
57
50
  }
58
- if (typeof value.code !== 'string') {
59
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
60
- }
61
- if (typeof value.name !== 'string') {
62
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
63
- }
64
51
  }
65
52
  /**
66
53
  * Valida si el valor principal es inválido.
@@ -72,139 +59,12 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
72
59
  String_1.String.guardAgainstEmptyValue(id, 'id');
73
60
  AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
74
61
  }
75
- /**
76
- * Valida el código del segmento de producto.
77
- */
78
- static guardAgainstInvalidSegmentCode(code) {
79
- String_1.String.guardAgainstEmptyValue(code, 'code');
80
- Code_1.Code.guardAgainstInvalidCode(code);
81
- if (this.codeIsEmpty(code)) {
82
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'non-empty string', 'empty string');
83
- }
84
- const trimmedCode = code.trim().toUpperCase();
85
- if (this.codeLengthIsInvalid(trimmedCode)) {
86
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', `string with length between ${this.MIN_CODE_LENGTH} and ${this.MAX_CODE_LENGTH} characters`, `string with ${trimmedCode.length} characters`);
87
- }
88
- this.codeFormatIsInvalid(trimmedCode, 'code');
89
- }
90
- /**
91
- * Verifica si el código de segmento está vacío.
92
- */
93
- static codeIsEmpty(code) {
94
- return code.trim().length === 0;
95
- }
96
- /**
97
- * Verifica si la longitud del código de segmento es inválida.
98
- */
99
- static codeLengthIsInvalid(trimmedCode) {
100
- return trimmedCode.length < this.MIN_CODE_LENGTH || trimmedCode.length > this.MAX_CODE_LENGTH;
101
- }
102
- /**
103
- * Verifica si el formato del código de segmento es inválido.
104
- */
105
- static codeFormatIsInvalid(trimmedCode, propertyName) {
106
- Code_1.Code.guardAgainstInvalidCode(trimmedCode, propertyName);
107
- }
108
- /**
109
- * Valida el nombre del segmento de producto.
110
- */
111
- static guardAgainstInvalidSegmentName(name) {
112
- String_1.String.guardAgainstEmptyValue(name, 'name');
113
- if (this.nameIsEmpty(name)) {
114
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'non-empty string', 'empty string');
115
- }
116
- if (this.nameLengthIsInvalid(name)) {
117
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', `string with maximum ${this.MAX_NAME_LENGTH} characters`, `string with ${name.trim().length} characters`);
118
- }
119
- }
120
- /**
121
- * Verifica si el nombre de segmento está vacío.
122
- */
123
- static nameIsEmpty(name) {
124
- return name.trim().length === 0;
125
- }
126
- /**
127
- * Verifica si la longitud del nombre de segmento es inválida.
128
- */
129
- static nameLengthIsInvalid(name) {
130
- return name.trim().length > this.MAX_NAME_LENGTH;
131
- }
132
62
  get id() {
133
63
  return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f");
134
64
  }
135
- /**
136
- * Código del segmento de producto.
137
- */
138
- get code() {
139
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f");
140
- }
141
- /**
142
- * Nombre del segmento de producto.
143
- */
144
- get name() {
145
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f");
146
- }
147
65
  hasId(id) {
148
66
  return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f") === id.trim();
149
67
  }
150
- hasName(name) {
151
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f") === name.trim();
152
- }
153
- /**
154
- * Verifica si el segmento tiene un código específico.
155
- */
156
- hasCode(code) {
157
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f") === code.trim().toUpperCase();
158
- }
159
- /**
160
- * Verifica si el nombre del segmento contiene una palabra específica.
161
- */
162
- nameContains(keyword) {
163
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f").toLowerCase().includes(keyword.toLowerCase());
164
- }
165
- /**
166
- * Verifica si es un segmento de tecnología.
167
- */
168
- isTechnologySegment() {
169
- const techKeywords = ['tech', 'technology', 'digital', 'software', 'it', 'innovation'];
170
- return techKeywords.some((keyword) => this.nameContains(keyword));
171
- }
172
- /**
173
- * Verifica si es un segmento financiero.
174
- */
175
- isFinancialSegment() {
176
- const financialKeywords = ['financial', 'bank', 'finance', 'insurance', 'investment'];
177
- return financialKeywords.some((keyword) => this.nameContains(keyword));
178
- }
179
- /**
180
- * Verifica si es un segmento de manufactura.
181
- */
182
- isManufacturingSegment() {
183
- const manufacturingKeywords = ['manufacturing', 'production', 'factory', 'industrial'];
184
- return manufacturingKeywords.some((keyword) => this.nameContains(keyword));
185
- }
186
- /**
187
- * Verifica si es un segmento de servicios.
188
- */
189
- isServicesSegment() {
190
- const servicesKeywords = ['services', 'consulting', 'professional', 'advisory'];
191
- return servicesKeywords.some((keyword) => this.nameContains(keyword));
192
- }
193
- /**
194
- * Obtiene una representación formateada para mostrar al usuario.
195
- */
196
- getFormattedDisplay() {
197
- return `${__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f")} - ${__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f")}`;
198
- }
199
- /**
200
- * Obtiene una versión abreviada del nombre si es muy largo.
201
- */
202
- getAbbreviatedName(maxLength = 50) {
203
- if (__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f").length <= maxLength) {
204
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f");
205
- }
206
- return `${__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f").substring(0, maxLength - 3)}...`;
207
- }
208
68
  /**
209
69
  * Compara la igualdad semántica con otro objeto ProductConfigurationCarbonFootprintSegmentReference.
210
70
  */
@@ -212,9 +72,7 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
212
72
  if (this.otherIsNotProductConfigurationCarbonFootprintSegmentReference(other)) {
213
73
  return false;
214
74
  }
215
- return (__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_id, "f")
216
- && __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_code, "f")
217
- && __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_name, "f"));
75
+ return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_id, "f");
218
76
  }
219
77
  /**
220
78
  * Verifica si el otro objeto no es una instancia de ProductConfigurationCarbonFootprintSegmentReference.
@@ -222,29 +80,11 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
222
80
  otherIsNotProductConfigurationCarbonFootprintSegmentReference(other) {
223
81
  return (other instanceof ProductConfigurationCarbonFootprintSegmentReference) === false;
224
82
  }
225
- /**
226
- * Compara si dos segmentos tienen el mismo código.
227
- */
228
- hasSameCode(other) {
229
- if (this.otherIsNotProductConfigurationCarbonFootprintSegmentReference(other)) {
230
- return false;
231
- }
232
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_code, "f");
233
- }
234
- /**
235
- * Compara si dos segmentos tienen el mismo nombre.
236
- */
237
- hasSameName(other) {
238
- if (this.otherIsNotProductConfigurationCarbonFootprintSegmentReference(other)) {
239
- return false;
240
- }
241
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_name, "f");
242
- }
243
83
  /**
244
84
  * Genera un hash code para usar en colecciones.
245
85
  */
246
86
  hashCode() {
247
- return `${__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f")}_${__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f")}`;
87
+ return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f");
248
88
  }
249
89
  /**
250
90
  * Convierte a representación primitiva para persistencia.
@@ -252,15 +92,13 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
252
92
  toPrimitives() {
253
93
  return {
254
94
  id: __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f"),
255
- code: __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f"),
256
- name: __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f"),
257
95
  };
258
96
  }
259
97
  /**
260
- * Representación como string (código del segmento).
98
+ * Representación como string (id del segmento).
261
99
  */
262
100
  toString() {
263
- return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f");
101
+ return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f");
264
102
  }
265
103
  /**
266
104
  * Representación JSON para serialización.
@@ -276,9 +114,5 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
276
114
  }
277
115
  }
278
116
  exports.ProductConfigurationCarbonFootprintSegmentReference = ProductConfigurationCarbonFootprintSegmentReference;
279
- _ProductConfigurationCarbonFootprintSegmentReference_id = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_code = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_name = new WeakMap();
117
+ _ProductConfigurationCarbonFootprintSegmentReference_id = new WeakMap();
280
118
  ProductConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME = 'productSegmentReference';
281
- // Longitud mínima y máxima para el código de segmento
282
- ProductConfigurationCarbonFootprintSegmentReference.MIN_CODE_LENGTH = 2;
283
- ProductConfigurationCarbonFootprintSegmentReference.MAX_CODE_LENGTH = 10;
284
- ProductConfigurationCarbonFootprintSegmentReference.MAX_NAME_LENGTH = 255;