|
1
|
import { z } from "zod" |
|
2
|
|
|
3
|
const PriceListCustomerGroupSchema = z.object({ |
|
4
|
id: z.string(), |
|
5
|
name: z.string(), |
|
6
|
}) |
|
7
|
|
|
8
|
export type PriceListCustomerGroup = z.infer< |
|
9
|
typeof PriceListCustomerGroupSchema |
|
10
|
> |
|
11
|
|
|
12
|
export const PriceListRulesSchema = z.object({ |
|
13
|
customer_group_id: z.array(PriceListCustomerGroupSchema).nullish(), |
|
14
|
}) |
|
15
|
|
|
16
|
export const PriceListCreateCurrencyPriceSchema = z.object({ |
|
17
|
amount: z.string().or(z.number()).optional(), |
|
18
|
min_quantity: z.string().or(z.number()).optional(), |
|
19
|
max_quantity: z.string().or(z.number()).optional(), |
|
20
|
}) |
|
21
|
|
|
22
|
export type PriceListCreateCurrencyPrice = z.infer< |
|
23
|
typeof PriceListCreateCurrencyPriceSchema |
|
24
|
> |
|
25
|
|
|
26
|
export const PriceListCreateRegionPriceSchema = z.object({ |
|
27
|
amount: z.string().or(z.number()).optional(), |
|
28
|
min_quantity: z.string().or(z.number()).optional(), |
|
29
|
max_quantity: z.string().or(z.number()).optional(), |
|
30
|
}) |
|
31
|
|
|
32
|
export type PriceListCreateRegionPriceSchema = z.infer< |
|
33
|
typeof PriceListCreateRegionPriceSchema |
|
34
|
> |
|
35
|
|
|
36
|
const PriceListCreateProductVariantSchema = z.object({ |
|
37
|
currency_prices: z.record( |
|
38
|
z.string(), |
|
39
|
z.array(PriceListCreateCurrencyPriceSchema).optional() |
|
40
|
), |
|
41
|
region_prices: z.record( |
|
42
|
z.string(), |
|
43
|
z.array(PriceListCreateRegionPriceSchema).optional() |
|
44
|
), |
|
45
|
conditional_currency_prices: z |
|
46
|
.record(z.string(), z.array(PriceListCreateCurrencyPriceSchema).optional()) |
|
47
|
.optional(), |
|
48
|
conditional_region_prices: z |
|
49
|
.record(z.string(), z.array(PriceListCreateRegionPriceSchema).optional()) |
|
50
|
.optional(), |
|
51
|
}) |
|
52
|
|
|
53
|
export type PriceListCreateProductVariantSchema = z.infer< |
|
54
|
typeof PriceListCreateProductVariantSchema |
|
55
|
> |
|
56
|
|
|
57
|
const PriceListCreateProductVariantsSchema = z.record( |
|
58
|
z.string(), |
|
59
|
PriceListCreateProductVariantSchema |
|
60
|
) |
|
61
|
|
|
62
|
export type PriceListCreateProductVariantsSchema = z.infer< |
|
63
|
typeof PriceListCreateProductVariantsSchema |
|
64
|
> |
|
65
|
|
|
66
|
export const PriceListCreateProductsSchema = z.record( |
|
67
|
z.string(), |
|
68
|
z.object({ |
|
69
|
variants: PriceListCreateProductVariantsSchema, |
|
70
|
}) |
|
71
|
) |
|
72
|
|
|
73
|
export type PriceListCreateProductsSchema = z.infer< |
|
74
|
typeof PriceListCreateProductsSchema |
|
75
|
> |
|
76
|
|
|
77
|
export const PriceListUpdateCurrencyPriceSchema = z.object({ |
|
78
|
amount: z.string().or(z.number()).optional(), |
|
79
|
min_quantity: z.string().or(z.number()).optional(), |
|
80
|
max_quantity: z.string().or(z.number()).optional(), |
|
81
|
id: z.string().nullish(), |
|
82
|
}) |
|
83
|
|
|
84
|
export type PriceListUpdateCurrencyPrice = z.infer< |
|
85
|
typeof PriceListUpdateCurrencyPriceSchema |
|
86
|
> |
|
87
|
|
|
88
|
export const PriceListUpdateRegionPriceSchema = z.object({ |
|
89
|
amount: z.string().or(z.number()).optional(), |
|
90
|
min_quantity: z.string().or(z.number()).optional(), |
|
91
|
max_quantity: z.string().or(z.number()).optional(), |
|
92
|
id: z.string().nullish(), |
|
93
|
}) |
|
94
|
|
|
95
|
export type PriceListUpdateRegionPrice = z.infer< |
|
96
|
typeof PriceListUpdateRegionPriceSchema |
|
97
|
> |
|
98
|
|
|
99
|
export const PriceListUpdateProductVariantsSchema = z.record( |
|
100
|
z.string(), |
|
101
|
z.object({ |
|
102
|
currency_prices: z.record( |
|
103
|
z.string(), |
|
104
|
z.array(PriceListUpdateCurrencyPriceSchema).optional() |
|
105
|
), |
|
106
|
region_prices: z.record( |
|
107
|
z.string(), |
|
108
|
z.array(PriceListUpdateRegionPriceSchema).optional() |
|
109
|
), |
|
110
|
conditional_currency_prices: z |
|
111
|
.record( |
|
112
|
z.string(), |
|
113
|
z.array(PriceListUpdateCurrencyPriceSchema).optional() |
|
114
|
) |
|
115
|
.optional(), |
|
116
|
conditional_region_prices: z |
|
117
|
.record(z.string(), z.array(PriceListUpdateRegionPriceSchema).optional()) |
|
118
|
.optional(), |
|
119
|
}) |
|
120
|
) |
|
121
|
|
|
122
|
export type PriceListUpdateProductVariantsSchema = z.infer< |
|
123
|
typeof PriceListUpdateProductVariantsSchema |
|
124
|
> |
|
125
|
|
|
126
|
export const PriceListUpdateProductsSchema = z.record( |
|
127
|
z.string(), |
|
128
|
z.object({ |
|
129
|
variants: PriceListUpdateProductVariantsSchema, |
|
130
|
}) |
|
131
|
) |
|
132
|
|
|
133
|
export type PriceListUpdateProductsSchema = z.infer< |
|
134
|
typeof PriceListUpdateProductsSchema |
|
135
|
> |