<?php

namespace App\Classes\Modules\Bookings\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Bookings\DataTransferObjects\BookingObject;
use App\Models\Booking;

class UpdatesBooking extends AbstractUpdateRecord
{

    /**
     * @param Booking $model
     * @param BookingObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Booking $model, BookingObject $object) 
    {
        $model->bank_id = $object->getTransferableBankId();
        $model->marking = $object->getMarking();
        $model->fix_amount = $object->getFixAmount();
        $model->fix_currency_id = $object->getFixCurrencyId();
        $model->convertible_currency_id = $object->getConvertibleCurrencyId();
        $model->conversion_currency_id = $object->getConversionCurrencyId();
        return $this->handler($model);
    }
}