<?php

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

use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
use App\Classes\Modules\Segments\Standards\Validators\SegmentValidation;

class CanCreateSegment extends AbstractRule
{
    /** @var SegmentValidation */
    private $segmentValidation;


    /**
     * CanCreateSegment constructor.
     * @param SegmentValidation $segmentValidation
     */
    public function __construct(SegmentValidation $segmentValidation)
    {
        $this->segmentValidation = $segmentValidation;
    }

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

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

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