"""DMS plugin — folders, files, preview, Collabora, internal sharing, search, bulk ops."""

from __future__ import annotations

from app.plugins.base import BasePlugin
from app.plugins.manifest import PluginManifest, PluginRouteDef, FrontendMenuItem, FrontendPageRoute, FrontendDetailTab


class DmsPlugin(BasePlugin):
    """DMS plugin for document management: folders, files, preview, sharing."""

    manifest = PluginManifest(
        name="dms",
        version="1.0.0",
        display_name="DMS",
        description="Document management: folder hierarchy, file upload, PDF preview, Collabora edit sessions, internal sharing, search, bulk ops.",
        dependencies=["permissions"],
        routes=[
            PluginRouteDef(
                path="/api/v1/dms",
                module="app.plugins.builtins.dms.routes",
                router_attr="router",
            ),
        ],
        events=[],
        migrations=["0001_initial.sql"],
        permissions=[
            "dms:read",
            "dms:write",
            "dms:delete",
            "dms:share",
            "dms:admin",
        ],
        menu_items=[
            FrontendMenuItem(label_key='nav.files', label='Files', path='/dms', icon='FolderOpen', order=40),
            FrontendMenuItem(label_key='nav.trash', label='Trash', path='/dms/trash', icon='Trash2', group='nav.files', order=41),
        ],
        page_routes=[
            FrontendPageRoute(path='/dms', component='@/pages/Dms', protected=True),
            FrontendPageRoute(path='/dms/trash', component='@/pages/DmsTrash', protected=True),
        ],
        detail_tabs=[
            FrontendDetailTab(entity_type='contact', label_key='tabs.files', label='Dateien', component='@/components/contact/ContactFilesTab', icon='FolderOpen', order=40, permission='dms:read'),
        ],
    )
