<?php

namespace ViartasThemes\Florial\Providers;

use ViartasCore\Auth\Controllers\RegisterController;
use ViartasCore\Core\Providers\BaseThemeServiceProvider;
use ViartasCore\Auth\Controllers\LoginController;
use ViartasThemes\Florial\Commands\FillShop;
use ViartasThemes\Florial\Commands\SeedFlorialCommand;
use ViartasThemes\Florial\Modules\Auth\LoginController as LoginControllerFlorial;

class ThemeServiceProvider extends BaseThemeServiceProvider
{
    /**
     * @var string
     */
    public string $package_directory = __DIR__;

    /**
     * @var string
     */
    public string $application = 'web';

    /**
     * @return void
     */
    public function boot(): void
    {
        parent::boot();

        $this->loadViewsFrom(
            base_path('vendor/viartas-themes/florial/components/web'),
            'florial'
        );
    }

    /**
     * @return string[]
     */
    public function controllers(): array
    {
        return [
            LoginController::class => LoginControllerFlorial::class,
            RegisterController::class => \ViartasThemes\Florial\Modules\Auth\RegisterController::class,
        ];
    }

    /**
     * @return string[]
     */
    public function artisanCommands(): array
    {
        return [
            FillShop::class,
            SeedFlorialCommand::class,
        ];
    }

    public function views(): array
    {
        return [
            'web.auth.login' => 'theme.web.modules.auth.login',
            'web.auth.register' => 'theme.web.modules.auth.register',
        ];
    }

    /**
     * @return array
     */
    public function javascript(): array
    {
        return [
            'web.*' => [
                [
                    'vendor' => 'viartas-js/jquery-validation',
                    'file' => 'resources/js/jquery-validation.js',
                    'type' => 'module', //library, module, script
                    'render_as' => 'commonjs', //module, commonjs
                ],
                [
                    'vendor' => 'viartas-js/jquery-validation',
                    'file' => 'resources/js/core-validator.js',
                    'type' => 'script', //library, module, script
                    'render_as' => 'commonjs', //module, commonjs
                ],
                [
                    'vendor' => 'viartas-js/select2',
                    'file' => 'resources/js/select2.js',
                    'type' => 'module', //library, module, script
                    'render_as' => 'commonjs', //module, commonjs
                ],
                [
                    'vendor' => 'viartas-js/select2',
                    'file' => 'resources/js/init.js',
                    'type' => 'script', //library, module, script
                    'render_as' => 'commonjs', //module, commonjs
                ],
                [
                    'vendor' => 'viartas-themes/florial',
                    'file' => 'resources/js/app.js',
                    'type' => 'script', //library, module, script
                    'render_as' => 'commonjs', //module, commonjs
                ],
                [
                    'vendor' => 'viartas-themes/florial',
                    'file' => 'resources/js/shop-search.js',
                    'type' => 'script', //library, module, script
                    'render_as' => 'commonjs', //module, commonjs
                ],
            ],
        ];
    }

    /**
     * @return array
     */
    public function css(): array
    {
        return [
            'web.*' => [
                [
                    'vendor' => 'viartas-themes/florial',
                    'file' => 'resources/css/app.css',
                    'type' => 'script', //library, module, script
                ],
                [
                    'vendor' => 'viartas-js/select2',
                    'file' => 'resources/css/select2.css',
                    'type' => 'script', //library, module, script
                ],
                [
                    'vendor' => 'viartas-themes/florial',
                    'file' => 'resources/css/shop-search.css',
                    'type' => 'script', //library, module, script
                ]
            ],
        ];
    }

    /**
     * @return array
     */
    public function disabledNodePackages(): array
    {
        return [
            /*'accounting.*' => [
                'viartas-js/jquery',
            ]*/
        ];
    }

    public function icons(): array
    {
        return [
            'web.account.index'          => '<i class="fas fa-chart-line"></i>',        // suvestinė
            'web.account.orders'         => '<i class="fas fa-shopping-cart"></i>',     // užsakymai
            'web.account.profile'        => '<i class="fas fa-user-circle"></i>',       // profilis
            'web.account.customers'      => '<i class="fas fa-users"></i>',             // pirkėjai
            'web.account.addresses'      => '<i class="fas fa-map-marker-alt"></i>',    // adresai
            'web.account.terminals'      => '<i class="fas fa-inbox"></i>',             // paštomatai
            'web.account.wishlist'       => '<i class="fas fa-heart"></i>',             // norų sąrašas
            'web.account.cards'          => '<i class="fas fa-credit-card"></i>',       // kortelės
            'web.account.privacy'        => '<i class="fas fa-user-shield"></i>',       // privatumas
        ];
    }
}
