<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\PackageItems\Standards\Validators\ItemValidation;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\Standards\Validators\PackageValidation;

class CanCreatePackageItem extends AbstractRule
{

    /** @var PackageValidation */
    private $packageItemValidation;

    /**
     * CanCreatePackage constructor.
     * @param ItemValidation $packageItemValidation
     */
    public function __construct(ItemValidation $packageItemValidation)
    {
        $this->packageItemValidation = $packageItemValidation;
    }


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

    }

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

    }


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

}
