<?php

namespace App\Classes\Modules\Transports\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Models\Transport;

class UpdatesTransport extends AbstractUpdateRecord
{

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

        $model->type = $object->getType();
        $model->courier = $object->getCourier();
        $model->tracking_number = $object->getTrackingNumber();
        $model->dispatch_date = $object->getDispatchDate();
        $model->drop_date = $object->getDropDate();
        $model->status = $object->getStatus();

        return $this->handler($model);

    }
}
