<?php

namespace App\Providers;

use App\Models\Plan;
use App\Models\SupportTicket;
use App\Models\Transaction;
use App\Models\Vendor;
use App\Policies\PlanPolicy;
use App\Policies\SupportTicketPolicy;
use App\Policies\TransactionPolicy;
use App\Policies\VendorPolicy;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The model to policy mappings for the application.
     *
     * @var array<class-string, class-string>
     */
    protected $policies = [
        Vendor::class => VendorPolicy::class,
        Plan::class => PlanPolicy::class,
        Transaction::class => TransactionPolicy::class,
        SupportTicket::class => SupportTicketPolicy::class,
    ];

    /**
     * Register any authentication / authorization services.
     */
    public function boot(): void
    {
        $this->registerPolicies();

        Gate::define('updateMappings', [PlanPolicy::class, 'updateMappings']);
    }
}
