<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Documents\Standards\Validators\DocumentValidation;

class CanUpdateDocument extends AbstractRule
{

    /** @var DocumentValidation */
    private $documentValidation;

    /**
     * CanCreateAddress constructor.
     * @param DocumentValidation $documentValidation
     */
    public function __construct(DocumentValidation $documentValidation)
    {
        $this->documentValidation = $documentValidation;
    }

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

    /**
     * @param DocumentObject $object
     * @return bool
     * @throws \App\Classes\Exceptions\RequestValidationException
     */
    protected function validators($object): bool
    {
        return $this->documentValidation->validate($object);
    }

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

}