<?php

namespace App\Domains\Admin\Actions\UpdateTenantContact;

class UpdateTenantContactAction
{
    public function __construct(private UpdateTenantContactRequest $request)
    {
    }

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

        $this->request->tenant->update([
            'email' => $this->request->email,
            'email_finance' => $this->request->emailFinance,
            'postcode' => $this->request->postcode,
            'city' => $this->request->city,
        ]);

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

        return $response;
    }
}
