<?php

namespace App\Policies;

use App\Models\SupportTicket;
use App\Models\User;

class SupportTicketPolicy
{
    public function before(User $user, string $ability): bool|null
    {
        return $user->hasRole('super-admin') ? true : null;
    }

    public function viewAny(User $user): bool
    {
        return $user->can('tickets.view');
    }

    public function update(User $user, SupportTicket $ticket): bool
    {
        return $user->can('tickets.manage');
    }

    public function create(User $user): bool
    {
        return $user->can('tickets.create') || $user->can('tickets.manage');
    }
}
