<?php

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

use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Bookings\DataTransferObjects\BookingObject;
use App\Classes\Modules\Bookings\Standards\Validators\BookingValidation;

class CanCreateBooking extends AbstractRule
{

    /** @var BookingValidation */
    private $bookingValidation;


    /**
     * CanCreateBooking constructor.
     * @param BookingValidation $bookingValidation
     */
    public function __construct(BookingValidation $bookingValidation)
    {
        $this->bookingValidation = $bookingValidation;
    }

    /**
     * @return bool
     */
    protected function authorized(): bool
    {
        return true;
    }

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

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