<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Companies\Standards\Validators\CompanyEmployeeValidation;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;

class CanAssignEmployee extends AbstractRule
{

    /** @var CompanyEmployeeValidation */
    private $companyEmployeeValidation;


    /**
     * CanCreateCompanyEmployee constructor.
     * @param CompanyEmployeeValidation $companyEmployeeValidation
     */
    public function __construct(CompanyEmployeeValidation $companyEmployeeValidation)
    {
        $this->companyEmployeeValidation = $companyEmployeeValidation;
    }

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

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

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

}