# 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, "fk_target": {"db": "poweron_management", "table": "FileFolder"}, }, ) mandateId: Optional[str] = Field( default=None, description="Mandate context", json_schema_extra={ "label": "Mandanten-ID", "frontend_type": "text", "frontend_readonly": True, "frontend_required": False, "fk_target": {"db": "poweron_app", "table": "Mandate"}, }, ) 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, "fk_target": {"db": "poweron_app", "table": "FeatureInstance"}, }, ) scope: str = Field( default="personal", description="Data visibility scope: personal, featureInstance, mandate, global. Inherited by files in this folder.", json_schema_extra={ "label": "Sichtbarkeit", "frontend_type": "select", "frontend_readonly": False, "frontend_required": False, "frontend_options": [ {"value": "personal", "label": "Persönlich"}, {"value": "featureInstance", "label": "Feature-Instanz"}, {"value": "mandate", "label": "Mandant"}, {"value": "global", "label": "Global"}, ], }, ) neutralize: bool = Field( default=False, description="Whether files in this folder should be neutralized before AI processing. Inherited by new/moved files.", json_schema_extra={ "label": "Neutralisieren", "frontend_type": "checkbox", "frontend_readonly": False, "frontend_required": False, }, )