<?php

namespace App\Providers;

use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;

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

    /**
     * Bootstrap services.
     */
    public function boot(): void
    {
        // General permissions...
        Gate::define('isMe', fn (User $user) => $user->isMe());
        Gate::define('isSuperAdmin', fn (User $user) => $user->isSuperAdmin());
        Gate::define('isAdmin', fn (User $user) => $user->isAdmin());
        Gate::define('isCurrencyMaintainer', fn (User $user) => $user->isCurrencyMaintainer());
        Gate::define('systemUser', fn (User $user) => $user->isSystemUser());
        Gate::define('notSystemUser', fn (User $user) => ! $user->isSystemUser());

        // Tooling permissions...
        // Gate::define('viewPulse', fn ($user) => $user->isAdmin());
        // Gate::define('viewApiDocs', fn ($user) => $user->canAccessApiDocs());
    }
}
