@@ -37,6 +37,13 @@ class PaymentMethodEnum(str, Enum):
3737 WALLET = "wallet"
3838
3939
40+ class City (BaseModel ):
41+ """City model."""
42+ id : Optional [int ] = None
43+ title : Optional [str ] = None
44+ parent : Optional ['City' ] = None
45+
46+
4047class Address (BaseModel ):
4148 """Address information."""
4249 id : int
@@ -160,20 +167,6 @@ class OrderTrackingResponse(BaseModel):
160167 estimated_delivery : Optional [datetime ] = None
161168 last_updated : Optional [datetime ] = None
162169
163-
164- class ValidationError (BaseModel ):
165- """Validation error model."""
166- location : str = Field (..., description = "Error location" )
167- message : str = Field (..., description = "Error message" )
168- type : str = Field (..., description = "Error type" )
169-
170-
171- class HTTPValidationError (BaseModel ):
172- """HTTP validation error model."""
173- message : Optional [str ] = Field (None , description = "Error message" )
174- errors : Optional [List [ValidationError ]] = Field (None , description = "List of validation errors" )
175-
176-
177170class OrderEnum (str , Enum ):
178171 """OrderEnum enum."""
179172 ASC = "ASC"
@@ -214,28 +207,196 @@ class PaymentVerifyRequestModel(BaseModel):
214207 description : Optional [str ] = None
215208
216209
217- class BasketItem (BaseModel ):
218- """Basket item model."""
219- id : int = Field (..., description = "Item ID" )
220- product_id : int = Field (..., description = "Product ID" )
221- variation_id : Optional [int ] = Field (None , description = "Variation ID" )
222- quantity : int = Field (..., description = "Quantity" )
223- price : int = Field (..., description = "Price" )
224- total_price : int = Field (..., description = "Total price" )
225- product_name : str = Field (..., description = "Product name" )
226- product_image : Optional [str ] = Field (None , description = "Product image URL" )
227- vendor_id : int = Field (..., description = "Vendor ID" )
228- vendor_name : str = Field (..., description = "Vendor name" )
229- created_at : datetime = Field (..., description = "Creation timestamp" )
230- updated_at : datetime = Field (..., description = "Last update timestamp" )
210+ # Basket Models - Updated for new structure
211+
212+ class CostBreakdown (BaseModel ):
213+ """Cost breakdown model."""
214+ base : Optional [int ] = None
215+ discount : Optional [int ] = None
216+ grand : Optional [int ] = None
217+
218+
219+ class TotalCostBreakdown (BaseModel ):
220+ """Total cost breakdown model."""
221+ base : Optional [int ] = None
222+ discount : Optional [int ] = None
223+ credit : Optional [int ] = None
224+ bnpl : Optional [int ] = None
225+ installment : Optional [int ] = None
226+ pay_lines : Optional [int ] = None
227+ grand : Optional [int ] = None
228+
229+
230+ class BasketCosts (BaseModel ):
231+ """Basket costs model."""
232+ delivery : Optional [CostBreakdown ] = None
233+ products : Optional [CostBreakdown ] = None
234+ total : Optional [TotalCostBreakdown ] = None
235+
236+
237+ class BasketAddress (BaseModel ):
238+ """Basket address model."""
239+ id : Optional [int ] = None
240+ name : Optional [str ] = None
241+ mobile : Optional [str ] = None
242+ tel : Optional [str ] = None
243+ address : Optional [str ] = None
244+ postal_code : Optional [str ] = None
245+ is_default : Optional [bool ] = None
246+ city : Optional [City ] = None
247+ latitude : Optional [float ] = None
248+ longitude : Optional [float ] = None
249+ house_number : Optional [str ] = None
250+ house_unit : Optional [str ] = None
251+
252+
253+ class ShippingMethodInfo (BaseModel ):
254+ """Shipping method information."""
255+ id : Optional [int ] = None
256+ title : Optional [str ] = None
257+ parent : Optional [Dict [str , Any ]] = None
258+
259+
260+ class OriginShippingMethod (BaseModel ):
261+ """Origin shipping method model."""
262+ id : Optional [int ] = None
263+ method : Optional [ShippingMethodInfo ] = None
264+ delivery_time : Optional [int ] = None
265+ warehouse : Optional [Dict [str , Any ]] = None
266+
267+
268+ class OriginParcel (BaseModel ):
269+ """Origin parcel model."""
270+ id : Optional [int ] = None
271+ shipping_method : Optional [OriginShippingMethod ] = None
272+ preparation_days : Optional [int ] = None
273+ delivery_days : Optional [int ] = None
274+ arrival_delivery_days : Optional [int ] = None
275+
276+
277+ class Origin (BaseModel ):
278+ """Origin model."""
279+ id : Optional [int ] = None
280+ title : Optional [str ] = None
281+ type : Optional [str ] = None
282+ parcel : Optional [OriginParcel ] = None
283+ city : Optional [City ] = None
284+ is_warehouse : Optional [bool ] = None
285+ vendor_identifiers : Optional [List [int ]] = None
286+ delivery_costs : Optional [CostBreakdown ] = None
287+
288+
289+ class BasketProductPhoto (BaseModel ):
290+ """Basket product photo model."""
291+ id : Optional [int ] = None
292+ original : Optional [str ] = None
293+ resized : Optional [Dict [str , str ]] = None
294+
295+
296+ class BasketProductCategory (BaseModel ):
297+ """Basket product category model."""
298+ id : Optional [int ] = None
299+ title : Optional [str ] = None
300+
301+
302+ class BasketProduct (BaseModel ):
303+ """Basket product model."""
304+ id : Optional [int ] = None
305+ title : Optional [str ] = None
306+ price : Optional [int ] = None
307+ primary_price : Optional [int ] = None
308+ stock : Optional [int ] = None
309+ category : Optional [BasketProductCategory ] = None
310+ photos : Optional [List [BasketProductPhoto ]] = None
311+
312+
313+ class BasketVariationProperty (BaseModel ):
314+ """Basket variation property model."""
315+ property : Optional [Dict [str , Any ]] = None
316+ value : Optional [Dict [str , Any ]] = None
317+
318+
319+ class BasketVariation (BaseModel ):
320+ """Basket variation model."""
321+ id : Optional [int ] = None
322+ stock : Optional [int ] = None
323+ price : Optional [int ] = None
324+ primary_price : Optional [int ] = None
325+ properties : Optional [List [BasketVariationProperty ]] = None
326+
327+
328+ class BasketVendorItem (BaseModel ):
329+ """Basket vendor item model."""
330+ id : Optional [int ] = None
331+ parcel_id : Optional [int ] = None
332+ title : Optional [str ] = None
333+ quantity : Optional [int ] = None
334+ price : Optional [int ] = None
335+ primary_price : Optional [int ] = None
336+ payable_amount : Optional [int ] = None
337+ delivery_cost : Optional [int ] = None
338+ total_discount : Optional [int ] = None
339+ basalam_product_discount : Optional [int ] = None
340+ basalam_delivery_discount : Optional [int ] = None
341+ vendor_product_discount : Optional [int ] = None
342+ vendor_delivery_discount : Optional [int ] = None
343+ public_delivery_discount : Optional [int ] = None
344+ product : Optional [BasketProduct ] = None
345+ variation : Optional [BasketVariation ] = None
346+ vendor_coupon : Optional [Dict [str , Any ]] = None
347+ errors : Optional [List [str ]] = None
348+ comment : Optional [str ] = None
349+ is_deleted : Optional [bool ] = None
350+
351+
352+ class VendorOwnerAvatar (BaseModel ):
353+ """Vendor owner avatar model."""
354+ id : Optional [int ] = None
355+ original : Optional [str ] = None
356+ resized : Optional [Dict [str , str ]] = None
357+
358+
359+ class VendorOwner (BaseModel ):
360+ """Vendor owner model."""
361+ id : Optional [int ] = None
362+ hash_id : Optional [str ] = None
363+ name : Optional [str ] = None
364+ avatar : Optional [VendorOwnerAvatar ] = None
365+ city : Optional [City ] = None
366+
367+
368+ class BasketVendor (BaseModel ):
369+ """Basket vendor model."""
370+ id : Optional [int ] = None
371+ identifier : Optional [str ] = None
372+ url_alias : Optional [str ] = None
373+ title : Optional [str ] = None
374+ logo : Optional [Dict [str , Any ]] = None
375+ owner : Optional [VendorOwner ] = None
376+ total_product_amount : Optional [int ] = None
377+ free_shipping_amount : Optional [int ] = None
378+ free_shipping_type : Optional [str ] = None
379+ items : Optional [List [BasketVendorItem ]] = None
380+ city : Optional [City ] = None
381+ parcel_identifiers : Optional [List [int ]] = None
382+ origin_identifiers : Optional [List [int ]] = None
383+ preparation_days : Optional [int ] = None
384+ delivery_days : Optional [int ] = None
385+ arrival_days : Optional [int ] = None
386+ delivery_costs : Optional [CostBreakdown ] = None
231387
232388
233389class BasketResponse (BaseModel ):
234390 """Response model for basket endpoint."""
235- id : int = Field (..., description = "Basket ID" )
236- user_id : int = Field (..., description = "User ID" )
237- items : List [BasketItem ] = Field (..., description = "List of basket items" )
238- total_items : int = Field (..., description = "Total number of items" )
239- total_price : int = Field (..., description = "Total price" )
240- created_at : datetime = Field (..., description = "Creation timestamp" )
241- updated_at : datetime = Field (..., description = "Last update timestamp" )
391+ id : Optional [int ] = None
392+ item_count : Optional [int ] = None
393+ show_recipient_mobile : Optional [bool ] = None
394+ delivery_method : Optional [str ] = None
395+ costs : Optional [BasketCosts ] = None
396+ errors : Optional [List [str ]] = None
397+ error_count : Optional [int ] = None
398+ coupon : Optional [Dict [str , Any ]] = None
399+ option_code : Optional [str ] = None
400+ address : Optional [BasketAddress ] = None
401+ origins : Optional [List [Origin ]] = None
402+ vendors : Optional [List [BasketVendor ]] = None
0 commit comments