<?php

namespace Modules\User\Policies;

use Illuminate\Auth\Access\HandlesAuthorization;
use Modules\User\Entities\Employment;

class EmploymentPolicy
{
    use HandlesAuthorization;

    public function viewAny($user): bool
    {
        return true;
    }

    public function view($user, ?Employment $employement = null): bool
    {
        return $employement === null || $employement->user_id === $user->id;
    }

    public function create($user): bool
    {
        return true;
    }

    public function update($user, ?Employment $employement = null): bool
    {
        return $employement === null || $employement->user_id === $user->id;
    }

    public function deleteAny($user): bool
    {
        return true;
    }

    public function delete($user, ?Employment $employement = null): bool
    {
        return $employement === null || $employement->user_id === $user->id;
    }
}
