# Copyright (c) 2025 Patrick Motsch
# All rights reserved.
"""Base Pydantic model with system-managed fields (DB + API + UI metadata)."""

from typing import Optional

from pydantic import BaseModel, Field

from modules.shared.i18nRegistry import i18nModel


@i18nModel("Basisdatensatz")
class PowerOnModel(BaseModel):
    """Basis-Datenmodell mit System-Audit-Feldern fuer alle DB-Tabellen."""
    sysCreatedAt: Optional[float] = Field(
        default=None,
        description="Record creation timestamp (UTC, set by system)",
        json_schema_extra={
            "label": "Erstellt am",
            "frontend_type": "timestamp",
            "frontend_readonly": True,
            "frontend_required": False,
            "frontend_visible": False,
            "system": True,
        },
    )
    sysCreatedBy: Optional[str] = Field(
        default=None,
        description="User ID who created this record (set by system)",
        json_schema_extra={
            "label": "Erstellt von",
            "frontend_type": "text",
            "frontend_readonly": True,
            "frontend_required": False,
            "frontend_visible": False,
            "system": True,
        },
    )
    sysModifiedAt: Optional[float] = Field(
        default=None,
        description="Record last modification timestamp (UTC, set by system)",
        json_schema_extra={
            "label": "Geaendert am",
            "frontend_type": "timestamp",
            "frontend_readonly": True,
            "frontend_required": False,
            "frontend_visible": False,
            "system": True,
        },
    )
    sysModifiedBy: Optional[str] = Field(
        default=None,
        description="User ID who last modified this record (set by system)",
        json_schema_extra={
            "label": "Geaendert von",
            "frontend_type": "text",
            "frontend_readonly": True,
            "frontend_required": False,
            "frontend_visible": False,
            "system": True,
        },
    )
