<?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 UpdatesBank extends AbstractUpdateRecord
{

    /**
     * @param Bank $model
     * @param BankObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Bank $model, BankObject $object)
    {
        $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->default = $object->getDefault();

        return $this->handler($model);
    }
}