<?php

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


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

class CanUpdateAnnouncement extends AbstractRule
{

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


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

    /**
     * @return bool
     */
    protected function authorized(): bool
    {
        // TODO  Set Authorization rules
        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;
    }

}