# Copyright (c) 2025 Patrick Motsch
# All rights reserved.
"""Workspace feature data models — WorkspaceUserSettings."""

from typing import Optional
from pydantic import BaseModel, Field
from modules.datamodels.datamodelBase import PowerOnModel
from modules.shared.attributeUtils import registerModelLabels
import uuid


class WorkspaceUserSettings(PowerOnModel):
    """Per-user workspace settings. None values mean 'use instance default'."""
    id: str = Field(default_factory=lambda: str(uuid.uuid4()), description="Primary key", json_schema_extra={"frontend_type": "text", "frontend_readonly": True, "frontend_required": False})
    userId: str = Field(description="User ID", json_schema_extra={"frontend_type": "text", "frontend_readonly": True, "frontend_required": True})
    mandateId: str = Field(description="Mandate ID", json_schema_extra={"frontend_type": "text", "frontend_readonly": True, "frontend_required": True})
    featureInstanceId: str = Field(description="Feature Instance ID", json_schema_extra={"frontend_type": "text", "frontend_readonly": True, "frontend_required": True})
    maxAgentRounds: Optional[int] = Field(default=None, description="Max agent rounds override (None = instance default)", json_schema_extra={"frontend_type": "number", "frontend_readonly": False, "frontend_required": False})


registerModelLabels(
    "WorkspaceUserSettings",
    {"en": "Workspace User Settings", "de": "Workspace Benutzereinstellungen"},
    {
        "id": {"en": "ID", "de": "ID"},
        "userId": {"en": "User ID", "de": "Benutzer-ID"},
        "mandateId": {"en": "Mandate ID", "de": "Mandanten-ID"},
        "featureInstanceId": {"en": "Feature Instance ID", "de": "Feature-Instanz-ID"},
        "maxAgentRounds": {"en": "Max Agent Rounds", "de": "Max. Agenten-Runden"},
    },
)
