<?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 CreatesContact extends AbstractUpdateRecord
{

    /**
     * @param ContactObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(ContactObject $object) {
        $model = new Contact();
        $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);

    }
}