<?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 CanUpdateConstant extends AbstractRule
{

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

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


    /**
     * @return bool
     */
    protected function authorized(): 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, 'PUT');
    }

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

}