"""Permissions plugin — file/folder permissions, share links, public access."""

from __future__ import annotations

from app.plugins.base import BasePlugin
from app.plugins.manifest import PluginManifest, PluginRouteDef, FrontendSettingsPage


class PermissionsPlugin(BasePlugin):
    """Permissions plugin for managing file/folder access and public share links."""

    manifest = PluginManifest(
        name="permissions",
        version="1.0.0",
        display_name="Permissions",
        description="File/folder permissions, share links with password+expiry, public access.",
        dependencies=[],
        routes=[
            PluginRouteDef(
                path="/api/v1/permissions",
                module="app.plugins.builtins.permissions.routes",
                router_attr="router",
            ),
            PluginRouteDef(
                path="/api/public",
                module="app.plugins.builtins.permissions.routes",
                router_attr="public_router",
            ),
        ],
        events=[],
        migrations=["0001_initial.sql"],
        permissions=[],
        is_core=True,
        settings_pages=[
            FrontendSettingsPage(path='roles', label_key='settings.roles', label='Roles', component='@/pages/SettingsRoles', icon='Shield', order=10, permission='permissions:read'),
            FrontendSettingsPage(path='users', label_key='settings.users', label='Users', component='@/pages/SettingsUsers', icon='Users', order=11, permission='permissions:read'),
            FrontendSettingsPage(path='groups', label_key='settings.groups', label='Groups', component='@/pages/SettingsGroups', icon='UsersRound', order=12, permission='permissions:read'),
        ],
    )
