<?php

namespace App\Classes\Modules\Segments\Standards\Rules;

use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
use App\Classes\Modules\Segments\Standards\Validators\ConstantValidation;

class CanCreateConstant extends AbstractRule
{

    /** @var ConstantValidation */
    private $constantValidation;

    /**
     * CanCreateConstant constructor.
     * @param ConstantValidation $constantValidation
     */
    public function __construct(ConstantValidation $constantValidation)
    {
        $this->constantValidation = $constantValidation;
    }


    /**
     * @return bool
     */
    protected function authorized($object): bool
    {
        // TODO  Set Authorization rules
        return true;


    }

    /**
     * @param ConstantObject $object
     * @return bool
     * @throws \App\Classes\Exceptions\RequestValidationException
     */
    protected function validators($object): bool
    {
        return $this->constantValidation->validate($object, 'POST');
    }

    /**
     * @param ConstantObject $object
     * @return bool
     */
    protected function criteria($object): bool
    {
        return true;
    }
}