from sqlalchemy import String, Integer, Float
from sqlalchemy.orm import Mapped, mapped_column
from app.core.models import BaseModel

class Office(BaseModel):
    """
    Represents a Core Office location.
    Can be used by HRIS for geofenced check-ins, or CRM for sales territories.
    """
    __tablename__ = 'core_office'

    name: Mapped[str] = mapped_column(String(100), nullable=False)
    address: Mapped[str | None] = mapped_column(String(255), nullable=True)

    # Coordinates for mapping or geofencing (HRIS)
    latitude: Mapped[float] = mapped_column(Float, nullable=False, default=0.0)
    longitude: Mapped[float] = mapped_column(Float, nullable=False, default=0.0)
    radius_meters: Mapped[int] = mapped_column(Integer, default=100) # Geofence radius

    def __repr__(self):
        return f"<Office {self.name}>"
