<?php

namespace Bixo\Account\Policies;

use Bixo\Account\Models\Account;
use Illuminate\Foundation\Auth\User as Authenticatable;

trait AccountWorkflow
{

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

}