<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Standards\Validators\AddressValidation;

class CanUpdateAddress extends AbstractRule
{

    /** @var AddressValidation */
    private $addressValidation;

    /**
     * CanUpdateAddress constructor.
     * @param AddressValidation $addressValidation
     */
    public function __construct(AddressValidation $addressValidation)
    {
        $this->addressValidation = $addressValidation;
    }


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

    }

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

    }


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

}