<?php

namespace App\Providers;

use App\Models\Ordine;
use App\Observers\OrdineObserver;
use App\Observers\DispositivoObserver;
use App\Observers\PagamentoObserver;
use App\Models\Pagamento;
use App\Models\Dispositivo;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Vite;

class AppServiceProvider extends ServiceProvider
{
  /**
  * Register any application services.
  */
  public function register(): void
  {
    //
  }

  /**
  * Bootstrap any application services.
  */
  public function boot(): void
  {
    Ordine::observe(OrdineObserver::class);
    Dispositivo::observe(DispositivoObserver::class);
    Pagamento::observe(PagamentoObserver::class);

    Vite::useStyleTagAttributes(function (?string $src, string $url, ?array $chunk, ?array $manifest) {
      if ($src !== null) {
        return [
          'class' => preg_match("/(resources\/assets\/vendor\/scss\/(rtl\/)?core)-?.*/i", $src) ? 'template-customizer-core-css' :
          (preg_match("/(resources\/assets\/vendor\/scss\/(rtl\/)?theme)-?.*/i", $src) ? 'template-customizer-theme-css' : '')
        ];
      }
      return [];
    });

    
  }
}
