# generated by datamodel-codegen:
#   filename:  model.json
#   timestamp: 2021-04-11T02:18:22+00:00

from __future__ import annotations

from typing import List

from pydantic import BaseModel


class User(BaseModel):
    discord_id: str
    username: str


class Product(BaseModel):
    uuid: str
    name: str


class DiscordRole(BaseModel):
    discord_id: str
    name: str


class OrderItem(BaseModel):
    price: int
    interval: str
    interval_count: int
    is_time_limited: bool
    free_trial_length: int
    payment_processor_record_id: str
    payment_processor: str
    quantity: int
    product: Product
    product_types: List[str]
    discord_roles: List[DiscordRole]


class Order(BaseModel):
    uuid: str
    id: str
    purchased_at: str
    payment_processor: str
    payment_processor_record_id: str
    subtotal: int
    total: int
    discount: int
    type: str
    is_subscription: bool
    cancelled_at: str
    deleted: str
    user: User
    order_items: List[OrderItem]


class Model(BaseModel):
    data: Order

    def __str__(self):
        return f"<Order {self.data.uuid}>"
