<?php

namespace App\Classes\Modules\Jobs\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Jobs\DataTransferObjects\UpdateJobResultObject;
use App\Models\JobResult;

class UpdatesJobResult extends AbstractUpdateRecord
{

    /**
     * @param JobResult $model
     * @param UpdateJobResultObject $updateJobResultObject
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(JobResult $model, UpdateJobResultObject $updateJobResultObject) {

        $model->result = $updateJobResultObject->getResult();
        $model->result_signature = $updateJobResultObject->getResultSignature();
        $model->job_command_name = $updateJobResultObject->getJobCommandName();
        $model->job_command = $updateJobResultObject->getJobCommand();

        return $this->handler($model);

    }
}
