<?php

namespace App\Domains\Admin\Controllers;

use App\Providers\InertiaProvider;
use App\Scopes\CommonController;
use Illuminate\Http\Request;
use Inertia\Response;

class TenantEditPageController extends CommonController
{
    public function __invoke(string $slug, Request $request): Response
    {
        $tenant = $this->adminTenants->findBySlug($slug);

        $inertiaProvider = new InertiaProvider('Admin/TenantEdit', [
            'tenant' => [
                'name' => $tenant->name,
                'slug' => $tenant->slug,
                'url' => $tenant->url,
                'is_active_local_group' => $tenant->is_active_local_group,
            ],
        ]);
        return $inertiaProvider->render();
    }
}
