<?php

namespace Bixo\Feed\Policies;

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

trait FeedWorkflow
{

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

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

        return false;
    }

}