<?php

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


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

class CanUpdatePackageItem extends AbstractRule
{

    /** @var ItemValidation */
    private $PackageItemValidation;

    /**
     * CanUpdatePackageItem 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 ItemObject $object
     * @return bool
     * @throws \App\Classes\Exceptions\RequestValidationException
     */
    protected function validators($object): bool
    {
        return $this->PackageItemValidation->validate($object);

    }


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

}
