<?php

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

use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Announcements\Standards\Validators\AnnouncementValidation;
use App\Classes\Modules\Companies\DataTransferObjects\AnnouncementObject;

class CanCreateAnnouncement extends AbstractRule
{

    /** @var AnnouncementValidation */
    private $AnnouncementValidation;

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

    /**
     * @return bool
     */
    protected function authorized(): bool
    {
        return true;
    }

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

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