from pydantic import BaseModel
from datetime import datetime, date
from typing import Optional


class EmployeeCreate(BaseModel):
    name: str
    account_name: str
    account_number: str
    company_id: Optional[str] = None
    hire_date: Optional[date] = None
    base_salary: int
    active: bool = True


class EmployeeUpdate(BaseModel):
    name: Optional[str] = None
    account_name: Optional[str] = None
    account_number: Optional[str] = None
    company_id: Optional[str] = None
    hire_date: Optional[date] = None
    base_salary: Optional[int] = None
    active: Optional[bool] = None


class EmployeeOut(BaseModel):
    id: str
    name: str
    account_name: str
    account_number: str
    company_id: Optional[str] = None
    company_name: Optional[str] = None
    bank_name: Optional[str] = None
    hire_date: Optional[date] = None
    base_salary: int
    active: bool
    created_at: datetime
    updated_at: datetime

    model_config = {"from_attributes": True}


class EmployeeTableRow(BaseModel):
    id: str
    name: str
    bank_name: Optional[str] = None
    account_number: str
    account_name: str
    company_id: Optional[str] = None
    company_name: Optional[str] = None
    hire_date: Optional[date] = None
    base_salary: int
    benefit: int = 0
    loan_monthly: int = 0
    current_salary: int
    active: bool
