<?php

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

use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Orders\Standards\Validators\OrderValidation;

class CanCreateOrder extends AbstractRule
{
    /** @var OrderValidation  */
    private $orderValidation;

    public function __construct(OrderValidation $orderValidation)
    {
        $this->orderValidation = $orderValidation;
    }

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

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

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