from datetime import datetime

from pydantic import BaseModel

from src.db.models.tysc import CardSet


class CardSetResponse(BaseModel):
    id: str
    created_date: datetime
    last_modified_date: datetime
    version: int
    name: str
    parallel_set: bool
    insert_set: bool
    vendor_id: str


def to_response(cardset: CardSet) -> CardSetResponse:
    response: CardSetResponse = CardSetResponse(
            id=cardset.id,
            created_date=cardset.created_date,
            last_modified_date=cardset.last_modified_date,
            version=cardset.version,
            name=cardset.name,
            parallel_set=cardset.parallel_set,
            insert_set=cardset.insert_set,
            vendor_id=cardset.vendor_id
    )
    return response
