<?php

namespace App\Policies;

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

class CancellationRequestPolicy
{
    use HandlesAuthorization;

    /**
     * Genel liste izni
     */
    public function viewAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('view cancellation requests');
    }

    /**
     * Spesifik kayıt izni
     */
    public function view(Admin $admin, CancellationRequest $cancellationRequest): bool
    {
        return $admin->hasPermissionTo('view cancellation requests');
    }

    /**
     * Oluşturma izni
     */
    public function create(Admin $admin): bool
    {
        return $admin->hasPermissionTo('create cancellation requests');
    }

    /**
     * Spesifik kayıt güncelleme izni
     */
    public function update(Admin $admin, CancellationRequest $cancellationRequest): bool
    {
        return $admin->hasPermissionTo('update cancellation requests');
    }

    /**
     * Genel güncelleme izni
     */
    public function updateAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('update cancellation requests');
    }

    /**
     * Spesifik kayıt silme izni
     */
    public function delete(Admin $admin, CancellationRequest $cancellationRequest): bool
    {
        return $admin->hasPermissionTo('delete cancellation requests');
    }

    /**
     * Genel silme izni
     */
    public function deleteAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('delete cancellation requests');
    }

    /**
     * İptal talebini onaylama izni
     */
    public function approve(Admin $admin, CancellationRequest $cancellationRequest): bool
    {
        return $admin->hasPermissionTo('approve cancellation requests');
    }

    /**
     * İptal talebini reddetme izni
     */
    public function reject(Admin $admin, CancellationRequest $cancellationRequest): bool
    {
        return $admin->hasPermissionTo('reject cancellation requests');
    }

    /**
     * İptal talebini iptal etme izni
     */
    public function cancel(Admin $admin, CancellationRequest $cancellationRequest): bool
    {
        return $admin->hasPermissionTo('cancel cancellation requests');
    }
}
