<?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\CompanyValidation;

class CanCreateCompany extends AbstractRule
{
    /** @var CompanyValidation */
    private $companyValidation;


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

    /**
     * @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->companyValidation->validate($object);
    }

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