<?php

namespace Lightscale\LaralightTables;

use Lightscale\LaralightAssets\Facades\Assets;

use Illuminate\Support\ServiceProvider as ServiceProviderBase;
use Illuminate\Support\Facades\Blade;
use Illuminate\Foundation\Console\AboutCommand;

class ServiceProvider extends ServiceProviderBase
{
    public function register() : void
    {

    }

    public function boot() : void
    {
        AboutCommand::add('Laralight Tables', fn() => [
            'Version' => 'dev'
        ]);

        $ns = Service::NAMESPACE;
        $root = __DIR__ . '/..';
        $viewsPath = "{$root}/resources/views";
        $assetsUri = "vendor/{$ns}";
        $assetsPath = public_path($assetsUri);

        $this->loadViewsFrom($viewsPath, $ns);

        $this->publishes([
            $viewsPath => resource_path("views/vendor/{$ns}"),
        ], Service::NAMESPACE . '-views');

        $this->publishes([
            "{$root}/public" => $assetsPath,
        ], "{$ns}-assets");

        Assets::registerManifest($ns, "{$assetsPath}/assets-manifest.json", $assetsUri);
    }

}