<?php

namespace Bixo\Asset\Policies;

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

trait AssetWorkflow
{

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

}