<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Documents\DataTransferObjects\FileObject;
use App\Classes\Modules\Documents\Standards\Validators\FileValidation;

class CanCreateFile extends AbstractRule
{

    /** @var FileValidation */
    private $fileValidation;

    /**
     * CanCreateFile constructor.
     * @param FileValidation $fileValidation
     */
    public function __construct(FileValidation $fileValidation)
    {
        $this->fileValidation = $fileValidation;
    }

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

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

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

}