<?php

namespace App\Domains\Admin\Actions\UpdateTenantGeneral;

class UpdateTenantGeneralAction
{
    public function __construct(private UpdateTenantGeneralRequest $request)
    {
    }

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

        $this->request->tenant->update([
            'name' => $this->request->name,
            'slug' => $this->request->slug,
            'url' => $this->request->url,
        ]);

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

        return $response;
    }
}
