<?php

namespace App\Policies;

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

class LanguagePolicy
{
    use HandlesAuthorization;

    /**
     * Dilleri listeleme izni
     */
    public function viewAny(Admin $admin): bool
    {
        return $admin->hasPermissionTo('view languages');
    }

    /**
     * Belirli bir dil kaydını görüntüleme izni
     */
    public function view(Admin $admin, Language $language): bool
    {
        return $admin->hasPermissionTo('view languages');
    }

    /**
     * Yeni dil ekleme izni
     */
    public function create(Admin $admin): bool
    {
        return $admin->hasPermissionTo('create languages');
    }

    /**
     * Belirli bir dili güncelleme izni
     */
    public function update(Admin $admin, Language $language): bool
    {
        return $admin->hasPermissionTo('update languages');
    }

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

    /**
     * Belirli bir dili silme izni
     */
    public function delete(Admin $admin, Language $language): bool
    {
        return $admin->hasPermissionTo('delete languages');
    }

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