<?php

namespace Aura\Pro;

use Illuminate\Support\Facades\Blade;
use Illuminate\Contracts\View\View;
use Eminiarts\Aura\Facades\Aura;
use Aura\Pro\Commands\ProCommand;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class ProServiceProvider extends PackageServiceProvider
{
    public function configurePackage(Package $package): void
    {
        /*
         * This class is a Package Service Provider
         *
         * More info: https://github.com/spatie/laravel-package-tools
         */
        $package
            ->name('pro')
            ->hasConfigFile()
            ->hasViews()
            // ->hasMigration('create_pro_table')
            ->hasCommand(ProCommand::class);
    }

    public function packageRegistered()
    {
        // dd('registered');
        $this->app->bind(\Eminiarts\Aura\Http\Livewire\Table\Table::class, \Aura\Pro\Http\Livewire\Table\Table::class);
    }

    public function packageBooted()
    {
        // inject view
        Aura::registerInjectView('table_before', fn (): View => view('pro::table.table_before'), );

        // Blade Example
        // Aura::registerInjectView('table_before', fn (): string => Blade::render('@livewire(\'livewire-ui-modal\')'));
    }
}
