Coverage for packages/clopos/src/integrify/clopos/schemas/common/object.py: 100%
144 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-19 02:39 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-19 02:39 +0000
1from decimal import Decimal
2from typing import Literal
4from integrify.clopos.schemas.enums import ProductType
5from integrify.utils import UnsetOrNoneField
6from pydantic import BaseModel, Field
9class Timestamp(BaseModel):
10 created_at: str
11 """The timestamp when the object was created"""
13 updated_at: str
14 """The timestamp when the object was last updated"""
16 deleted_at: UnsetOrNoneField[str]
17 """The timestamp when the object was deleted"""
20class Balance(Timestamp):
21 id: int
22 """Balance ID"""
24 system_type: UnsetOrNoneField[str]
25 """The system type of the balance"""
27 venue_id: UnsetOrNoneField[int]
28 """The ID of the venue the balance belongs to"""
30 name: UnsetOrNoneField[str]
31 """The name of the balance"""
33 description: UnsetOrNoneField[str]
34 """The description of the balance"""
36 type: str
37 """Balance type"""
39 amount: Decimal
40 """The balance amount"""
42 position: int
43 """The position of the balance"""
46class CashbackBalance(BaseModel):
47 name: UnsetOrNoneField[str]
48 """The name of the balance"""
50 type: str
51 """Balance type"""
53 amount: Decimal
54 """The balance amount"""
57class Image(BaseModel):
58 original: UnsetOrNoneField[str]
59 """The original image URL"""
61 large: UnsetOrNoneField[str]
62 """The large image URL"""
64 extra_large: UnsetOrNoneField[str]
65 """The extra large image URL"""
67 thumb: UnsetOrNoneField[str]
68 """The thumbnail image URL"""
70 blur_hash: UnsetOrNoneField[str]
71 """The blur hash of the image"""
74class Media(BaseModel):
75 uuid: UnsetOrNoneField[str]
76 """The UUID of the media"""
78 mime_type: UnsetOrNoneField[str]
79 """The MIME type of the media"""
81 size: UnsetOrNoneField[int]
82 """The size of the media in bytes"""
84 urls: Image
85 """The image URLs of the media"""
87 blur_hash: UnsetOrNoneField[str]
88 """The blur hash of the media"""
90 dimensions: UnsetOrNoneField[dict]
91 """The dimensions of the media"""
94class Variant(BaseModel):
95 """List of product variants (for GOODS)"""
97 id: int
98 """Modification ID"""
100 parent_id: UnsetOrNoneField[int]
101 """The identifier of the parent product"""
103 type: Literal[ProductType.MODIFICATION]
104 """Modification type"""
106 name: str
107 """The name of the variant (e.g., "0.5 L")"""
109 price: Decimal
110 """The sales price of the variant"""
112 cost_price: Decimal
113 """The cost price of the variant"""
115 barcode: UnsetOrNoneField[str]
116 """The barcode of the variant"""
118 full_name: UnsetOrNoneField[str]
119 """The full name of the variant"""
121 status: int
122 """The status of the variant (1: Active, 0: Inactive)"""
125class Modifier(BaseModel):
126 id: int
127 """The modifier's identifier"""
129 name: str
130 """The name of the modifier (e.g., "Spicy")"""
132 price: Decimal
133 """The sales price of the modifier"""
135 ingredient: UnsetOrNoneField[dict]
136 """If the modifier is linked to an ingredient, contains ingredient information"""
139class ModifierGroup(Timestamp):
140 """List of modifier groups (for DISH)"""
142 id: int
143 """The group's identifier"""
145 name: str
146 """The name of the group (e.g., "Spice Level")"""
148 type: int
149 """Selection rule (1: Single-choice, 0: Multi-choice)"""
151 min_select: int
152 """Minimum number of selections"""
154 max_select: int
155 """Maximum number of selections"""
157 modifiers: UnsetOrNoneField[list[Modifier]]
158 """The modifiers in the group"""
160 adjust_to_portion: bool
161 """Whether the group is adjusted to the portion size"""
163 status: UnsetOrNoneField[bool]
164 """The status of the group"""
166 meta: UnsetOrNoneField[dict]
167 """The metadata of the group"""
169 pivot: UnsetOrNoneField[dict]
170 """The pivot information of the group"""
173class Package(BaseModel):
174 """List of purchasing packages (for INGREDIENT)"""
176 id: int
177 """The package’s identifier"""
179 name: str
180 """The name of the package (e.g., “Bundle 10 pcs”)"""
182 equal: int
183 """The number of base units contained in the package"""
186class Tax(BaseModel):
187 id: int
188 """Tax ID"""
190 name: str
191 """Tax name"""
193 rate: Decimal
194 """Tax rate"""
197class Price(BaseModel):
198 price: Decimal
199 """Price"""
201 from_: UnsetOrNoneField[int] = Field(alias='from')
202 """From which period"""
204 venue_id: UnsetOrNoneField[int]
205 """The venue ID"""
208class TimerSetting(BaseModel):
209 interval: int
210 """The pricing interval in minutes"""
212 prices: list[Price]
213 """List of prices by intervals"""
216class Service(BaseModel):
217 sale_type_id: UnsetOrNoneField[int]
218 """The sale type ID"""
220 sale_type_name: UnsetOrNoneField[str]
221 """The name of the sale type"""
223 venue_id: UnsetOrNoneField[int]
224 """The venue ID"""
226 venue_name: UnsetOrNoneField[str]
227 """The name of the venue"""