from pydantic import BaseModel, ConfigDict, Field


class RoomBase(BaseModel):
    name: str = Field(min_length=1, max_length=120)
    width: float = Field(gt=0)
    height: float = Field(gt=0)
    counter_name: str | None = Field(default="Banco", max_length=120)
    counter_x: float | None = Field(default=None, ge=0)
    counter_y: float | None = Field(default=None, ge=0)
    counter_width: float | None = Field(default=None, gt=0)
    counter_height: float | None = Field(default=None, gt=0)
    counter_visible: bool = True
    entrance_name: str | None = Field(default="Entrata", max_length=120)
    entrance_x: float | None = Field(default=None, ge=0)
    entrance_y: float | None = Field(default=None, ge=0)
    entrance_width: float | None = Field(default=None, gt=0)
    entrance_height: float | None = Field(default=None, gt=0)
    entrance_visible: bool = True
    background_image_data_url: str | None = None


class RoomCreate(RoomBase):
    pass


class RoomUpdate(RoomBase):
    pass


class RoomRead(RoomBase):
    id: int
    venue_id: int

    model_config = ConfigDict(from_attributes=True)
