<?php

namespace App\Domains\Admin\Actions\UpdateTenantPayment;

class UpdateTenantPaymentAction
{
    public function __construct(private UpdateTenantPaymentRequest $request)
    {
    }

    public function execute(): UpdateTenantPaymentResponse
    {
        $response = new UpdateTenantPaymentResponse();

        $this->request->tenant->update([
            'account_iban' => $this->request->accountIban,
            'account_bic' => $this->request->accountBic,
            'account_name' => $this->request->accountName,
        ]);

        $response->success = true;
        $response->message = 'Bezahldaten wurden gespeichert.';

        return $response;
    }
}
