from datetime import datetime
from typing import Optional, List
from sqlmodel import SQLModel, Field, Relationship


class ESIMarketOrder(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    timestamp: datetime = Field(default_factory=datetime.utcnow, nullable=False)

    region_id: int
    type_id: int  # TODO: link to SDE
    location_id: int  # TODO: link to SDE
    volume_total: int
    volume_remain: int
    min_volume: int
    order_id: int  # TODO: use this as PK ? (will lose volume_remain history)
    price: float
    is_buy_order: bool
    duration: int
    issued: datetime
    range: str  # TODO: enum?
    system_id: int  # TODO: link to SDE


