<?php

namespace App\Classes\Modules\Banks\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
use App\Models\Bank;

class CreatesBank extends AbstractUpdateRecord
{
    /**
     * @param BankObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(BankObject $object) {

        $model = new Bank();
        $model->company_id = $object->getCompanyId();
        $model->reference = $object->getReference();
        $model->bank_name = $object->getBankName();
        $model->holder_name = $object->getHolderName();
        $model->account_no = $object->getAccountNo();
        $model->bank_branch = $object->getBankBranch();
        $model->swift = $object->getSwift();
        $model->snap = $object->getSnap();
        $model->type = $object->getType();
        $model->country_id = $object->getCountryId();

        return $this->handler($model);

    }
}