<?php

namespace App\Classes\Modules\Milestones\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Milestones\DataTransferObjects\MilestoneObject;
use App\Models\Milestone;

class CreatesMilestone extends AbstractUpdateRecord
{
    /**
     * @param MilestoneObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\AccessForbiddenException
     * @throws \App\Classes\Exceptions\MalformedRequestException
     * @throws \App\Classes\Exceptions\RequestValidationException
     */
    public function execute(MilestoneObject $object) {
        $model = new Milestone();
        $model->name = $object->getName();
        $model->description = $object->getDescription();

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