<?php

namespace App\Policies;

use App\Models\Admin;
use App\Models\Datacenter;
use Illuminate\Auth\Access\HandlesAuthorization;

class DatacenterPolicy
{
    use HandlesAuthorization;

    /**
     * Determine whether the user can view any models.
     */
    public function viewAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('view datacenters');
    }

    /**
     * Determine whether the user can view the model.
     */
    public function view(Admin $admin, Datacenter $datacenter): bool
    {
        return $admin->hasPermissionTo('view datacenters');
    }

    /**
     * Determine whether the user can create models.
     */
    public function create(Admin $admin): bool
    {
        return $admin->hasPermissionTo('create datacenters');
    }

    /**
     * Determine whether the user can update the model.
     */
    public function update(Admin $admin, Datacenter $datacenter): bool
    {
        return $admin->hasPermissionTo('update datacenters');
    }

    /**
     * Determine whether the user can update any models.
     */
    public function updateAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('update datacenters');
    }

    /**
     * Determine whether the user can delete the model.
     */
    public function delete(Admin $admin, Datacenter $datacenter): bool
    {
        return $admin->hasPermissionTo('delete datacenters');
    }

    /**
     * Determine whether the user can delete any models.
     */
    public function deleteAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('delete datacenters');
    }
}
