<?php

namespace Yajny\MailYj;

use Illuminate\Support\ServiceProvider;
use  Yajny\MailYj\Commands\MailYjMakeCommand;

class MailYjServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot()
    {
        /*
         * Optional methods to load your package assets
         */
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'MailYj');
        $this->loadViewsFrom(__DIR__.'/../resources/emails', 'MailYj');
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
        // $this->loadRoutesFrom(__DIR__.'/routes.php');


        if ($this->app->runningInConsole()) {
//            $this->publishes([
//                __DIR__.'/../config/config.php' => config_path('MailYj.php'),
//            ], 'config');

            $this->commands([
                MailYjMakeCommand::class,
            ]);


            // Publishing the views.
            /*$this->publishes([
                __DIR__.'/../resources/views' => resource_path('views/vendor/MailYj'),
            ], 'views');*/

            // Publishing assets.
            /*$this->publishes([
                __DIR__.'/../resources/assets' => public_path('vendor/MailYj'),
            ], 'assets');*/

            // Publishing the translation files.
            /*$this->publishes([
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/MailYj'),
            ], 'lang');*/

            // Registering package commands.
            // $this->commands([]);
        }
    }

    /**
     * Register the application services.
     */
    public function register()
    {
        // Automatically apply the package configuration
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'MailYj');

        // Register the main class to use with the facade
        $this->app->singleton('MailYj', function () {
            return new MailYj;
        });
    }
}
