<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Companies\Standards\Validators\CompanyToSegmentValidation;
use App\Classes\Modules\Companies\DataTransferObjects\CompanySegmentObject;

class CanAssignSegment extends AbstractRule
{
    /** @var CompanyToSegmentValidation */
    private $companyToSegmentValidation;

    /**
     * CanAssignSegment constructor.
     * @param CompanyToSegmentValidation $companyToSegmentValidation
     */
    public function __construct(CompanyToSegmentValidation $companyToSegmentValidation)
    {
        $this->companyToSegmentValidation = $companyToSegmentValidation;
    }

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

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

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

}
