<?php

/**
 * Security module manifest.
 *
 * Standalone module (no cross-module dependency). Lets the security officer
 * create and track customer security checks: a fixed internal process plus a
 * per-product technical checklist. Customer + domain selection use a thin,
 * self-contained Business Central OData gateway; the software-product catalog
 * is owned by this module (the check templates ARE the product list).
 */
return [
    'id' => 'security',
    'version' => '1.0.0',
    'enabled_by_default' => false,
    'load_order' => 30,
    'requires' => [],

    'routes' => [
        ['path' => 'security/checks', 'target' => 'security/checks'],
        ['path' => 'security/checks-data', 'target' => 'security/checks-data'],
        ['path' => 'security/checks/create', 'target' => 'security/checks/create'],
        ['path' => 'security/checks/edit/{id}', 'target' => 'security/checks/edit'],
        ['path' => 'security/checks/report/{id}', 'target' => 'security/checks/report'],
        ['path' => 'security/customer-search-data', 'target' => 'security/customer-search-data'],
        ['path' => 'security/customer-domains-data', 'target' => 'security/customer-domains-data'],
        ['path' => 'security/templates', 'target' => 'security/templates'],
        ['path' => 'security/templates-data', 'target' => 'security/templates-data'],
        ['path' => 'security/templates/create', 'target' => 'security/templates/create'],
        ['path' => 'security/templates/edit/{id}', 'target' => 'security/templates/edit'],
        ['path' => 'security/settings', 'target' => 'security/settings'],
        ['path' => 'security/settings/test-connection-data', 'target' => 'security/settings/test-connection-data'],
        ['path' => 'security/report-design', 'target' => 'security/report-design'],
        ['path' => 'security/report-design/logo-file', 'target' => 'security/report-design/logo-file'],
    ],
    'public_paths' => [],

    'container_registrars' => [
        \MintyPHP\Module\Security\SecurityContainerRegistrar::class,
    ],

    'ui_slots' => [
        'aside.tab_panel' => [
            [
                'key' => 'security',
                'label' => 'Security',
                'icon' => 'bi-shield-check',
                'icon_fill' => 'bi-shield-check',
                'href' => '',
                'permission' => 'security.access',
                'panel_template' => 'templates/aside-security-panel.phtml',
                'details_storage' => 'aside-security-sections-v1',
                'details_open_active' => true,
                'order' => 850,
            ],
        ],
        'runtime.component' => [
            [
                'key' => 'security-customer-domain-select',
                'script' => 'modules/security/js/security-customer-domain-select.js',
                'export' => 'initSecurityCustomerDomainSelect',
                'selector' => '#security-domain-group[data-app-component="security-customer-domain-select"]',
                'config_path' => 'components.security.customerDomainSelect',
                'default_config' => [],
                'phase' => 'default',
                'permission' => 'security.checks.create',
                'order' => 851,
            ],
            [
                'key' => 'security-check-workspace',
                'script' => 'modules/security/js/security-check-workspace.js',
                'export' => 'initSecurityCheckWorkspace',
                'selector' => '[data-app-component="security-check-workspace"]',
                'config_path' => 'components.security.checkWorkspace',
                'default_config' => [],
                'phase' => 'default',
                'permission' => 'security.checks.view',
                'order' => 852,
            ],
            [
                'key' => 'security-template-schema-editor',
                'script' => 'modules/security/js/security-template-schema-editor.js',
                'export' => 'initSecurityTemplateSchemaEditor',
                'selector' => '#security-schema-editor[data-app-component="security-template-schema-editor"]',
                'config_path' => 'components.security.templateSchemaEditor',
                'default_config' => [],
                'phase' => 'default',
                'permission' => 'security.templates.manage',
                'order' => 853,
            ],
            [
                'key' => 'security-settings',
                'script' => 'modules/security/js/security-settings.js',
                'export' => 'initSecuritySettings',
                'selector' => '[data-app-component="security-settings"]',
                'config_path' => 'components.security.settings',
                'default_config' => [],
                'phase' => 'default',
                'permission' => 'security.settings.manage',
                'order' => 854,
            ],
        ],
    ],

    'authorization_policies' => [
        \MintyPHP\Module\Security\SecurityAuthorizationPolicy::class,
    ],

    'permissions' => [
        [
            'key' => 'security.access',
            'description' => 'Access the Security module',
            'active' => true,
            'is_system' => true,
        ],
        [
            'key' => 'security.checks.view',
            'description' => 'View security checks',
            'active' => true,
            'is_system' => true,
        ],
        [
            'key' => 'security.checks.create',
            'description' => 'Create security checks and edit their checklist',
            'active' => true,
            'is_system' => true,
        ],
        [
            'key' => 'security.checks.manage',
            'description' => 'Manage all security checks (archive, delete)',
            'active' => true,
            'is_system' => true,
        ],
        [
            'key' => 'security.templates.manage',
            'description' => 'Manage security check templates and their technical checklists',
            'active' => true,
            'is_system' => true,
        ],
        [
            'key' => 'security.settings.manage',
            'description' => 'Manage Security module Business Central connection settings',
            'active' => true,
            'is_system' => true,
        ],
    ],

    'search_resources' => [],
    'asset_groups' => [
        'security' => [
            'modules/security/css/security.css',
        ],
    ],
    'scheduler_jobs' => [],

    'layout_context_providers' => [
        \MintyPHP\Module\Security\Providers\SecurityLayoutProvider::class,
    ],
    'session_providers' => [],
    'event_listeners' => [],
    'deactivation_handler' => null,
    'migrations_path' => 'migrations',
    'i18n_path' => 'i18n',
];
