<?php

/**
 * Address Book module manifest.
 *
 * Contributes routes, explorer nav link, search entry, user-edit aside action,
 * and authorization policy.
 */
return [
    'id' => 'addressbook',
    'version' => '1.0.0',
    'enabled_by_default' => false,
    'load_order' => 10,
    'requires' => [],

    'routes' => [
        // Keep canonical route stable without forcing a /index target to avoid Router redirect loops.
        ['path' => 'address-book', 'target' => 'address-book'],
        ['path' => 'address-book/data', 'target' => 'address-book/data'],
        ['path' => 'address-book/view-fragment', 'target' => 'address-book/view-fragment'],
        // Legacy aliases for existing bookmarks/links.
        ['path' => 'addressbook', 'target' => 'address-book'],
        ['path' => 'adressbook', 'target' => 'address-book'],
    ],
    'public_paths' => [],
    'container_registrars' => [
        \MintyPHP\Module\AddressBook\AddressBookContainerRegistrar::class,
    ],

    'ui_slots' => [
        'explorer.nav_item' => [
            [
                'key' => 'address-book',
                'label' => 'Address book',
                'href' => 'address-book',
                'permission' => 'addressbook.view',
                'order' => 110,
            ],
        ],
        'search.resource_item' => [
            [
                'key' => 'address-book',
                'label' => 'Address book',
                'base_url' => 'address-book',
                'permission' => 'addressbook.view',
                'order' => 110,
            ],
        ],
        'user.edit.aside_action' => [
            [
                'key' => 'address-book-view-user',
                'type' => 'link',
                'label' => 'View in address book',
                'href' => 'address-book/view/{user_uuid}',
                'permission' => 'addressbook.view',
                'order' => 110,
            ],
        ],
    ],

    'authorization_policies' => [
        \MintyPHP\Module\AddressBook\AddressBookAuthorizationPolicy::class,
    ],

    'search_resources' => [
        \MintyPHP\Module\AddressBook\Providers\AddressBookSearchProvider::class,
    ],

    'asset_groups' => [
        'address-book' => [
            'modules/addressbook/css/pages/address-book-view.css',
            'modules/addressbook/css/pages/address-book-banner.css',
        ],
        'address-book-index' => [
            'modules/addressbook/css/pages/address-book-index.css',
        ],
    ],
    'scheduler_jobs' => [],

    'layout_context_providers' => [],

    'session_providers' => [],

    'permissions' => [
        [
            'key' => 'address_book.view',
            'description' => 'Can view address book',
            'active' => true,
            'is_system' => true,
        ],
    ],

    'migrations_path' => 'db/updates',
    'i18n_path' => 'i18n',
];
