<?php

namespace Sarga\Admin\Providers;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class AdminServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
        $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'sarga_admin');
        $this->loadViewsFrom(__DIR__ . '/../../publishable/assets', 'sarga_admin_color');
        $this->loadViewsFrom(__DIR__ . '/../../publishable/ui', 'sarga_admin_color2');
        $this->loadViewsFrom(__DIR__ . '/../../publishable/marketplace', 'sarga_admin_color3');
        $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
        $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'sarga');

        $this->publishes([
            __DIR__ . '/../Resources/views/catalog/categories' => resource_path('views/vendor/admin/catalog/categories'),
            __DIR__ . '/../../publishable/assets' => public_path('vendor/webkul/admin/assets'),
            __DIR__ . '/../../publishable/ui' => public_path('vendor/webkul/ui'),
            __DIR__ . '/../../publishable/marketplace' => public_path('vendor/webkul/marketplace'),
            __DIR__ . '/../Resources/views/customers/addresses' => resource_path('views/vendor/admin/customers/addresses'),
            __DIR__ . '/../Resources/views/sales' => resource_path('views/vendor/admin/sales'),
            __DIR__ . '/../Resources/views/customers/edit.blade.php' => resource_path('views/vendor/admin/customers/edit.blade.php'),
        ]);

        $this->app->register(EventServiceProvider::class);

    }

    public function register()
    {
        $this->mergeConfigFrom(
            dirname(__DIR__) . '/Config/menu.php',
            'menu.admin'
        );

        $this->mergeConfigFrom(
            dirname(__DIR__) . '/Config/system.php',
            'core'
        );

        $this->mergeConfigFrom(
            dirname(__DIR__) . '/Config/carriers.php', 'carriers'
        );
    }
}
