@driveup/schema 0.1.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 (246) hide show
  1. package/README.md +174 -0
  2. package/lib/catalog/addon/addon.entity.d.ts +109 -0
  3. package/lib/catalog/addon/addon.entity.js +260 -0
  4. package/lib/catalog/addon/addon.entity.js.map +1 -0
  5. package/lib/catalog/addon/country.entity.d.ts +112 -0
  6. package/lib/catalog/addon/country.entity.js +246 -0
  7. package/lib/catalog/addon/country.entity.js.map +1 -0
  8. package/lib/catalog/driving/category.entity.d.ts +122 -0
  9. package/lib/catalog/driving/category.entity.js +217 -0
  10. package/lib/catalog/driving/category.entity.js.map +1 -0
  11. package/lib/catalog/driving/vehicle.entity.d.ts +49 -0
  12. package/lib/catalog/driving/vehicle.entity.js +97 -0
  13. package/lib/catalog/driving/vehicle.entity.js.map +1 -0
  14. package/lib/catalog/priceplan/priceplan.entity.d.ts +123 -0
  15. package/lib/catalog/priceplan/priceplan.entity.js +288 -0
  16. package/lib/catalog/priceplan/priceplan.entity.js.map +1 -0
  17. package/lib/catalog/product/country.entity.d.ts +109 -0
  18. package/lib/catalog/product/country.entity.js +233 -0
  19. package/lib/catalog/product/country.entity.js.map +1 -0
  20. package/lib/catalog/product/priceplan.entity.d.ts +113 -0
  21. package/lib/catalog/product/priceplan.entity.js +251 -0
  22. package/lib/catalog/product/priceplan.entity.js.map +1 -0
  23. package/lib/catalog/product/product.entity.d.ts +104 -0
  24. package/lib/catalog/product/product.entity.js +262 -0
  25. package/lib/catalog/product/product.entity.js.map +1 -0
  26. package/lib/catalog/program/program.entity.d.ts +107 -0
  27. package/lib/catalog/program/program.entity.js +247 -0
  28. package/lib/catalog/program/program.entity.js.map +1 -0
  29. package/lib/catalog/seed/assets/asset.entity.d.ts +68 -0
  30. package/lib/catalog/seed/assets/asset.entity.js +163 -0
  31. package/lib/catalog/seed/assets/asset.entity.js.map +1 -0
  32. package/lib/catalog/seed/courses/course.entity.d.ts +98 -0
  33. package/lib/catalog/seed/courses/course.entity.js +216 -0
  34. package/lib/catalog/seed/courses/course.entity.js.map +1 -0
  35. package/lib/catalog/seed/courses/lesson.entity.d.ts +90 -0
  36. package/lib/catalog/seed/courses/lesson.entity.js +214 -0
  37. package/lib/catalog/seed/courses/lesson.entity.js.map +1 -0
  38. package/lib/catalog/seed/courses/topic.entity.d.ts +77 -0
  39. package/lib/catalog/seed/courses/topic.entity.js +185 -0
  40. package/lib/catalog/seed/courses/topic.entity.js.map +1 -0
  41. package/lib/catalog/seed/expense/category.entity.d.ts +61 -0
  42. package/lib/catalog/seed/expense/category.entity.js +153 -0
  43. package/lib/catalog/seed/expense/category.entity.js.map +1 -0
  44. package/lib/index.d.ts +67 -0
  45. package/lib/index.js +89 -0
  46. package/lib/index.js.map +1 -0
  47. package/lib/profile/agent/agent.entity.d.ts +95 -0
  48. package/lib/profile/agent/agent.entity.js +223 -0
  49. package/lib/profile/agent/agent.entity.js.map +1 -0
  50. package/lib/profile/agent/payout.entity.d.ts +70 -0
  51. package/lib/profile/agent/payout.entity.js +160 -0
  52. package/lib/profile/agent/payout.entity.js.map +1 -0
  53. package/lib/profile/agent/promotion.entity.d.ts +82 -0
  54. package/lib/profile/agent/promotion.entity.js +174 -0
  55. package/lib/profile/agent/promotion.entity.js.map +1 -0
  56. package/lib/profile/company/company.entity.d.ts +234 -0
  57. package/lib/profile/company/company.entity.js +558 -0
  58. package/lib/profile/company/company.entity.js.map +1 -0
  59. package/lib/profile/company/course/appointment.entity.d.ts +111 -0
  60. package/lib/profile/company/course/appointment.entity.js +240 -0
  61. package/lib/profile/company/course/appointment.entity.js.map +1 -0
  62. package/lib/profile/company/course/course.entity.d.ts +156 -0
  63. package/lib/profile/company/course/course.entity.js +365 -0
  64. package/lib/profile/company/course/course.entity.js.map +1 -0
  65. package/lib/profile/company/course/lesson.entity.d.ts +123 -0
  66. package/lib/profile/company/course/lesson.entity.js +288 -0
  67. package/lib/profile/company/course/lesson.entity.js.map +1 -0
  68. package/lib/profile/company/course/topic.entity.d.ts +55 -0
  69. package/lib/profile/company/course/topic.entity.js +147 -0
  70. package/lib/profile/company/course/topic.entity.js.map +1 -0
  71. package/lib/profile/company/finances/billing/bill.entity.d.ts +145 -0
  72. package/lib/profile/company/finances/billing/bill.entity.js +338 -0
  73. package/lib/profile/company/finances/billing/bill.entity.js.map +1 -0
  74. package/lib/profile/company/finances/billing/item.entity.d.ts +75 -0
  75. package/lib/profile/company/finances/billing/item.entity.js +219 -0
  76. package/lib/profile/company/finances/billing/item.entity.js.map +1 -0
  77. package/lib/profile/company/finances/billing/transaction.entity.d.ts +44 -0
  78. package/lib/profile/company/finances/billing/transaction.entity.js +158 -0
  79. package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -0
  80. package/lib/profile/company/finances/expense/category.entity.d.ts +55 -0
  81. package/lib/profile/company/finances/expense/category.entity.js +117 -0
  82. package/lib/profile/company/finances/expense/category.entity.js.map +1 -0
  83. package/lib/profile/company/finances/expense/expense.entity.d.ts +48 -0
  84. package/lib/profile/company/finances/expense/expense.entity.js +171 -0
  85. package/lib/profile/company/finances/expense/expense.entity.js.map +1 -0
  86. package/lib/profile/company/finances/handover/handover.entity.d.ts +44 -0
  87. package/lib/profile/company/finances/handover/handover.entity.js +202 -0
  88. package/lib/profile/company/finances/handover/handover.entity.js.map +1 -0
  89. package/lib/profile/company/finances/invoice/invoice.entity.d.ts +65 -0
  90. package/lib/profile/company/finances/invoice/invoice.entity.js +296 -0
  91. package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -0
  92. package/lib/profile/company/finances/invoice/item.entity.d.ts +25 -0
  93. package/lib/profile/company/finances/invoice/item.entity.js +148 -0
  94. package/lib/profile/company/finances/invoice/item.entity.js.map +1 -0
  95. package/lib/profile/company/finances/payment/method.entity.d.ts +35 -0
  96. package/lib/profile/company/finances/payment/method.entity.js +143 -0
  97. package/lib/profile/company/finances/payment/method.entity.js.map +1 -0
  98. package/lib/profile/company/finances/peyment/method.entity.d.ts +35 -0
  99. package/lib/profile/company/finances/peyment/method.entity.js +143 -0
  100. package/lib/profile/company/finances/peyment/method.entity.js.map +1 -0
  101. package/lib/profile/company/finances/peyment-method/payment-method.d.ts +34 -0
  102. package/lib/profile/company/finances/peyment-method/payment-method.js +118 -0
  103. package/lib/profile/company/finances/peyment-method/payment-method.js.map +1 -0
  104. package/lib/profile/company/instructor/instructor.entity.d.ts +85 -0
  105. package/lib/profile/company/instructor/instructor.entity.js +254 -0
  106. package/lib/profile/company/instructor/instructor.entity.js.map +1 -0
  107. package/lib/profile/company/instructor/task.entity.d.ts +60 -0
  108. package/lib/profile/company/instructor/task.entity.js +133 -0
  109. package/lib/profile/company/instructor/task.entity.js.map +1 -0
  110. package/lib/profile/company/medical/examination.entity.d.ts +59 -0
  111. package/lib/profile/company/medical/examination.entity.js +175 -0
  112. package/lib/profile/company/medical/examination.entity.js.map +1 -0
  113. package/lib/profile/company/medical/product.entity.d.ts +99 -0
  114. package/lib/profile/company/medical/product.entity.js +270 -0
  115. package/lib/profile/company/medical/product.entity.js.map +1 -0
  116. package/lib/profile/company/metrics/company.metric.d.ts +21 -0
  117. package/lib/profile/company/metrics/company.metric.js +122 -0
  118. package/lib/profile/company/metrics/company.metric.js.map +1 -0
  119. package/lib/profile/company/product/addon.entity.d.ts +93 -0
  120. package/lib/profile/company/product/addon.entity.js +234 -0
  121. package/lib/profile/company/product/addon.entity.js.map +1 -0
  122. package/lib/profile/company/product/priceplan.entity.d.ts +57 -0
  123. package/lib/profile/company/product/priceplan.entity.js +167 -0
  124. package/lib/profile/company/product/priceplan.entity.js.map +1 -0
  125. package/lib/profile/company/product/product.entity.d.ts +171 -0
  126. package/lib/profile/company/product/product.entity.js +383 -0
  127. package/lib/profile/company/product/product.entity.js.map +1 -0
  128. package/lib/profile/company/product/vehicle.entity.d.ts +46 -0
  129. package/lib/profile/company/product/vehicle.entity.js +144 -0
  130. package/lib/profile/company/product/vehicle.entity.js.map +1 -0
  131. package/lib/profile/instructor/instructor.entity.d.ts +80 -0
  132. package/lib/profile/instructor/instructor.entity.js +186 -0
  133. package/lib/profile/instructor/instructor.entity.js.map +1 -0
  134. package/lib/profile/student/program/licence/licence.entity.d.ts +66 -0
  135. package/lib/profile/student/program/licence/licence.entity.js +187 -0
  136. package/lib/profile/student/program/licence/licence.entity.js.map +1 -0
  137. package/lib/profile/student/program/medical/certificate.entity.d.ts +84 -0
  138. package/lib/profile/student/program/medical/certificate.entity.js +244 -0
  139. package/lib/profile/student/program/medical/certificate.entity.js.map +1 -0
  140. package/lib/profile/student/program/medical/examination.model.d.ts +65 -0
  141. package/lib/profile/student/program/medical/examination.model.js +209 -0
  142. package/lib/profile/student/program/medical/examination.model.js.map +1 -0
  143. package/lib/profile/student/program/program.entity.d.ts +78 -0
  144. package/lib/profile/student/program/program.entity.js +225 -0
  145. package/lib/profile/student/program/program.entity.js.map +1 -0
  146. package/lib/profile/student/program/training/appointment.entity.d.ts +151 -0
  147. package/lib/profile/student/program/training/appointment.entity.js +441 -0
  148. package/lib/profile/student/program/training/appointment.entity.js.map +1 -0
  149. package/lib/profile/student/program/training/exam.entity.d.ts +41 -0
  150. package/lib/profile/student/program/training/exam.entity.js +141 -0
  151. package/lib/profile/student/program/training/exam.entity.js.map +1 -0
  152. package/lib/profile/student/program/training/lesson.entity.d.ts +84 -0
  153. package/lib/profile/student/program/training/lesson.entity.js +221 -0
  154. package/lib/profile/student/program/training/lesson.entity.js.map +1 -0
  155. package/lib/profile/student/program/training/request.entity.d.ts +56 -0
  156. package/lib/profile/student/program/training/request.entity.js +159 -0
  157. package/lib/profile/student/program/training/request.entity.js.map +1 -0
  158. package/lib/profile/student/program/training/topic.entity.d.ts +109 -0
  159. package/lib/profile/student/program/training/topic.entity.js +255 -0
  160. package/lib/profile/student/program/training/topic.entity.js.map +1 -0
  161. package/lib/profile/student/program/training/training.entity.d.ts +167 -0
  162. package/lib/profile/student/program/training/training.entity.js +501 -0
  163. package/lib/profile/student/program/training/training.entity.js.map +1 -0
  164. package/lib/profile/student/program/training/transaction.entity.d.ts +111 -0
  165. package/lib/profile/student/program/training/transaction.entity.js +266 -0
  166. package/lib/profile/student/program/training/transaction.entity.js.map +1 -0
  167. package/lib/profile/student/student.entity.d.ts +89 -0
  168. package/lib/profile/student/student.entity.js +183 -0
  169. package/lib/profile/student/student.entity.js.map +1 -0
  170. package/lib/system/campaign/campaign.entity.d.ts +68 -0
  171. package/lib/system/campaign/campaign.entity.js +150 -0
  172. package/lib/system/campaign/campaign.entity.js.map +1 -0
  173. package/lib/system/campaign/gifcode.entity.d.ts +14 -0
  174. package/lib/system/campaign/gifcode.entity.js +77 -0
  175. package/lib/system/campaign/gifcode.entity.js.map +1 -0
  176. package/lib/system/campaigne/campaign.entity.d.ts +69 -0
  177. package/lib/system/campaigne/campaign.entity.js +179 -0
  178. package/lib/system/campaigne/campaign.entity.js.map +1 -0
  179. package/lib/system/campaigne/gifcode.entity.d.ts +54 -0
  180. package/lib/system/campaigne/gifcode.entity.js +126 -0
  181. package/lib/system/campaigne/gifcode.entity.js.map +1 -0
  182. package/lib/system/country/country.entity.d.ts +121 -0
  183. package/lib/system/country/country.entity.js +284 -0
  184. package/lib/system/country/country.entity.js.map +1 -0
  185. package/lib/system/country/country.metric.d.ts +12 -0
  186. package/lib/system/country/country.metric.js +68 -0
  187. package/lib/system/country/country.metric.js.map +1 -0
  188. package/lib/system/currency/currency.entity.d.ts +46 -0
  189. package/lib/system/currency/currency.entity.js +112 -0
  190. package/lib/system/currency/currency.entity.js.map +1 -0
  191. package/lib/system/driving/category.entity.d.ts +146 -0
  192. package/lib/system/driving/category.entity.js +321 -0
  193. package/lib/system/driving/category.entity.js.map +1 -0
  194. package/lib/system/driving/vehicle.entity.d.ts +54 -0
  195. package/lib/system/driving/vehicle.entity.js +130 -0
  196. package/lib/system/driving/vehicle.entity.js.map +1 -0
  197. package/lib/system/event/business.entity.d.ts +75 -0
  198. package/lib/system/event/business.entity.js +170 -0
  199. package/lib/system/event/business.entity.js.map +1 -0
  200. package/lib/system/event/log.entity.d.ts +103 -0
  201. package/lib/system/event/log.entity.js +202 -0
  202. package/lib/system/event/log.entity.js.map +1 -0
  203. package/lib/system/policy/policy.entity.d.ts +90 -0
  204. package/lib/system/policy/policy.entity.js +226 -0
  205. package/lib/system/policy/policy.entity.js.map +1 -0
  206. package/lib/system/staff/staff.entity.d.ts +72 -0
  207. package/lib/system/staff/staff.entity.js +186 -0
  208. package/lib/system/staff/staff.entity.js.map +1 -0
  209. package/lib/tsconfig.tsbuildinfo +1 -0
  210. package/lib/user/alert.entity.d.ts +95 -0
  211. package/lib/user/alert.entity.js +223 -0
  212. package/lib/user/alert.entity.js.map +1 -0
  213. package/lib/user/blocked.entity.d.ts +42 -0
  214. package/lib/user/blocked.entity.js +83 -0
  215. package/lib/user/blocked.entity.js.map +1 -0
  216. package/lib/user/device.entity.d.ts +72 -0
  217. package/lib/user/device.entity.js +182 -0
  218. package/lib/user/device.entity.js.map +1 -0
  219. package/lib/user/notification.entity.d.ts +87 -0
  220. package/lib/user/notification.entity.js +219 -0
  221. package/lib/user/notification.entity.js.map +1 -0
  222. package/lib/user/ticket.entity.d.ts +85 -0
  223. package/lib/user/ticket.entity.js +231 -0
  224. package/lib/user/ticket.entity.js.map +1 -0
  225. package/lib/user/user.entity.d.ts +235 -0
  226. package/lib/user/user.entity.js +573 -0
  227. package/lib/user/user.entity.js.map +1 -0
  228. package/lib/user/verification.entity.d.ts +75 -0
  229. package/lib/user/verification.entity.js +142 -0
  230. package/lib/user/verification.entity.js.map +1 -0
  231. package/lib/utils/activity.helper.d.ts +26 -0
  232. package/lib/utils/activity.helper.js +39 -0
  233. package/lib/utils/activity.helper.js.map +1 -0
  234. package/lib/utils/index.d.ts +4 -0
  235. package/lib/utils/index.js +21 -0
  236. package/lib/utils/index.js.map +1 -0
  237. package/lib/utils/json-metrics.transform.d.ts +35 -0
  238. package/lib/utils/json-metrics.transform.js +83 -0
  239. package/lib/utils/json-metrics.transform.js.map +1 -0
  240. package/lib/utils/numeric.transform.d.ts +38 -0
  241. package/lib/utils/numeric.transform.js +74 -0
  242. package/lib/utils/numeric.transform.js.map +1 -0
  243. package/lib/utils/trackable.entity.d.ts +82 -0
  244. package/lib/utils/trackable.entity.js +100 -0
  245. package/lib/utils/trackable.entity.js.map +1 -0
  246. package/package.json +49 -0
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SeedVehicleEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const typeorm_2 = require("typeorm");
15
+ const common_1 = require("@driveup/common");
16
+ const staff_entity_1 = require("../../system/staff/staff.entity");
17
+ const category_entity_1 = require("./category.entity");
18
+ const utils_1 = require("../../utils");
19
+ /**
20
+ * Represents a seed vehicle template in the system.
21
+ * Seed vehicles are predefined vehicle configurations that can be used
22
+ * by companies when setting up their fleet. Each vehicle is associated with
23
+ * a driving category and includes make, model, and transmission type.
24
+ *
25
+ * @extends TrackableEntity<Vehicle>
26
+ */
27
+ let SeedVehicleEntity = class SeedVehicleEntity extends utils_1.TrackableEntity {
28
+ /**
29
+ * Creates a new SeedVehicleEntity instance
30
+ * @param props - Partial properties to initialize the entity
31
+ */
32
+ constructor(props) {
33
+ super();
34
+ Object.assign(this, props);
35
+ }
36
+ /**
37
+ * Converts the entity to a Vehicle model instance
38
+ * @returns Vehicle model with id, make, model, and transmission
39
+ */
40
+ toModel() {
41
+ return new common_1.Vehicle({
42
+ id: this.id,
43
+ make: this.make,
44
+ model: this.model,
45
+ transmission: this.transmission
46
+ });
47
+ }
48
+ /**
49
+ * Retrieves activity history for this vehicle
50
+ * @returns Promise resolving to array of Activity instances tracking creation and updates
51
+ */
52
+ async getActivities() {
53
+ const activities = [];
54
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
55
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
56
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
57
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
58
+ return activities.filter(a => !a);
59
+ }
60
+ };
61
+ exports.SeedVehicleEntity = SeedVehicleEntity;
62
+ __decorate([
63
+ (0, typeorm_1.Column)(),
64
+ __metadata("design:type", Number)
65
+ ], SeedVehicleEntity.prototype, "categoryId", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)({
68
+ nullable: true,
69
+ default: null
70
+ }),
71
+ __metadata("design:type", String)
72
+ ], SeedVehicleEntity.prototype, "make", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({
75
+ nullable: true,
76
+ default: null
77
+ }),
78
+ __metadata("design:type", String)
79
+ ], SeedVehicleEntity.prototype, "model", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.Column)({
82
+ type: 'enum',
83
+ enum: common_1.CarTransmission,
84
+ default: common_1.CarTransmission.Automatic,
85
+ nullable: false
86
+ }),
87
+ __metadata("design:type", String)
88
+ ], SeedVehicleEntity.prototype, "transmission", void 0);
89
+ __decorate([
90
+ (0, typeorm_2.ManyToOne)(() => category_entity_1.DrivingCategoryEntity, categorry => categorry.seedVehicles),
91
+ __metadata("design:type", Promise)
92
+ ], SeedVehicleEntity.prototype, "category", void 0);
93
+ exports.SeedVehicleEntity = SeedVehicleEntity = __decorate([
94
+ (0, typeorm_1.Entity)('seedVehicles'),
95
+ __metadata("design:paramtypes", [Object])
96
+ ], SeedVehicleEntity);
97
+ //# sourceMappingURL=vehicle.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vehicle.entity.js","sourceRoot":"","sources":["../../../src/catalog/driving/vehicle.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,qCAAoC;AACpC,4CAAmF;AACnF,kEAA8D;AAC9D,uDAA0D;AAC1D,uCAA0D;AAE1D;;;;;;;GAOG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,uBAAwB;IA4C9D;;;OAGG;IACH,YAAY,KAAkC;QAC7C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa;QAClB,MAAM,UAAU,GAAe,EAAE,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,kBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,SAAS,EAAE,0BAAW,CAAC,CAAC,CAAC;QACvF,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,kBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1E,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,kBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,SAAS,EAAE,0BAAW,CAAC,CAAC,CAAC;QACvF,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,kBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1E,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;CACD,CAAA;AA9EY,8CAAiB;AAM7B;IADC,IAAA,gBAAM,GAAE;;qDACU;AASnB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;+CACW;AASb;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;gDACY;AAYd;IANC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,wBAAe;QACrB,OAAO,EAAE,wBAAe,CAAC,SAAS;QAClC,QAAQ,EAAE,KAAK;KACf,CAAC;;uDACsC;AAMxC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC;;mDACnC;4BA1C7B,iBAAiB;IAD7B,IAAA,gBAAM,EAAC,cAAc,CAAC;;GACV,iBAAiB,CA8E7B"}
@@ -0,0 +1,123 @@
1
+ import { Content, Item, Language, Metadata } from '@driveup/common';
2
+ import { Activity } from '@driveup/common';
3
+ import { PricePlan, PricePlanFeature, PricePlanType } from '@driveup/common';
4
+ import { ProductPricePlanEntity } from '../product/priceplan.entity';
5
+ import { TrackableEntity } from '../../utils';
6
+ /**
7
+ * Represents a pricing plan template in the system.
8
+ * Price plans define different payment structures and feature sets for products.
9
+ * Each plan includes features, usage details, and can be activated/deactivated
10
+ * to control availability for new customers.
11
+ *
12
+ * @extends TrackableEntity<PricePlan>
13
+ */
14
+ export declare class PricePlanEntity extends TrackableEntity<PricePlan> {
15
+ /**
16
+ * Type of pricing plan (e.g., PayAsYouUse, Subscription)
17
+ * @default PricePlanType.PayAsYouUse
18
+ */
19
+ type: PricePlanType;
20
+ /**
21
+ * Unique price plan icon
22
+ */
23
+ imageUrl: string;
24
+ /**
25
+ * Plan features list
26
+ * Described all price plan benefits
27
+ */
28
+ features: PricePlanFeature[];
29
+ /**
30
+ * Plan feature usage details
31
+ * Use this definition to build company driving plang usage field (IPricePlanUsage)
32
+ */
33
+ usage: PricePlanFeature[];
34
+ /**
35
+ * Country localizations
36
+ */
37
+ translations: Content[];
38
+ /**
39
+ * Country localizations
40
+ */
41
+ metadata: Metadata[];
42
+ /**
43
+ * Sort price by relevance
44
+ */
45
+ sort: number;
46
+ /**
47
+ * Price plan active state
48
+ * Activating/Deactivating a price plan will not affect existing customers,
49
+ * but will prevent new customers from purchasing the plan.
50
+ * Deactivating must set all country price plans to enabled=false
51
+ */
52
+ active: boolean;
53
+ /**
54
+ * ID of the staff member who enabled this price plan
55
+ */
56
+ enabledBy: number;
57
+ /**
58
+ * Date when the price plan was enabled
59
+ */
60
+ enabledOn: Date;
61
+ /**
62
+ * ID of the staff member who disabled this price plan
63
+ */
64
+ disabledBy: number;
65
+ /**
66
+ * Date when the price plan was disabled
67
+ */
68
+ disabledOn: Date;
69
+ /**
70
+ * Product country price plans
71
+ * Each country can have its own price plan for the driveup products
72
+ */
73
+ products: Promise<ProductPricePlanEntity[]>;
74
+ /**
75
+ * Creates a new PricePlanEntity instance
76
+ * @param props - Partial properties to initialize the entity
77
+ */
78
+ constructor(props?: Partial<PricePlanEntity>);
79
+ /**
80
+ * Converts the entity to a PricePlan model instance
81
+ * @param lang - Optional language for translations
82
+ * @returns PricePlan model with localized content and features
83
+ */
84
+ toModel(lang?: Language): PricePlan;
85
+ /**
86
+ * Converts the entity to a PricePlan model instance
87
+ * @param lang - Optional language for translations
88
+ * @returns PricePlan model with localized content and features
89
+ */
90
+ toSummary(lang?: Language): PricePlan;
91
+ /**
92
+ * Gets the localized translation for the price plan
93
+ * @param lang - Optional language code; defaults to current i18n context
94
+ * @returns Content instance with translated title, description, and image
95
+ */
96
+ getTranslation(lang?: Language): Content;
97
+ /**
98
+ * Gets all available translations for the price plan
99
+ * @returns Array of Content instances for all languages
100
+ */
101
+ getTranslations(): Content[];
102
+ /**
103
+ * Gets the localized feature list for the price plan
104
+ * @returns Array of Item instances with translated feature names
105
+ */
106
+ getFeatures(): Item<any>[];
107
+ /**
108
+ * Gets the localized usage feature list with dynamic arguments
109
+ * @param args - Key-value pairs for i18n interpolation
110
+ * @returns Array of Item instances with translated usage details
111
+ */
112
+ getFeatureUsages(args: Record<string, any>): Item<any>[];
113
+ /**
114
+ * Converts raw metadata to Metadata instances
115
+ * @returns Array of Metadata instances
116
+ */
117
+ getMetadata(): Metadata<any>[];
118
+ /**
119
+ * Retrieves activity history for this price plan
120
+ * @returns Promise resolving to array of Activity instances tracking creation and updates
121
+ */
122
+ getActivities(): Promise<Activity[]>;
123
+ }
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PricePlanEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const typeorm_2 = require("typeorm");
15
+ const nestjs_i18n_1 = require("nestjs-i18n");
16
+ const common_1 = require("@driveup/common");
17
+ const common_2 = require("@driveup/common");
18
+ const common_3 = require("@driveup/common");
19
+ const staff_entity_1 = require("../../system/staff/staff.entity");
20
+ const priceplan_entity_1 = require("../product/priceplan.entity");
21
+ const utils_1 = require("../../utils");
22
+ /**
23
+ * Represents a pricing plan template in the system.
24
+ * Price plans define different payment structures and feature sets for products.
25
+ * Each plan includes features, usage details, and can be activated/deactivated
26
+ * to control availability for new customers.
27
+ *
28
+ * @extends TrackableEntity<PricePlan>
29
+ */
30
+ let PricePlanEntity = class PricePlanEntity extends utils_1.TrackableEntity {
31
+ /**
32
+ * Type of pricing plan (e.g., PayAsYouUse, Subscription)
33
+ * @default PricePlanType.PayAsYouUse
34
+ */
35
+ type;
36
+ /**
37
+ * Unique price plan icon
38
+ */
39
+ imageUrl;
40
+ /**
41
+ * Plan features list
42
+ * Described all price plan benefits
43
+ */
44
+ features;
45
+ /**
46
+ * Plan feature usage details
47
+ * Use this definition to build company driving plang usage field (IPricePlanUsage)
48
+ */
49
+ usage;
50
+ /**
51
+ * Country localizations
52
+ */
53
+ translations;
54
+ /**
55
+ * Country localizations
56
+ */
57
+ metadata;
58
+ /**
59
+ * Sort price by relevance
60
+ */
61
+ sort;
62
+ /**
63
+ * Price plan active state
64
+ * Activating/Deactivating a price plan will not affect existing customers,
65
+ * but will prevent new customers from purchasing the plan.
66
+ * Deactivating must set all country price plans to enabled=false
67
+ */
68
+ active;
69
+ /**
70
+ * ID of the staff member who enabled this price plan
71
+ */
72
+ enabledBy;
73
+ /**
74
+ * Date when the price plan was enabled
75
+ */
76
+ enabledOn;
77
+ /**
78
+ * ID of the staff member who disabled this price plan
79
+ */
80
+ disabledBy;
81
+ /**
82
+ * Date when the price plan was disabled
83
+ */
84
+ disabledOn;
85
+ /**
86
+ * Product country price plans
87
+ * Each country can have its own price plan for the driveup products
88
+ */
89
+ products;
90
+ /**
91
+ * Creates a new PricePlanEntity instance
92
+ * @param props - Partial properties to initialize the entity
93
+ */
94
+ constructor(props) {
95
+ super();
96
+ Object.assign(this, props);
97
+ }
98
+ /**
99
+ * Converts the entity to a PricePlan model instance
100
+ * @param lang - Optional language for translations
101
+ * @returns PricePlan model with localized content and features
102
+ */
103
+ toModel(lang) {
104
+ const translation = this.getTranslation(lang);
105
+ return new common_3.PricePlan({
106
+ id: this.id,
107
+ type: this.type,
108
+ title: translation?.title,
109
+ description: translation?.description,
110
+ imageUrl: this.imageUrl,
111
+ features: this.getFeatures(),
112
+ metadata: this.getMetadata(),
113
+ sort: this.sort,
114
+ active: this.active
115
+ });
116
+ }
117
+ /**
118
+ * Converts the entity to a PricePlan model instance
119
+ * @param lang - Optional language for translations
120
+ * @returns PricePlan model with localized content and features
121
+ */
122
+ toSummary(lang) {
123
+ return this.toModel(lang);
124
+ }
125
+ /**
126
+ * Gets the localized translation for the price plan
127
+ * @param lang - Optional language code; defaults to current i18n context
128
+ * @returns Content instance with translated title, description, and image
129
+ */
130
+ getTranslation(lang) {
131
+ const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
132
+ const translation = this.translations?.find(t => t.language === language);
133
+ return new common_1.Content({
134
+ title: translation?.title,
135
+ description: translation?.description,
136
+ content: translation?.content,
137
+ imageUrl: translation?.imageUrl || this.imageUrl,
138
+ link: translation?.link,
139
+ });
140
+ }
141
+ /**
142
+ * Gets all available translations for the price plan
143
+ * @returns Array of Content instances for all languages
144
+ */
145
+ getTranslations() {
146
+ return this.translations?.map(t => new common_1.Content({
147
+ title: t.title,
148
+ description: t.description,
149
+ content: t.content,
150
+ imageUrl: t.imageUrl,
151
+ link: t.link,
152
+ language: t.language
153
+ }));
154
+ }
155
+ /**
156
+ * Gets the localized feature list for the price plan
157
+ * @returns Array of Item instances with translated feature names
158
+ */
159
+ getFeatures() {
160
+ const args = this.metadata?.reduce((acc, curr) => {
161
+ acc[curr.name] = curr.value;
162
+ return acc;
163
+ }, {});
164
+ return this.features?.map(f => new common_1.Item({
165
+ name: f,
166
+ title: nestjs_i18n_1.I18nContext.current().t(f, { args })
167
+ }));
168
+ }
169
+ /**
170
+ * Gets the localized usage feature list with dynamic arguments
171
+ * @param args - Key-value pairs for i18n interpolation
172
+ * @returns Array of Item instances with translated usage details
173
+ */
174
+ getFeatureUsages(args) {
175
+ return this.usage?.map(name => new common_1.Item({
176
+ name: name,
177
+ title: nestjs_i18n_1.I18nContext.current().t(name, { args })
178
+ }));
179
+ }
180
+ /**
181
+ * Converts raw metadata to Metadata instances
182
+ * @returns Array of Metadata instances
183
+ */
184
+ getMetadata() {
185
+ return this.metadata?.map(m => common_1.Metadata.toInstance(m));
186
+ }
187
+ /**
188
+ * Retrieves activity history for this price plan
189
+ * @returns Promise resolving to array of Activity instances tracking creation and updates
190
+ */
191
+ async getActivities() {
192
+ const activities = [];
193
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy, staff_entity_1.StaffEntity));
194
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
195
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy, staff_entity_1.StaffEntity));
196
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
197
+ return activities.filter(a => a);
198
+ }
199
+ };
200
+ exports.PricePlanEntity = PricePlanEntity;
201
+ __decorate([
202
+ (0, typeorm_1.Column)({
203
+ type: 'enum',
204
+ name: 'pricePlanType',
205
+ enum: common_3.PricePlanType,
206
+ default: common_3.PricePlanType.PayAsYouUse,
207
+ nullable: false
208
+ }),
209
+ __metadata("design:type", String)
210
+ ], PricePlanEntity.prototype, "type", void 0);
211
+ __decorate([
212
+ (0, typeorm_1.Column)({
213
+ nullable: true,
214
+ default: null
215
+ }),
216
+ __metadata("design:type", String)
217
+ ], PricePlanEntity.prototype, "imageUrl", void 0);
218
+ __decorate([
219
+ (0, typeorm_1.Column)({
220
+ type: 'simple-json',
221
+ nullable: true,
222
+ default: null
223
+ }),
224
+ __metadata("design:type", Array)
225
+ ], PricePlanEntity.prototype, "features", void 0);
226
+ __decorate([
227
+ (0, typeorm_1.Column)({
228
+ type: 'simple-json',
229
+ nullable: true,
230
+ default: null
231
+ }),
232
+ __metadata("design:type", Array)
233
+ ], PricePlanEntity.prototype, "usage", void 0);
234
+ __decorate([
235
+ (0, typeorm_1.Column)({
236
+ type: 'simple-json',
237
+ nullable: true,
238
+ default: null
239
+ }),
240
+ __metadata("design:type", Array)
241
+ ], PricePlanEntity.prototype, "translations", void 0);
242
+ __decorate([
243
+ (0, typeorm_1.Column)({
244
+ type: 'simple-json',
245
+ nullable: true,
246
+ default: null
247
+ }),
248
+ __metadata("design:type", Array)
249
+ ], PricePlanEntity.prototype, "metadata", void 0);
250
+ __decorate([
251
+ (0, typeorm_1.Column)({
252
+ nullable: false,
253
+ default: false
254
+ }),
255
+ __metadata("design:type", Number)
256
+ ], PricePlanEntity.prototype, "sort", void 0);
257
+ __decorate([
258
+ (0, typeorm_1.Column)({
259
+ nullable: false,
260
+ default: false
261
+ }),
262
+ __metadata("design:type", Boolean)
263
+ ], PricePlanEntity.prototype, "active", void 0);
264
+ __decorate([
265
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
266
+ __metadata("design:type", Number)
267
+ ], PricePlanEntity.prototype, "enabledBy", void 0);
268
+ __decorate([
269
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
270
+ __metadata("design:type", Date)
271
+ ], PricePlanEntity.prototype, "enabledOn", void 0);
272
+ __decorate([
273
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
274
+ __metadata("design:type", Number)
275
+ ], PricePlanEntity.prototype, "disabledBy", void 0);
276
+ __decorate([
277
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
278
+ __metadata("design:type", Date)
279
+ ], PricePlanEntity.prototype, "disabledOn", void 0);
280
+ __decorate([
281
+ (0, typeorm_2.OneToMany)(() => priceplan_entity_1.ProductPricePlanEntity, plan => plan.pricePlan),
282
+ __metadata("design:type", Promise)
283
+ ], PricePlanEntity.prototype, "products", void 0);
284
+ exports.PricePlanEntity = PricePlanEntity = __decorate([
285
+ (0, typeorm_1.Entity)('systemPricePlans'),
286
+ __metadata("design:paramtypes", [Object])
287
+ ], PricePlanEntity);
288
+ //# sourceMappingURL=priceplan.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceplan.entity.js","sourceRoot":"","sources":["../../../src/catalog/priceplan/priceplan.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,qCAAoC;AACpC,6CAA0C;AAC1C,4CAAmE;AACnE,4CAAyD;AACzD,4CAA6E;AAC7E,kEAA8D;AAC9D,kEAAqE;AACrE,uCAA0D;AAE1D;;;;;;;GAOG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,uBAA0B;IAE9D;;;OAGG;IAQH,IAAI,CAAgB;IAEpB;;OAEG;IAKH,QAAQ,CAAS;IAEjB;;;OAGG;IAMH,QAAQ,CAAqB;IAE7B;;;OAGG;IAMH,KAAK,CAAqB;IAE1B;;OAEG;IAMH,YAAY,CAAY;IAExB;;OAEG;IAMH,QAAQ,CAAa;IAErB;;OAEG;IAKH,IAAI,CAAS;IAEb;;;;;OAKG;IAKH,MAAM,CAAU;IAEhB;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS,CAAO;IAEhB;;OAEG;IAEH,UAAU,CAAS;IAEnB;;OAEG;IAEH,UAAU,CAAO;IAEjB;;;OAGG;IAEH,QAAQ,CAAoC;IAE5C;;;OAGG;IACH,YAAY,KAAgC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAe;QACtB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC7C,OAAO,IAAI,kBAAS,C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I,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;iDACmB;AASrB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;KACd,CAAC;;6CACW;AAYb;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;KACd,CAAC;;+CACc;AAMhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kDACxB;AAMlB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC/B,IAAI;kDAAC;AAMhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDACvB;AAMnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC9B,IAAI;mDAAC;AAOjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,yCAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;;iDACpB;0BApHhC,eAAe;IAD3B,IAAA,gBAAM,EAAC,kBAAkB,CAAC;;GACd,eAAe,CA2O3B"}
@@ -0,0 +1,109 @@
1
+ import { Language, Product } from '@driveup/common';
2
+ import { Activity, Metadata } from '@driveup/common';
3
+ import { CountryEntity } from '../../system/country/country.entity';
4
+ import { ProductPricePlanEntity } from './priceplan.entity';
5
+ import { ProductEntity } from './product.entity';
6
+ import { CompanyProductEntity } from '../../profile/company/product/product.entity';
7
+ import { SeedCourseEntity } from '../seed/courses/course.entity';
8
+ import { TrackableEntity } from '../../utils';
9
+ /**
10
+ * Represents a product configuration for a specific country.
11
+ * This entity manages country-specific settings for products including
12
+ * VAT rates, availability, and metadata that companies will inherit.
13
+ * Each product can have different configurations per country.
14
+ *
15
+ * @extends TrackableEntity<Product>
16
+ */
17
+ export declare class ProductCountryEntity extends TrackableEntity<Product> {
18
+ /**
19
+ * Driveup product reference
20
+ * Each country product is linked to a specific product
21
+ */
22
+ productId: number;
23
+ /**
24
+ * Country reference
25
+ */
26
+ countryId: number;
27
+ /**
28
+ * Country dependent product vat
29
+ */
30
+ vat: number;
31
+ /**
32
+ * Country product active status
33
+ * Activating/Deactivating a product will not affect existing customers,
34
+ * but will prevent new customers from purchasing the variant.
35
+ * Deactivating must set all country products to enabled=false
36
+ */
37
+ active: boolean;
38
+ /**
39
+ * Sort by country relevance
40
+ */
41
+ sort: number;
42
+ /**
43
+ * Additional product metadata to seed company product
44
+ */
45
+ metadata: Metadata[];
46
+ /**
47
+ * ID of the staff member who enabled this product in the country
48
+ */
49
+ enabledBy: number;
50
+ /**
51
+ * Date when the product was enabled in the country
52
+ */
53
+ enabledOn: Date;
54
+ /**
55
+ * ID of the staff member who disabled this product in the country
56
+ */
57
+ disabledBy: number;
58
+ /**
59
+ * Date when the product was disabled in the country
60
+ */
61
+ disabledOn: Date;
62
+ /**
63
+ * Reference to the system product
64
+ */
65
+ product: Promise<ProductEntity>;
66
+ /**
67
+ * Reference to the country
68
+ */
69
+ country: Promise<CountryEntity>;
70
+ /**
71
+ * Available price plans for country product
72
+ */
73
+ pricePlans: Promise<ProductPricePlanEntity[]>;
74
+ /**
75
+ * Company products relation
76
+ */
77
+ companies: Promise<CompanyProductEntity[]>;
78
+ /**
79
+ * Seed courses associated with this country product
80
+ */
81
+ seedCourses: Promise<SeedCourseEntity[]>;
82
+ /**
83
+ * Creates a new ProductCountryEntity instance
84
+ * @param props - Partial properties to initialize the entity
85
+ */
86
+ constructor(props?: Partial<ProductCountryEntity>);
87
+ /**
88
+ * Converts the entity to a Product model instance
89
+ * @param lang - Optional language for translations
90
+ * @returns Promise resolving to Product model with localized content
91
+ */
92
+ toModel(lang?: Language): Promise<Product>;
93
+ /**
94
+ * Converts the entity to a Product model instance
95
+ * @param lang - Optional language for translations
96
+ * @returns Promise resolving to Product model with localized content
97
+ */
98
+ toSummary(lang?: Language): Promise<Product>;
99
+ /**
100
+ * Gets the metadata as Metadata instances
101
+ * @returns Array of Metadata instances
102
+ */
103
+ getMetadata(): Metadata<any>[];
104
+ /**
105
+ * Retrieves activity history for this country product
106
+ * @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
107
+ */
108
+ getActivities(): Promise<Activity[]>;
109
+ }