<?php

namespace App\Policies;

use App\Models\Billing;
use App\Models\User;

class BillingPolicy
{
    public function viewAny(User $user)
    {
        return $user->can('billing.view');
    }

    public function view(User $user, Billing $billing)
    {
        return $user->can('billing.view') && $user->canAccessCustomer($billing->customer);
    }

    public function create(User $user)
    {
        return $user->can('billing.create');
    }

    public function update(User $user, Billing $billing)
    {
        return $user->can('billing.update') && $user->canAccessCustomer($billing->customer);
    }

    public function delete(User $user, Billing $billing)
    {
        return $user->can('billing.delete') && $user->canAccessCustomer($billing->customer);
    }
}
