# Copyright (c) 2025 Patrick Motsch
# All rights reserved.
"""FileFolder: hierarchical folder structure for file organization."""

from typing import Optional
from pydantic import BaseModel, Field
from modules.datamodels.datamodelBase import PowerOnModel
from modules.shared.i18nRegistry import i18nModel
import uuid


@i18nModel("Dateiordner")
class FileFolder(PowerOnModel):
    """Hierarchischer Ordner fuer die Dateiverwaltung."""
    id: str = Field(
        default_factory=lambda: str(uuid.uuid4()),
        description="Primary key",
        json_schema_extra={"label": "ID", "frontend_type": "text", "frontend_readonly": True, "frontend_required": False},
    )
    name: str = Field(
        description="Folder name",
        json_schema_extra={"label": "Name", "frontend_type": "text", "frontend_readonly": False, "frontend_required": True},
    )
    parentId: Optional[str] = Field(
        default=None,
        description="Parent folder ID (null = root)",
        json_schema_extra={"label": "Uebergeordneter Ordner", "frontend_type": "text", "frontend_readonly": False, "frontend_required": False},
    )
    mandateId: Optional[str] = Field(
        default=None,
        description="Mandate context",
        json_schema_extra={"label": "Mandanten-ID", "frontend_type": "text", "frontend_readonly": True, "frontend_required": False},
    )
    featureInstanceId: Optional[str] = Field(
        default=None,
        description="Feature instance context",
        json_schema_extra={"label": "Feature-Instanz-ID", "frontend_type": "text", "frontend_readonly": True, "frontend_required": False},
    )
