<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Standards\Validators\PackingListPackageValidation;

class CanCreatePackingListPackage extends AbstractRule
{

    /** @var PackingListPackageValidation */
    private $packingListPackageValidation;

    /**
     * CanCreatePackingListPackage constructor.
     * @param PackingListPackageValidation $packingListPackageValidation
     */
    public function __construct(PackingListPackageValidation $packingListPackageValidation)
    {
        $this->packingListPackageValidation = $packingListPackageValidation;
    }


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

    }

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

    }


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

}
