from datetime import datetime, date
from typing import Optional

from fastapi import APIRouter
from sqlmodel import Field, SQLModel

router = APIRouter()


class History(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    patient_id: int
    hospital_id: Optional[int]
    hospital_node_id: Optional[int]
    hospital_room: str
    discipline_group_id: int
    discipline_id: int
    date: date
    source: str
    created_at: datetime
    updated_at: datetime
    created_by: int
    updated_by: Optional[int] = None


class HistoryDoctor(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    history_id: int
    doctor_id: int
    created_at: datetime
    updated_at: datetime
    created_by: int
    updated_by: Optional[int] = None


class HistoryModuleMap(SQLModel, table=True):
    id: Optional[int] = 