<?php

namespace App\Policies;

use App\Models\ExpenseType;
use App\Models\User;

class ExpenseTypePolicy
{
    public function update(User $user, ExpenseType $expenseType): bool
    {
        return $user->isSuperAdmin() || $user->id === $expenseType->user_id;
    }

    public function delete(User $user, ExpenseType $expenseType): bool
    {
        return $user->isSuperAdmin() || $user->id === $expenseType->user_id;
    }

    public function view(User $user, ExpenseType $expenseType): bool
    {
        return $user->isSuperAdmin() || $user->id === $expenseType->user_id || $expenseType->is_system;
    }

    public function viewAny(User $user): bool
    {
        return true;
    }
}
