<?php

namespace Bixo\Aml\Policies;

use Bixo\Aml\Models\Sanction;
use Illuminate\Foundation\Auth\User as Authenticatable;

trait SanctionWorkflow
{

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function approve(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.approve')) {
            return true;
        }

        return false;
    }

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function submit(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.submit')) {
            return true;
        }

        return false;
    }

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function publish(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.publish')) {
            return true;
        }

        return false;
    }

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function unpublish(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.unpublish')) {
            return true;
        }

        return false;
    }

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function archive(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.archive')) {
            return true;
        }

        return false;
    }

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function unarchive(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.unarchive')) {
            return true;
        }

        return false;
    }

    /**
     * Determine if the given user can approve the given sanction.
     *
     * @param Authenticatable $user
     *
     * @return bool
     */
    public function reject(Authenticatable $user, Sanction $sanction)
    {
        if ($user->canDo('aml.sanction.reject')) {
            return true;
        }

        return false;
    }

}