<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
use App\Classes\Modules\Accounts\Standards\Validators\UserCreateValidation;

class CanCreateUser extends AbstractRule
{

    /** @var UserCreateValidation */
    private $userCreateValidation;

    /**
     * CanCreateAddress constructor.
     * @param UserCreateValidation $userCreateValidation
     */
    public function __construct(UserCreateValidation $userCreateValidation)
    {
        $this->userCreateValidation = $userCreateValidation;
    }


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

    }

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

    }


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

}