<?php

namespace Ammar\MArn\Workflow;

use Ammar\MArn\Models\Myrte;
use Validator;

class MyrteValidator
{

    /**
     * Determine if the given myrte is valid for complete status.
     *
     * @param Myrte $myrte
     *
     * @return bool / Validator
     */
    public function complete(Myrte $myrte)
    {
        return Validator::make($myrte->toArray(), [
            'title' => 'required|min:15',
        ]);
    }

    /**
     * Determine if the given myrte is valid for verify status.
     *
     * @param Myrte $myrte
     *
     * @return bool / Validator
     */
    public function verify(Myrte $myrte)
    {
        return Validator::make($myrte->toArray(), [
            'title'  => 'required|min:15',
            'status' => 'in:complete',
        ]);
    }

    /**
     * Determine if the given myrte is valid for approve status.
     *
     * @param Myrte $myrte
     *
     * @return bool / Validator
     */
    public function approve(Myrte $myrte)
    {
        return Validator::make($myrte->toArray(), [
            'title'  => 'required|min:15',
            'status' => 'in:verify',
        ]);

    }

    /**
     * Determine if the given myrte is valid for publish status.
     *
     * @param Myrte $myrte
     *
     * @return bool / Validator
     */
    public function publish(Myrte $myrte)
    {
        return Validator::make($myrte->toArray(), [
            'title'       => 'required|min:15',
            'description' => 'required|min:50',
            'status'      => 'in:approve,archive,unpublish',
        ]);

    }

    /**
     * Determine if the given myrte is valid for archive status.
     *
     * @param Myrte $myrte
     *
     * @return bool / Validator
     */
    public function archive(Myrte $myrte)
    {
        return Validator::make($myrte->toArray(), [
            'title'       => 'required|min:15',
            'description' => 'required|min:50',
            'status'      => 'in:approve,publish,unpublish',
        ]);

    }

    /**
     * Determine if the given myrte is valid for unpublish status.
     *
     * @param Myrte $myrte
     *
     * @return bool / Validator
     */
    public function unpublish(Myrte $myrte)
    {
        return Validator::make($myrte->toArray(), [
            'title'       => 'required|min:15',
            'description' => 'required|min:50',
            'status'      => 'in:publish',
        ]);

    }
}