from datetime import datetime
from typing import Optional

from fastapi import APIRouter
from sqlmodel import Field, SQLModel

router = APIRouter()


class Disease(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str


class DiseaseGroup(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str


class DiseaseGroupMap(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    disease_group_id: int
    disease_id: int


class PatientDisease(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    patient_id: int
    doctor_id: Optional[int] = None
    cleft: bool
    craniofacial: bool
    syndronic: bool
    non: bool
    comorbidity: bool
    created_at: datetime
    updated_at: datetime
    created_by: int
    updated_by: Optional[int] = None


class PatientDiseaseList(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    patient_disease_id: int
    disease_id: int
    detail: str
    created_at: datetime
    updated_at: datetime
    created_by: int
    updated_by: Optional[int] = None


class PatientDiseaseCleft(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    patient_disease_id: int
    cleft_type: str
    cleft_lateral: str
    cleft_side: str
    cleft_complete: str
    created_at: datetime
    updated_at: datetime
    created_by: int
    updated_by: Optional[int] = None


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