<?php

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


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

class CanUpdatePackage extends AbstractRule
{

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

    /**
     * CanUpdatePackage constructor.
     * @param PackageValidation $PackageValidation
     */
    public function __construct(PackageValidation $PackageValidation)
    {
        $this->PackageValidation = $PackageValidation;
    }


    /**
     * @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->PackageValidation->validate($object);

    }


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

}
