from pydantic import BaseModel
from typing import Optional


class PrinterBase(BaseModel):
    name: str
    ip_address: str
    port: int = 9100
    is_active: bool = True


class PrinterUpdate(BaseModel):
    name: Optional[str] = None
    ip_address: Optional[str] = None
    port: Optional[int] = None
    is_active: Optional[bool] = None


class PrinterOut(PrinterBase):
    id: int

    model_config = {"from_attributes": True}
