<?php

namespace App\Classes\Modules\Announcements\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Announcements\DataTransferObjects\AnnouncementObject;
use App\Models\Announcement;

class UpdatesAnnouncement extends AbstractUpdateRecord
{

    /**
     * @param Announcement $model
     * @param AnnouncementObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Announcement $model, AnnouncementObject $object)
    {
        $model->title = $object->getTitle();
        $model->description = $object->getDescription();
        $model->starting_on = $object->getStartingOn();
        $model->ending_on = $object->getEndingOn();

        return $this->handler($model);
    }
}