from datetime import datetime

from pydantic import BaseModel

from src.db.models.tysc import Card


class CardResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    card_number: int
    year: int
    card_set_id: str
    rooster_id: str
    vendor_id: str

def to_response(card: Card) -> CardResponse:
    response: CardResponse = CardResponse(
            id=card.id,
            created_date=card.created_date,
            last_modified_date=card.last_modified_date,
            version=card.version,
            card_number=card.card_number,
            year=card.year,
            card_set_id=card.card_set_id,
            rooster_id=card.rooster_id,
            vendor_id=card.vendor_id
    )
    return response
