<?php

namespace App\Providers;

use App\Models\Barbershop;
use App\Models\Cash;
use App\Models\Customer;
use App\Models\Debt;
use App\Models\Expense;
use App\Models\Inventory;
use App\Models\Payroll;
use App\Models\Service;
use App\Models\Setting;
use App\Models\Transaction;
use App\Models\User;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

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

    /**
     * Bootstrap services.
     */
    public function boot(): void
    {
        Route::bind('barbershop', fn (string $barbershop) => Barbershop::findOrFail(decryptId($barbershop)));
        Route::bind('user', fn (string $user) => User::findOrFail(decryptId($user)));
        Route::bind('customer', fn (string $customer) => Customer::findOrFail(decryptId($customer)));
        Route::bind('service', fn (string $service) => Service::findOrFail(decryptId($service)));
        Route::bind('expense', fn (string $expense) => Expense::findOrFail(decryptId($expense)));
        Route::bind('payroll', fn (string $payroll) => Payroll::findOrFail(decryptId($payroll)));
        Route::bind('cash', fn (string $cash) => Cash::findOrFail(decryptId($cash)));
        Route::bind('debt', fn (string $debt) => Debt::findOrFail(decryptId($debt)));
        Route::bind('inventory', fn (string $inventory) => Inventory::findOrFail(decryptId($inventory)));
        Route::bind('transaction', fn (string $transaction) => Transaction::findOrFail(decryptId($transaction)));
        Route::bind('application', fn (string $application) => Setting::findOrFail(decryptId($application)));
    }
}
