<?php

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


use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Standards\Validators\ContactValidation;

class CanCreateContact extends AbstractRule
{

    /** @var ContactValidation */
    private $contactValidation;


    /**
     * CanCreateContact constructor.
     * @param ContactValidation $contactValidation
     */
    public function __construct(ContactValidation $contactValidation)
    {
        $this->contactValidation = $contactValidation;
    }

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

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

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

}