<?php

declare(strict_types=1);

namespace Builder\Core\Providers;

use Builder\Core\Foundation\Commands\CheckCommand;
use Builder\Core\Foundation\Commands\InstallCommand;
use Builder\Core\Foundation\Commands\LinkCommand;
use Builder\Core\Foundation\Commands\MakeResourceCommand;
use Builder\Core\Foundation\Commands\MakeSettingsCommand;
use Builder\Core\Foundation\Commands\MakeWidgetCommand;
use Builder\Core\Foundation\Commands\PruneRevisionsCommand;
use Builder\Core\Foundation\Commands\PublishScheduledContentCommand;
use Illuminate\Support\ServiceProvider;

final class ConsoleServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        if ($this->app->runningInConsole()) {
            $this->commands([
                CheckCommand::class,
                InstallCommand::class,
                LinkCommand::class,
                MakeResourceCommand::class,
                MakeWidgetCommand::class,
                MakeSettingsCommand::class,
                PruneRevisionsCommand::class,
                PublishScheduledContentCommand::class,
            ]);

            $this->publishes([
                __DIR__.'/../../stubs' => base_path('stubs/builder'),
            ], 'builder-stubs');

            $this->publishes([
                __DIR__.'/../../resources/lang' => resource_path('lang/vendor/builder'),
            ], 'builder-core-translations');

            $this->publishes([
                __DIR__.'/../../database/migrations' => database_path('migrations'),
            ], 'builder-core-migrations');

            $this->publishes([
                __DIR__.'/../../public' => public_path('vendor/builder/core'),
                __DIR__.'/../../node_modules/vue/dist/vue.esm-browser.prod.js' => public_path('vendor/builder/vendor/vue.esm-browser.prod.js'),
            ], 'builder-core-assets');

            $this->publishes([
                __DIR__.'/../../config/builder.php' => config_path('builder.php'),
            ], 'builder-core-config');
        }
    }
}
