<?php

namespace App\Classes\Modules\Remarks\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
use App\Classes\General\Interfaces\Remarkable;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Models\Container;
use App\Models\Remark;
use App\Models\User;

class CreatesRemark extends AbstractUpdateRelationshipRecord
{

    /**
     * @param Remarkable $remarkable
     * @param RemarkObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Remarkable $remarkable, RemarkObject $object) {
        $model = new Remark();

        $model->commenter_id = $object->getCommenterId();
        $model->content = $object->getContent();

        return $this->handler($remarkable->remarks(), $model);

    }
}
