@pacp/spec 1.0.1 → 1.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.
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://pacp.dev/spec/1.0.0/pacp.schema.json",
4
- "title": "PACP v1.0.0",
3
+ "$id": "https://cdn.jsdelivr.net/npm/@pacp/spec@latest/dist/pacp.schema.json",
4
+ "title": "PACP v1.1.0",
5
5
  "oneOf": [
6
6
  {
7
- "$ref": "#/$defs/catalogDocument"
7
+ "$ref": "#/$defs/catalog_document"
8
8
  },
9
9
  {
10
- "$ref": "#/$defs/productDocument"
10
+ "$ref": "#/$defs/product_document"
11
11
  }
12
12
  ],
13
13
  "$defs": {
14
- "catalogDocument": {
14
+ "catalog_document": {
15
15
  "type": "object",
16
- "required": ["spec", "document_type", "catalog", "rulesets"],
16
+ "required": [
17
+ "document_type",
18
+ "catalog",
19
+ "rulesets"
20
+ ],
17
21
  "additionalProperties": false,
18
22
  "patternProperties": {
19
23
  "^x-": true
20
24
  },
21
25
  "properties": {
22
- "spec": {
23
- "type": "string",
24
- "const": "1.0.0"
25
- },
26
26
  "document_type": {
27
27
  "type": "string",
28
28
  "const": "CATALOG"
@@ -33,7 +33,7 @@
33
33
  "product_refs": {
34
34
  "type": "array",
35
35
  "items": {
36
- "$ref": "#/$defs/productRef"
36
+ "$ref": "#/$defs/product_ref"
37
37
  }
38
38
  },
39
39
  "context": {
@@ -76,22 +76,25 @@
76
76
  },
77
77
  "profiles": {
78
78
  "type": "array",
79
- "items": { "type": "string", "minLength": 1 }
79
+ "items": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ }
80
83
  }
81
84
  }
82
85
  },
83
- "productDocument": {
86
+ "product_document": {
84
87
  "type": "object",
85
- "required": ["spec", "document_type", "catalog_id", "product"],
88
+ "required": [
89
+ "document_type",
90
+ "catalog_id",
91
+ "product"
92
+ ],
86
93
  "additionalProperties": false,
87
94
  "patternProperties": {
88
95
  "^x-": true
89
96
  },
90
97
  "properties": {
91
- "spec": {
92
- "type": "string",
93
- "const": "1.0.0"
94
- },
95
98
  "document_type": {
96
99
  "type": "string",
97
100
  "const": "PRODUCT"
@@ -129,75 +132,134 @@
129
132
  },
130
133
  "profiles": {
131
134
  "type": "array",
132
- "items": { "type": "string", "minLength": 1 }
135
+ "items": {
136
+ "type": "string",
137
+ "minLength": 1
138
+ }
133
139
  }
134
140
  }
135
141
  },
136
- "productRef": {
142
+ "product_ref": {
137
143
  "type": "object",
138
- "required": ["id", "path"],
144
+ "required": [
145
+ "id",
146
+ "path"
147
+ ],
139
148
  "additionalProperties": false,
140
149
  "patternProperties": {
141
150
  "^x-": true
142
151
  },
143
152
  "properties": {
144
- "id": { "type": "string", "minLength": 1 },
153
+ "id": {
154
+ "type": "string",
155
+ "minLength": 1
156
+ },
145
157
  "path": {
146
158
  "type": "string",
147
159
  "minLength": 1,
148
160
  "description": "Relative path from catalog root to the product document file",
149
- "examples": ["products/SOF-001.json", "products/MES-042.json"]
161
+ "examples": [
162
+ "products/SOF-001.json",
163
+ "products/MES-042.json"
164
+ ]
150
165
  }
151
166
  }
152
167
  },
153
168
  "catalog": {
154
169
  "type": "object",
155
- "required": ["id"],
170
+ "required": [
171
+ "id"
172
+ ],
156
173
  "additionalProperties": false,
157
174
  "patternProperties": {
158
175
  "^x-": true
159
176
  },
160
177
  "properties": {
161
- "id": { "type": "string", "minLength": 1 },
162
- "name": { "type": "string", "minLength": 1 },
163
- "default_price_list_id": { "type": "string", "minLength": 1 },
178
+ "id": {
179
+ "type": "string",
180
+ "minLength": 1
181
+ },
182
+ "name": {
183
+ "type": "string",
184
+ "minLength": 1
185
+ },
186
+ "default_price_list_id": {
187
+ "type": "string",
188
+ "minLength": 1
189
+ },
164
190
  "price_lists": {
165
191
  "type": "array",
166
- "items": { "$ref": "#/$defs/priceList" }
192
+ "items": {
193
+ "$ref": "#/$defs/price_list"
194
+ }
167
195
  }
168
196
  }
169
197
  },
170
- "priceList": {
198
+ "price_list": {
171
199
  "type": "object",
172
- "required": ["id", "currency"],
200
+ "required": [
201
+ "id",
202
+ "currency"
203
+ ],
173
204
  "additionalProperties": false,
174
205
  "patternProperties": {
175
206
  "^x-": true
176
207
  },
177
208
  "properties": {
178
- "id": { "type": "string", "minLength": 1 },
179
- "label": { "type": "string" },
180
- "currency": { "type": "string", "minLength": 3, "maxLength": 3 },
209
+ "id": {
210
+ "type": "string",
211
+ "minLength": 1
212
+ },
213
+ "label": {
214
+ "type": "string"
215
+ },
216
+ "currency": {
217
+ "type": "string",
218
+ "minLength": 3,
219
+ "maxLength": 3
220
+ },
181
221
  "context_match": {
182
222
  "type": "object",
183
- "additionalProperties": { "$ref": "#/$defs/scalarValue" }
223
+ "additionalProperties": {
224
+ "$ref": "#/$defs/scalar_value"
225
+ }
184
226
  }
185
227
  }
186
228
  },
187
229
  "context": {
188
230
  "type": "object",
189
- "additionalProperties": false,
231
+ "additionalProperties": {
232
+ "$ref": "#/$defs/scalar_value"
233
+ },
190
234
  "patternProperties": {
191
235
  "^x-": true
192
236
  },
193
237
  "properties": {
194
- "price_list_id": { "type": "string", "minLength": 1 },
195
- "region": { "type": "string" },
196
- "channel": { "type": "string" },
197
- "customer": { "type": "string" },
198
- "lot_id": { "type": "string", "minLength": 1 },
199
- "requested_quantity": { "type": "number", "exclusiveMinimum": 0 },
200
- "requested_unit": { "type": "string", "minLength": 1 }
238
+ "price_list_id": {
239
+ "type": "string",
240
+ "minLength": 1
241
+ },
242
+ "region": {
243
+ "type": "string"
244
+ },
245
+ "channel": {
246
+ "type": "string"
247
+ },
248
+ "customer": {
249
+ "type": "string"
250
+ },
251
+ "lot_id": {
252
+ "type": "string",
253
+ "minLength": 1
254
+ },
255
+ "requested_quantity": {
256
+ "type": "number",
257
+ "exclusiveMinimum": 0
258
+ },
259
+ "requested_unit": {
260
+ "type": "string",
261
+ "minLength": 1
262
+ }
201
263
  }
202
264
  },
203
265
  "pricing": {
@@ -209,55 +271,120 @@
209
271
  "properties": {
210
272
  "calculation_mode": {
211
273
  "type": "string",
212
- "enum": ["CASCADE", "TABLE_LOOKUP", "OVERRIDE_BY_VARIANT", "COST_PLUS"]
274
+ "enum": [
275
+ "CASCADE",
276
+ "TABLE_LOOKUP",
277
+ "OVERRIDE_BY_VARIANT",
278
+ "COST_PLUS"
279
+ ]
213
280
  }
214
281
  }
215
282
  },
216
283
  "product": {
217
284
  "type": "object",
218
- "required": ["id", "options"],
285
+ "required": [
286
+ "id",
287
+ "options"
288
+ ],
219
289
  "additionalProperties": false,
220
290
  "patternProperties": {
221
291
  "^x-": true
222
292
  },
223
293
  "properties": {
224
- "id": { "type": "string", "minLength": 1 },
225
- "name": { "type": "string" },
226
- "sku": { "type": "string", "minLength": 1 },
227
- "manufacturer": { "type": "string", "minLength": 1 },
228
- "brand": { "type": "string", "minLength": 1 },
229
- "description": { "type": "string" },
230
- "category": { "type": "string", "minLength": 1 },
231
- "gtin": { "type": "string", "pattern": "^\\d{8,14}$" },
232
- "base_price": { "type": "number" },
233
- "unit": { "type": "string", "minLength": 1 },
294
+ "id": {
295
+ "type": "string",
296
+ "minLength": 1
297
+ },
298
+ "name": {
299
+ "type": "string"
300
+ },
301
+ "sku": {
302
+ "type": "string",
303
+ "minLength": 1
304
+ },
305
+ "manufacturer": {
306
+ "type": "string",
307
+ "minLength": 1
308
+ },
309
+ "brand": {
310
+ "type": "string",
311
+ "minLength": 1
312
+ },
313
+ "description": {
314
+ "type": "string"
315
+ },
316
+ "category": {
317
+ "type": "array",
318
+ "items": {
319
+ "type": "array",
320
+ "items": {
321
+ "type": "string",
322
+ "minLength": 1
323
+ },
324
+ "minItems": 1
325
+ },
326
+ "description": "Categorias hierárquicas do produto. Cada item é um path da raiz à folha, ex.: [[\"Móveis\", \"Sofá\"], [\"Promoções\"]]."
327
+ },
328
+ "gtin": {
329
+ "type": "string",
330
+ "pattern": "^\\d{8,14}$"
331
+ },
332
+ "base_price": {
333
+ "type": "number"
334
+ },
335
+ "unit": {
336
+ "type": "string",
337
+ "minLength": 1
338
+ },
234
339
  "images": {
235
340
  "type": "array",
236
- "items": { "$ref": "#/$defs/imageRef" }
341
+ "items": {
342
+ "$ref": "#/$defs/image"
343
+ }
237
344
  },
238
345
  "tags": {
239
346
  "type": "array",
240
- "items": { "type": "string", "minLength": 1 }
347
+ "items": {
348
+ "type": "string",
349
+ "minLength": 1
350
+ }
351
+ },
352
+ "weight": {
353
+ "$ref": "#/$defs/measure"
354
+ },
355
+ "dimensions": {
356
+ "$ref": "#/$defs/physical_dimensions"
357
+ },
358
+ "lot_policy": {
359
+ "$ref": "#/$defs/lot_policy"
360
+ },
361
+ "sales_unit": {
362
+ "$ref": "#/$defs/sales_unit"
241
363
  },
242
- "weight": { "$ref": "#/$defs/measure" },
243
- "dimensions": { "$ref": "#/$defs/dimensionsObj" },
244
- "lot_policy": { "$ref": "#/$defs/lotPolicy" },
245
- "sales_unit": { "$ref": "#/$defs/salesUnit" },
246
364
  "attributes": {
247
365
  "type": "array",
248
- "items": { "$ref": "#/$defs/attributeRef" }
366
+ "items": {
367
+ "$ref": "#/$defs/attribute_ref"
368
+ }
249
369
  },
250
370
  "attribute_values": {
251
371
  "type": "array",
252
- "items": { "$ref": "#/$defs/attributeValue" }
372
+ "items": {
373
+ "$ref": "#/$defs/attribute_value"
374
+ }
253
375
  },
254
376
  "options": {
255
377
  "type": "array",
256
- "items": { "$ref": "#/$defs/option" }
378
+ "items": {
379
+ "$ref": "#/$defs/option"
380
+ }
257
381
  },
258
- "rulesetIds": {
382
+ "ruleset_ids": {
259
383
  "type": "array",
260
- "items": { "type": "string", "minLength": 1 }
384
+ "items": {
385
+ "type": "string",
386
+ "minLength": 1
387
+ }
261
388
  }
262
389
  },
263
390
  "allOf": [
@@ -266,185 +393,434 @@
266
393
  "properties": {
267
394
  "lot_policy": {
268
395
  "properties": {
269
- "source": { "const": "ATTRIBUTE" }
396
+ "source": {
397
+ "const": "ATTRIBUTE"
398
+ }
270
399
  },
271
- "required": ["source"]
400
+ "required": [
401
+ "source"
402
+ ]
272
403
  }
273
404
  },
274
- "required": ["lot_policy"]
405
+ "required": [
406
+ "lot_policy"
407
+ ]
275
408
  },
276
409
  "then": {
277
410
  "properties": {
278
411
  "lot_policy": {
279
- "required": ["attributeId"]
412
+ "required": [
413
+ "attribute_id"
414
+ ]
280
415
  }
281
416
  }
282
417
  }
283
418
  }
284
419
  ]
285
420
  },
286
- "lotPolicy": {
421
+ "lot_policy": {
287
422
  "type": "object",
288
- "required": ["required", "source"],
423
+ "required": [
424
+ "required",
425
+ "source"
426
+ ],
289
427
  "additionalProperties": false,
290
428
  "patternProperties": {
291
429
  "^x-": true
292
430
  },
293
431
  "properties": {
294
- "required": { "type": "boolean" },
295
- "source": { "type": "string", "enum": ["CONTEXT", "ATTRIBUTE"] },
296
- "contextKey": { "type": "string", "minLength": 1 },
297
- "attributeId": { "type": "string", "minLength": 1 }
432
+ "required": {
433
+ "type": "boolean"
434
+ },
435
+ "source": {
436
+ "type": "string",
437
+ "enum": [
438
+ "CONTEXT",
439
+ "ATTRIBUTE"
440
+ ]
441
+ },
442
+ "context_key": {
443
+ "type": "string",
444
+ "minLength": 1
445
+ },
446
+ "attribute_id": {
447
+ "type": "string",
448
+ "minLength": 1
449
+ }
298
450
  },
299
451
  "allOf": [
300
452
  {
301
- "if": { "properties": { "source": { "const": "CONTEXT" } } },
302
- "then": { "required": ["contextKey"] }
453
+ "if": {
454
+ "properties": {
455
+ "source": {
456
+ "const": "CONTEXT"
457
+ }
458
+ }
459
+ },
460
+ "then": {
461
+ "required": [
462
+ "context_key"
463
+ ]
464
+ }
303
465
  },
304
466
  {
305
- "if": { "properties": { "source": { "const": "ATTRIBUTE" } } },
306
- "then": { "required": ["attributeId"] }
467
+ "if": {
468
+ "properties": {
469
+ "source": {
470
+ "const": "ATTRIBUTE"
471
+ }
472
+ }
473
+ },
474
+ "then": {
475
+ "required": [
476
+ "attribute_id"
477
+ ]
478
+ }
307
479
  }
308
480
  ]
309
481
  },
310
- "salesUnit": {
482
+ "sales_unit": {
311
483
  "type": "object",
312
- "required": ["requested_unit", "sell_unit", "quantity_per_sell_unit", "rounding"],
484
+ "required": [
485
+ "requested_unit",
486
+ "sell_unit",
487
+ "quantity_per_sell_unit",
488
+ "rounding"
489
+ ],
313
490
  "additionalProperties": false,
314
491
  "patternProperties": {
315
492
  "^x-": true
316
493
  },
317
494
  "properties": {
318
- "requested_unit": { "type": "string", "minLength": 1 },
319
- "sell_unit": { "type": "string", "minLength": 1 },
320
- "quantity_per_sell_unit": { "type": "number", "exclusiveMinimum": 0 },
321
- "rounding": { "type": "string", "enum": ["CEIL"] },
322
- "min_sell_units": { "type": "integer", "minimum": 1 }
495
+ "requested_unit": {
496
+ "type": "string",
497
+ "minLength": 1
498
+ },
499
+ "sell_unit": {
500
+ "type": "string",
501
+ "minLength": 1
502
+ },
503
+ "quantity_per_sell_unit": {
504
+ "type": "number",
505
+ "exclusiveMinimum": 0
506
+ },
507
+ "rounding": {
508
+ "type": "string",
509
+ "enum": [
510
+ "CEIL",
511
+ "FLOOR",
512
+ "ROUND",
513
+ "HALF_UP"
514
+ ]
515
+ },
516
+ "min_sell_units": {
517
+ "type": "integer",
518
+ "minimum": 1
519
+ }
323
520
  }
324
521
  },
325
- "attributeRef": {
522
+ "attribute_ref": {
326
523
  "type": "object",
327
- "required": ["id"],
524
+ "required": [
525
+ "id"
526
+ ],
328
527
  "additionalProperties": false,
329
528
  "patternProperties": {
330
529
  "^x-": true
331
530
  },
332
531
  "properties": {
333
- "id": { "type": "string", "minLength": 1 },
334
- "label": { "type": "string" }
532
+ "id": {
533
+ "type": "string",
534
+ "minLength": 1
535
+ },
536
+ "label": {
537
+ "type": "string"
538
+ }
335
539
  }
336
540
  },
337
- "attributeValue": {
541
+ "attribute_value": {
338
542
  "type": "object",
339
- "required": ["attributeId", "value"],
543
+ "required": [
544
+ "attribute_id",
545
+ "value"
546
+ ],
340
547
  "additionalProperties": false,
341
548
  "patternProperties": {
342
549
  "^x-": true
343
550
  },
344
551
  "properties": {
345
- "attributeId": { "type": "string", "minLength": 1 },
346
- "label": { "type": "string" },
347
- "value": { "$ref": "#/$defs/scalarValue" }
552
+ "attribute_id": {
553
+ "type": "string",
554
+ "minLength": 1
555
+ },
556
+ "label": {
557
+ "type": "string"
558
+ },
559
+ "value": {
560
+ "$ref": "#/$defs/scalar_value"
561
+ }
348
562
  }
349
563
  },
350
564
  "option": {
351
565
  "type": "object",
352
- "required": ["id", "attributeId", "value"],
566
+ "required": [
567
+ "id",
568
+ "attribute_id",
569
+ "value"
570
+ ],
353
571
  "additionalProperties": false,
354
572
  "patternProperties": {
355
573
  "^x-": true
356
574
  },
357
575
  "properties": {
358
- "id": { "type": "string", "minLength": 1 },
359
- "attributeId": { "type": "string", "minLength": 1 },
360
- "label": { "type": "string" },
361
- "value": { "$ref": "#/$defs/scalarValue" }
576
+ "id": {
577
+ "type": "string",
578
+ "minLength": 1
579
+ },
580
+ "attribute_id": {
581
+ "type": "string",
582
+ "minLength": 1
583
+ },
584
+ "label": {
585
+ "type": "string"
586
+ },
587
+ "value": {
588
+ "$ref": "#/$defs/scalar_value"
589
+ },
590
+ "images": {
591
+ "type": "array",
592
+ "items": {
593
+ "$ref": "#/$defs/image"
594
+ }
595
+ }
362
596
  }
363
597
  },
364
598
  "ruleset": {
365
599
  "type": "object",
366
- "required": ["id", "target", "rules"],
600
+ "required": [
601
+ "id",
602
+ "target",
603
+ "rules"
604
+ ],
367
605
  "additionalProperties": false,
368
606
  "patternProperties": {
369
607
  "^x-": true
370
608
  },
371
609
  "properties": {
372
- "id": { "type": "string", "minLength": 1 },
610
+ "id": {
611
+ "type": "string",
612
+ "minLength": 1
613
+ },
373
614
  "target": {
374
615
  "type": "string",
375
- "enum": ["BASE", "SUBTOTAL", "TOTAL"]
616
+ "enum": [
617
+ "BASE",
618
+ "SUBTOTAL",
619
+ "TOTAL"
620
+ ]
376
621
  },
377
622
  "rules": {
378
623
  "type": "array",
379
- "items": { "$ref": "#/$defs/rule" }
624
+ "items": {
625
+ "$ref": "#/$defs/rule"
626
+ }
380
627
  }
381
628
  }
382
629
  },
383
630
  "rule": {
384
631
  "type": "object",
385
- "required": ["id", "operation"],
632
+ "required": [
633
+ "id",
634
+ "operation"
635
+ ],
386
636
  "additionalProperties": false,
387
637
  "patternProperties": {
388
638
  "^x-": true
389
639
  },
390
640
  "properties": {
391
- "id": { "type": "string", "minLength": 1 },
392
- "priority": { "type": "integer" },
393
- "enabled": { "type": "boolean" },
394
- "when": { "$ref": "#/$defs/condition" },
641
+ "id": {
642
+ "type": "string",
643
+ "minLength": 1
644
+ },
645
+ "priority": {
646
+ "type": "integer"
647
+ },
648
+ "enabled": {
649
+ "type": "boolean"
650
+ },
651
+ "when": {
652
+ "$ref": "#/$defs/condition"
653
+ },
395
654
  "operation": {
396
655
  "type": "string",
397
- "enum": ["ADD", "PERCENT_OF", "OVERRIDE", "LOOKUP", "MAX_OF", "MIN_OF", "PICK", "ROUND", "CAP", "FLOOR"]
656
+ "enum": [
657
+ "ADD",
658
+ "PERCENT_OF",
659
+ "OVERRIDE",
660
+ "LOOKUP",
661
+ "MAX_OF",
662
+ "MIN_OF",
663
+ "PICK",
664
+ "ROUND",
665
+ "CAP",
666
+ "FLOOR"
667
+ ]
668
+ },
669
+ "value": {
670
+ "type": "number"
671
+ },
672
+ "percent": {
673
+ "type": "number"
674
+ },
675
+ "table_id": {
676
+ "type": "string",
677
+ "minLength": 1
398
678
  },
399
- "value": { "type": "number" },
400
- "percent": { "type": "number" },
401
- "tableId": { "type": "string", "minLength": 1 },
402
679
  "components": {
403
680
  "type": "array",
404
- "items": { "$ref": "#/$defs/component" }
405
- },
406
- "precision": { "type": "integer", "minimum": 0 },
407
- "max": { "type": "number" },
408
- "min": { "type": "number" },
409
- "fallback": { "type": "number" },
410
- "optionId": { "type": "string" },
411
- "optionIds": {
681
+ "items": {
682
+ "$ref": "#/$defs/component"
683
+ }
684
+ },
685
+ "precision": {
686
+ "type": "integer",
687
+ "minimum": 0
688
+ },
689
+ "max": {
690
+ "type": "number"
691
+ },
692
+ "min": {
693
+ "type": "number"
694
+ },
695
+ "fallback": {
696
+ "type": "number"
697
+ },
698
+ "option_id": {
699
+ "type": "string"
700
+ },
701
+ "option_ids": {
412
702
  "type": "array",
413
- "items": { "type": "string" }
703
+ "items": {
704
+ "type": "string"
705
+ }
414
706
  }
415
707
  },
416
708
  "allOf": [
417
709
  {
418
- "if": { "properties": { "operation": { "const": "ADD" } } },
419
- "then": { "required": ["value"] }
710
+ "if": {
711
+ "properties": {
712
+ "operation": {
713
+ "const": "ADD"
714
+ }
715
+ }
716
+ },
717
+ "then": {
718
+ "required": [
719
+ "value"
720
+ ]
721
+ }
420
722
  },
421
723
  {
422
- "if": { "properties": { "operation": { "const": "PERCENT_OF" } } },
423
- "then": { "required": ["percent"] }
724
+ "if": {
725
+ "properties": {
726
+ "operation": {
727
+ "const": "PERCENT_OF"
728
+ }
729
+ }
730
+ },
731
+ "then": {
732
+ "required": [
733
+ "percent"
734
+ ]
735
+ }
424
736
  },
425
737
  {
426
- "if": { "properties": { "operation": { "const": "OVERRIDE" } } },
427
- "then": { "required": ["value"] }
738
+ "if": {
739
+ "properties": {
740
+ "operation": {
741
+ "const": "OVERRIDE"
742
+ }
743
+ }
744
+ },
745
+ "then": {
746
+ "required": [
747
+ "value"
748
+ ]
749
+ }
428
750
  },
429
751
  {
430
- "if": { "properties": { "operation": { "const": "LOOKUP" } } },
431
- "then": { "required": ["tableId"] }
752
+ "if": {
753
+ "properties": {
754
+ "operation": {
755
+ "const": "LOOKUP"
756
+ }
757
+ }
758
+ },
759
+ "then": {
760
+ "required": [
761
+ "table_id"
762
+ ]
763
+ }
432
764
  },
433
765
  {
434
- "if": { "properties": { "operation": { "enum": ["MAX_OF", "MIN_OF", "PICK"] } } },
435
- "then": { "required": ["components"] }
766
+ "if": {
767
+ "properties": {
768
+ "operation": {
769
+ "enum": [
770
+ "MAX_OF",
771
+ "MIN_OF",
772
+ "PICK"
773
+ ]
774
+ }
775
+ }
776
+ },
777
+ "then": {
778
+ "required": [
779
+ "components"
780
+ ]
781
+ }
436
782
  },
437
783
  {
438
- "if": { "properties": { "operation": { "const": "ROUND" } } },
439
- "then": { "required": ["precision"] }
784
+ "if": {
785
+ "properties": {
786
+ "operation": {
787
+ "const": "ROUND"
788
+ }
789
+ }
790
+ },
791
+ "then": {
792
+ "required": [
793
+ "precision"
794
+ ]
795
+ }
440
796
  },
441
797
  {
442
- "if": { "properties": { "operation": { "const": "CAP" } } },
443
- "then": { "required": ["max"] }
798
+ "if": {
799
+ "properties": {
800
+ "operation": {
801
+ "const": "CAP"
802
+ }
803
+ }
804
+ },
805
+ "then": {
806
+ "required": [
807
+ "max"
808
+ ]
809
+ }
444
810
  },
445
811
  {
446
- "if": { "properties": { "operation": { "const": "FLOOR" } } },
447
- "then": { "required": ["min"] }
812
+ "if": {
813
+ "properties": {
814
+ "operation": {
815
+ "const": "FLOOR"
816
+ }
817
+ }
818
+ },
819
+ "then": {
820
+ "required": [
821
+ "min"
822
+ ]
823
+ }
448
824
  }
449
825
  ]
450
826
  },
@@ -455,14 +831,30 @@
455
831
  "^x-": true
456
832
  },
457
833
  "properties": {
458
- "label": { "type": "string" },
459
- "value": { "type": "number" },
460
- "tableId": { "type": "string" },
461
- "optionId": { "type": "string" }
834
+ "label": {
835
+ "type": "string"
836
+ },
837
+ "value": {
838
+ "type": "number"
839
+ },
840
+ "table_id": {
841
+ "type": "string"
842
+ },
843
+ "option_id": {
844
+ "type": "string"
845
+ }
462
846
  },
463
847
  "anyOf": [
464
- { "required": ["value"] },
465
- { "required": ["tableId"] }
848
+ {
849
+ "required": [
850
+ "value"
851
+ ]
852
+ },
853
+ {
854
+ "required": [
855
+ "table_id"
856
+ ]
857
+ }
466
858
  ]
467
859
  },
468
860
  "condition": {
@@ -471,94 +863,150 @@
471
863
  "patternProperties": {
472
864
  "^x-": true
473
865
  },
866
+ "anyOf": [
867
+ {
868
+ "required": [
869
+ "all"
870
+ ]
871
+ },
872
+ {
873
+ "required": [
874
+ "any"
875
+ ]
876
+ }
877
+ ],
474
878
  "properties": {
475
879
  "all": {
476
880
  "type": "array",
477
- "items": { "$ref": "#/$defs/predicate" }
881
+ "items": {
882
+ "$ref": "#/$defs/predicate"
883
+ }
478
884
  },
479
885
  "any": {
480
886
  "type": "array",
481
- "items": { "$ref": "#/$defs/predicate" }
887
+ "items": {
888
+ "$ref": "#/$defs/predicate"
889
+ }
482
890
  }
483
891
  }
484
892
  },
485
893
  "predicate": {
486
894
  "type": "object",
487
- "required": ["fact", "operator"],
895
+ "required": [
896
+ "fact",
897
+ "operator"
898
+ ],
488
899
  "additionalProperties": false,
489
900
  "patternProperties": {
490
901
  "^x-": true
491
902
  },
492
903
  "properties": {
493
- "fact": { "type": "string" },
904
+ "fact": {
905
+ "type": "string"
906
+ },
494
907
  "operator": {
495
908
  "type": "string",
496
- "enum": ["EQ", "NEQ", "IN", "NOT_IN", "GT", "GTE", "LT", "LTE", "EXISTS"]
909
+ "enum": [
910
+ "EQ",
911
+ "NEQ",
912
+ "IN",
913
+ "NOT_IN",
914
+ "GT",
915
+ "GTE",
916
+ "LT",
917
+ "LTE",
918
+ "EXISTS"
919
+ ]
920
+ },
921
+ "value": {
922
+ "$ref": "#/$defs/scalar_value"
497
923
  },
498
- "value": { "$ref": "#/$defs/scalarValue" },
499
924
  "values": {
500
925
  "type": "array",
501
- "items": { "$ref": "#/$defs/scalarValue" }
926
+ "items": {
927
+ "$ref": "#/$defs/scalar_value"
928
+ }
502
929
  }
503
930
  }
504
931
  },
505
932
  "table": {
506
933
  "type": "object",
507
- "required": ["id", "type", "dimensions", "rows"],
934
+ "required": [
935
+ "id",
936
+ "type",
937
+ "dimensions",
938
+ "rows"
939
+ ],
508
940
  "additionalProperties": false,
509
941
  "patternProperties": {
510
942
  "^x-": true
511
943
  },
512
944
  "properties": {
513
- "id": { "type": "string", "minLength": 1 },
514
- "type": { "type": "string", "enum": ["LOOKUP"] },
515
- "keys": {
516
- "type": "array",
517
- "items": {
518
- "anyOf": [
519
- { "type": "string" },
520
- {
521
- "type": "object",
522
- "additionalProperties": false,
523
- "properties": {
524
- "optionId": { "type": "string" },
525
- "id": { "type": "string" },
526
- "name": { "type": "string" }
527
- }
528
- }
529
- ]
530
- }
945
+ "id": {
946
+ "type": "string",
947
+ "minLength": 1
948
+ },
949
+ "type": {
950
+ "type": "string",
951
+ "enum": [
952
+ "LOOKUP"
953
+ ]
531
954
  },
532
955
  "dimensions": {
533
956
  "type": "array",
534
957
  "minItems": 1,
535
- "items": { "$ref": "#/$defs/dimension" }
958
+ "items": {
959
+ "$ref": "#/$defs/lookup_axis"
960
+ }
536
961
  },
537
962
  "rows": {
538
963
  "type": "array",
539
964
  "minItems": 1,
540
- "items": { "$ref": "#/$defs/tableRow" }
965
+ "items": {
966
+ "$ref": "#/$defs/table_row"
967
+ }
541
968
  }
542
969
  }
543
970
  },
544
- "dimension": {
971
+ "lookup_axis": {
545
972
  "type": "object",
546
- "required": ["key", "source"],
973
+ "required": [
974
+ "key",
975
+ "source"
976
+ ],
547
977
  "additionalProperties": false,
548
978
  "patternProperties": {
549
979
  "^x-": true
550
980
  },
551
981
  "properties": {
552
- "key": { "type": "string" },
553
- "source": { "type": "string", "enum": ["ATTRIBUTE", "CONTEXT", "LITERAL"] },
554
- "attributeId": { "type": "string" },
555
- "contextKey": { "type": "string" },
556
- "literal": { "$ref": "#/$defs/scalarValue" }
982
+ "key": {
983
+ "type": "string"
984
+ },
985
+ "source": {
986
+ "type": "string",
987
+ "enum": [
988
+ "ATTRIBUTE",
989
+ "CONTEXT",
990
+ "LITERAL"
991
+ ]
992
+ },
993
+ "attribute_id": {
994
+ "type": "string"
995
+ },
996
+ "context_key": {
997
+ "type": "string"
998
+ },
999
+ "literal": {
1000
+ "$ref": "#/$defs/scalar_value"
1001
+ }
557
1002
  }
558
1003
  },
559
- "tableRow": {
1004
+ "table_row": {
560
1005
  "type": "object",
561
- "required": ["key", "value"],
1006
+ "required": [
1007
+ "key",
1008
+ "value"
1009
+ ],
562
1010
  "additionalProperties": false,
563
1011
  "patternProperties": {
564
1012
  "^x-": true
@@ -566,97 +1014,227 @@
566
1014
  "properties": {
567
1015
  "key": {
568
1016
  "type": "object",
569
- "additionalProperties": { "$ref": "#/$defs/scalarValue" }
1017
+ "additionalProperties": {
1018
+ "$ref": "#/$defs/scalar_value"
1019
+ }
570
1020
  },
571
- "value": { "type": "number" }
1021
+ "value": {
1022
+ "type": "number"
1023
+ }
572
1024
  }
573
1025
  },
574
1026
  "dependency": {
575
1027
  "type": "object",
576
- "required": ["id", "type"],
1028
+ "required": [
1029
+ "id",
1030
+ "type"
1031
+ ],
577
1032
  "additionalProperties": false,
578
1033
  "patternProperties": {
579
1034
  "^x-": true
580
1035
  },
581
1036
  "properties": {
582
- "id": { "type": "string", "minLength": 1 },
583
- "type": { "type": "string", "enum": ["REQUIRES", "IMPLIES", "AVAILABLE_OPTIONS_WHEN"] },
584
- "productId": { "type": "string" },
585
- "optionId": { "type": "string" },
586
- "requiresOptionIds": {
1037
+ "id": {
1038
+ "type": "string",
1039
+ "minLength": 1
1040
+ },
1041
+ "type": {
1042
+ "type": "string",
1043
+ "enum": [
1044
+ "REQUIRES",
1045
+ "IMPLIES",
1046
+ "AVAILABLE_OPTIONS_WHEN"
1047
+ ]
1048
+ },
1049
+ "product_id": {
1050
+ "type": "string"
1051
+ },
1052
+ "option_id": {
1053
+ "type": "string"
1054
+ },
1055
+ "requires_option_ids": {
587
1056
  "type": "array",
588
- "items": { "type": "string" }
1057
+ "items": {
1058
+ "type": "string"
1059
+ }
589
1060
  },
590
- "allowedOptionIds": {
1061
+ "allowed_option_ids": {
591
1062
  "type": "array",
592
- "items": { "type": "string" }
1063
+ "items": {
1064
+ "type": "string"
1065
+ }
593
1066
  },
594
- "when": { "$ref": "#/$defs/condition" }
595
- }
1067
+ "when": {
1068
+ "$ref": "#/$defs/condition"
1069
+ }
1070
+ },
1071
+ "allOf": [
1072
+ {
1073
+ "if": {
1074
+ "properties": {
1075
+ "type": {
1076
+ "const": "REQUIRES"
1077
+ }
1078
+ }
1079
+ },
1080
+ "then": {
1081
+ "required": [
1082
+ "option_id",
1083
+ "requires_option_ids"
1084
+ ]
1085
+ }
1086
+ },
1087
+ {
1088
+ "if": {
1089
+ "properties": {
1090
+ "type": {
1091
+ "const": "AVAILABLE_OPTIONS_WHEN"
1092
+ }
1093
+ }
1094
+ },
1095
+ "then": {
1096
+ "required": [
1097
+ "allowed_option_ids",
1098
+ "when"
1099
+ ]
1100
+ }
1101
+ }
1102
+ ]
596
1103
  },
597
1104
  "constraint": {
598
1105
  "type": "object",
599
- "required": ["id", "type", "when", "message"],
1106
+ "required": [
1107
+ "id",
1108
+ "type",
1109
+ "when",
1110
+ "message"
1111
+ ],
600
1112
  "additionalProperties": false,
601
1113
  "patternProperties": {
602
1114
  "^x-": true
603
1115
  },
604
1116
  "properties": {
605
- "id": { "type": "string", "minLength": 1 },
606
- "type": { "type": "string", "enum": ["DENY"] },
607
- "productId": { "type": "string" },
608
- "optionIds": {
1117
+ "id": {
1118
+ "type": "string",
1119
+ "minLength": 1
1120
+ },
1121
+ "type": {
1122
+ "type": "string",
1123
+ "enum": [
1124
+ "DENY"
1125
+ ]
1126
+ },
1127
+ "product_id": {
1128
+ "type": "string"
1129
+ },
1130
+ "option_ids": {
609
1131
  "type": "array",
610
- "items": { "type": "string" }
1132
+ "items": {
1133
+ "type": "string"
1134
+ }
611
1135
  },
612
- "when": { "$ref": "#/$defs/condition" },
613
- "message": { "type": "string", "minLength": 1 }
1136
+ "when": {
1137
+ "$ref": "#/$defs/condition"
1138
+ },
1139
+ "message": {
1140
+ "type": "string",
1141
+ "minLength": 1
1142
+ }
614
1143
  }
615
1144
  },
616
- "imageRef": {
1145
+ "image": {
617
1146
  "type": "object",
618
- "required": ["url"],
1147
+ "required": [
1148
+ "url"
1149
+ ],
619
1150
  "additionalProperties": false,
620
1151
  "patternProperties": {
621
1152
  "^x-": true
622
1153
  },
623
1154
  "properties": {
624
- "url": { "type": "string", "format": "uri" },
625
- "label": { "type": "string" },
1155
+ "url": {
1156
+ "type": "string",
1157
+ "format": "uri"
1158
+ },
1159
+ "label": {
1160
+ "type": "string"
1161
+ },
1162
+ "alt": {
1163
+ "type": "string",
1164
+ "description": "Texto alternativo descritivo da imagem (acessibilidade)."
1165
+ },
1166
+ "position": {
1167
+ "type": "integer",
1168
+ "minimum": 0,
1169
+ "description": "Ordem explícita de exibição; quando presente, consumidores DEVEM ordenar por position crescente."
1170
+ },
626
1171
  "type": {
627
1172
  "type": "string",
628
- "enum": ["MAIN", "DETAIL", "AMBIANCE", "TECHNICAL", "OTHER"]
1173
+ "enum": [
1174
+ "MAIN",
1175
+ "DETAIL",
1176
+ "AMBIANCE",
1177
+ "TECHNICAL",
1178
+ "OTHER"
1179
+ ]
629
1180
  }
630
1181
  }
631
1182
  },
632
1183
  "measure": {
633
1184
  "type": "object",
634
- "required": ["value", "unit"],
1185
+ "required": [
1186
+ "value",
1187
+ "unit"
1188
+ ],
635
1189
  "additionalProperties": false,
636
1190
  "patternProperties": {
637
1191
  "^x-": true
638
1192
  },
639
1193
  "properties": {
640
- "value": { "type": "number", "exclusiveMinimum": 0 },
641
- "unit": { "type": "string", "minLength": 1 }
1194
+ "value": {
1195
+ "type": "number",
1196
+ "exclusiveMinimum": 0
1197
+ },
1198
+ "unit": {
1199
+ "type": "string",
1200
+ "minLength": 1
1201
+ }
642
1202
  }
643
1203
  },
644
- "dimensionsObj": {
1204
+ "physical_dimensions": {
645
1205
  "type": "object",
646
- "required": ["unit"],
1206
+ "required": [
1207
+ "unit"
1208
+ ],
647
1209
  "additionalProperties": false,
648
1210
  "patternProperties": {
649
1211
  "^x-": true
650
1212
  },
651
1213
  "properties": {
652
- "width": { "type": "number", "exclusiveMinimum": 0 },
653
- "height": { "type": "number", "exclusiveMinimum": 0 },
654
- "depth": { "type": "number", "exclusiveMinimum": 0 },
655
- "unit": { "type": "string", "minLength": 1 }
1214
+ "width": {
1215
+ "type": "number",
1216
+ "exclusiveMinimum": 0
1217
+ },
1218
+ "height": {
1219
+ "type": "number",
1220
+ "exclusiveMinimum": 0
1221
+ },
1222
+ "depth": {
1223
+ "type": "number",
1224
+ "exclusiveMinimum": 0
1225
+ },
1226
+ "unit": {
1227
+ "type": "string",
1228
+ "minLength": 1
1229
+ }
656
1230
  }
657
1231
  },
658
- "scalarValue": {
659
- "type": ["string", "number", "boolean"]
1232
+ "scalar_value": {
1233
+ "type": [
1234
+ "string",
1235
+ "number",
1236
+ "boolean"
1237
+ ]
660
1238
  }
661
1239
  }
662
1240
  }