from typing import List, Optional

from pydantic import BaseModel, Field


class Item(BaseModel):
    item_id: str
    item_type: str
    price: int = Field(gt=0)


class DiscountedItem(Item):
    discount: float
    discounted_price: float
    applied_percentage: float
    discount_identifier: Optional[str]


class DiscountedItems(BaseModel):
    items: List[DiscountedItem]


class CouponCalculateResult(BaseModel):
    coupon_percentage: float
    items: List[DiscountedItem]
    total_discount: float
