<?php

declare(strict_types=1);

namespace App\Modules\Tenants\Controllers;

use App\Modules\Tenants\Services\TenantService;
use App\Modules\Tenants\Services\TenantRoleService;

class TenantConsoleController
{
    public function __construct(
        private readonly TenantService $tenantService,
        private readonly TenantRoleService $tenantRoleService
    ) {
    }

    public function index(): array
    {
        return [
            'view' => 'tenants.index',
            'data' => [
                'title' => 'Tenant Console',
                'overview' => $this->tenantService->adminOverview(),
                'roleOverview' => $this->tenantRoleService->roleOverview(),
            ],
        ];
    }

    public function roles(?string $tenantId = null): array
    {
        return [
            'view' => 'tenants.roles',
            'data' => [
                'title' => 'Tenant Rollen und Rechte',
                'overview' => $this->tenantRoleService->roleOverview($tenantId),
            ],
        ];
    }
}
