Files
barker/barker/barker/schemas/tax.py
T
tanshu 8957e4ce8c All voucher routes now work with bundles.
Need to check / update all reports and prints
2026-02-05 00:46:49 +00:00

37 lines
1.0 KiB
Python

import uuid
from decimal import Decimal
from typing import Annotated
from pydantic import BaseModel, ConfigDict, Field
from . import Daf, to_camel
from .regime import RegimeLink
class TaxIn(BaseModel):
name: Annotated[str, Field(min_length=1)]
rate: Annotated[Daf, Field(ge=Decimal(0), default=Decimal(0))]
regime: RegimeLink
is_fixture: bool
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
class Tax(TaxIn):
id_: uuid.UUID
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
class TaxBlank(BaseModel):
name: str
rate: Annotated[Daf, Field(ge=Decimal(0), default=Decimal(0))]
is_fixture: bool
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
class TaxLink(BaseModel):
id_: uuid.UUID
name: str | None = None
rate: Daf | None = None
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)