<?php

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

use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\Standards\Validators\CompanyModuleValidation;

class CanCreateCompanyModule extends AbstractRule
{
    /** @var CompanyValidation */
    private $companyModuleValidation;


    /**
     * CanCreateCompany constructor.
     * @param CompanyValidation $companyValidation
     */
    public function __construct(CompanyModuleValidation $companyModuleValidation)
    {
        $this->companyModuleValidation = $companyModuleValidation;
    }

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

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

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