<?php

namespace App\Classes\Modules\Receipts\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptDetailObject;
use App\Models\ReceiptDetail;

class CreatesReceiptDetail extends AbstractUpdateRecord
{
    /**
     * @param ReceiptDetailObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(ReceiptDetailObject $object) {
        $model = new ReceiptDetail();
        $model->trans_type1 = $object->getTransType1();
        $model->trans_type2 = $object->getTransType2();
        $model->transaction_id = $object->getTransactionId();
        $model->receipt_id = $object->getReceiptId();
        $model->price = $object->getPrice();
        $model->amount = $object->getAmount();
        

        return $this->handler($model);

    }
}