<?php

namespace {{ plugin_namespace }};

use Backend\Facades\Backend;
use Backend\Models\UserRole;
use System\Classes\PluginBase;

/**
 * {{ name }} Plugin Information File
 */
class Plugin extends PluginBase
{
    /**
     * Returns information about this plugin.
     */
    public function pluginDetails(): array
    {
        return [
            'name'        => '{{ plugin_id }}::lang.plugin.name',
            'description' => '{{ plugin_id }}::lang.plugin.description',
            'author'      => '{{ author }}',
            'icon'        => 'icon-leaf'
        ];
    }

    /**
     * Register method, called when the plugin is first registered.
     */
    public function register(): void
    {

    }

    /**
     * Boot method, called right before the request route.
     */
    public function boot(): void
    {

    }

    /**
     * Registers any frontend components implemented in this plugin.
     */
    public function registerComponents(): array
    {
        return []; // Remove this line to activate

        return [
            \{{ plugin_namespace }}\Components\MyComponent::class => 'myComponent',
        ];
    }

    /**
     * Registers any backend permissions used by this plugin.
     */
    public function registerPermissions(): array
    {
        return []; // Remove this line to activate

        return [
            '{{ plugin_id }}.some_permission' => [
                'tab' => '{{ plugin_id }}::lang.plugin.name',
                'label' => '{{ plugin_id }}::lang.permissions.some_permission',
                'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
            ],
        ];
    }

    /**
     * Registers backend navigation items for this plugin.
     */
    public function registerNavigation(): array
    {
        return []; // Remove this line to activate

        return [
            '{{ lower_name }}' => [
                'label'       => '{{ plugin_id }}::lang.plugin.name',
                'url'         => Backend::url('{{ plugin_url }}/mycontroller'),
                'icon'        => 'icon-leaf',
                'permissions' => ['{{ plugin_id }}.*'],
                'order'       => 500,
            ],
        ];
    }
}
