27 lines
572 B
Python
27 lines
572 B
Python
"""Input schemas for price calculation."""
|
|
|
|
from enum import StrEnum
|
|
|
|
from pydantic import BaseModel, Field, StrictInt
|
|
|
|
|
|
class DeliveryEntity(StrEnum):
|
|
INDIVIDUAL = "individual"
|
|
LEGAL = "legal"
|
|
|
|
|
|
class ParcelType(StrEnum):
|
|
DOC = "doc"
|
|
PARCEL = "parcel"
|
|
|
|
|
|
class DeliveryCalculationRequest(BaseModel):
|
|
entity: DeliveryEntity
|
|
from_city: StrictInt
|
|
to_city: StrictInt
|
|
weight_kg: float = Field(gt=0)
|
|
length_cm: float = Field(gt=0)
|
|
width_cm: float = Field(gt=0)
|
|
height_cm: float = Field(gt=0)
|
|
parcel_type: ParcelType | None = None
|