<?php

namespace App\Classes\Modules\Contacts\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Models\Contact;

class UpdatesContact extends AbstractUpdateRecord
{

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

        $model->company_id = $object->getCompanyId();
        $model->name = $object->getName();
        $model->designation = $object->getDesignation();
        $model->email = $object->getEmail();
        $model->phone = $object->getPhone();
        $model->wechat_id = $object->getWechatId();

        return $this->handler($model);

    }
}