from __future__ import annotations

from typing import Any

from sqlalchemy import Boolean, JSON, String
from sqlalchemy.orm import Mapped, mapped_column

from govoplan_core.db.base import Base, TimestampMixin


class SystemSettings(Base, TimestampMixin):
    __tablename__ = "core_system_settings"

    id: Mapped[str] = mapped_column(String(36), primary_key=True, default="global")
    default_locale: Mapped[str] = mapped_column(String(20), default="en", nullable=False)
    allow_tenant_custom_groups: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
    allow_tenant_custom_roles: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
    allow_tenant_api_keys: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
    settings: Mapped[dict[str, Any]] = mapped_column(JSON, default=dict, nullable=False)


__all__ = ["SystemSettings"]

