<?php

namespace Mehrab\Payment\Policies;

use Illuminate\Auth\Access\HandlesAuthorization;
use Mehrab\RolePermission\Models\Permission;
use Mehrab\User\Models\User;

class SettlementPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    public function manage(User $user){
        return $user->hasPermissionTo(Permission::PERMISSION_MANAGE_PAYMENT);
    }

    public function index(User $user){
        return $user->hasAnyPermission([Permission::PERMISSION_MANAGE_PAYMENT,Permission::PERMISSION_EXPERT,Permission::PERMISSION_TEAM_LEADER]);
    }

    public function create(User $user){
        return $user->hasAnyPermission([Permission::PERMISSION_EXPERT,Permission::PERMISSION_TEAM_LEADER]);
    }

    public function edit(User $user){
        return $user->hasPermissionTo(Permission::PERMISSION_MANAGE_PAYMENT);
    }

}
