<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Bookings\Standards\Validators\BookingSalesInvoiceValidation;
use App\Classes\Modules\Bookings\DataTransferObjects\UpdateBookingSalesInvoiceDTO;
use Illuminate\Support\Facades\Auth;

class CanUpdateBookingSalesInvoice extends AbstractRule
{

    /** @var BookingSalesInvoiceValidation */
    private $bookingSalesInvoiceValidation;


    /**
     * CanUpdateBookingSalesInvoice constructor.
     * @param UpdateBookingSalesInvoiceDTO $bookingSalesInvoiceValidation
     */
    public function __construct(BookingSalesInvoiceValidation $bookingSalesInvoiceValidation)
    {
        $this->bookingSalesInvoiceValidation = $bookingSalesInvoiceValidation;
    }

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

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

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

}
