<?php

namespace App\Classes\Modules\Receipts\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptObject;
use App\Models\Receipt;

class CreatesReceipt extends AbstractUpdateRecord
{
    /**
     * @param ReceiptObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(ReceiptObject $object) {
        $model = new Receipt();
        $model->bill_no = $object->getBillNo();
        $model->trans_type1 = $object->getTransType1();
        $model->trans_type2 = $object->getTransType2();
        $model->amount = $object->getAmount();
        $model->currency_id = $object->getCurrency();
        $model->original_amount = $object->getOriginalAmount();
        $model->original_currency_id = $object->getOriginalCurrency();
        $model->currency_rate = $object->getCurrencyRate();
        $model->dt_transaction = $object->getDtTransaction();
        $model->status = $object->getStatus();
        $model->booking_id = $object->getBookingId();
        $model->company_id = $object->getCompanyId();
        

        return $this->handler($model);

    }
}