<?php

namespace App\Http\Controllers;

class DemoController extends Controller
{
    public function index()
    {
        $pageConfigs = ['myLayout' => 'blank'];

        // Determine demo links based on multitenancy status
        $isSaaSMode = isSaaSMode();

        if ($isSaaSMode) {
            $demoLinks = [
                'superAdminPanelDemoLink' => config('variables.saasSuperAdminDemoLink'),
                'tenantPanelDemoLink' => config('variables.saasTenantPanelDemoLink'),
                'adminPanelDemoLink' => config('variables.saasTenantPanelDemoLink'),
            ];
        } else {
            $demoLinks = [
                'superAdminPanelDemoLink' => config('variables.superAdminPanelDemoLink'),
                'tenantPanelDemoLink' => null,
                'adminPanelDemoLink' => config('variables.adminPanelDemoLink'),
            ];
        }

        // Mobile app demo links (separate from web panel)
        if ($isSaaSMode) {
            $mobileAppLinks = [
                'employeeAppDemoLink' => config('variables.saasEmployeeAppDemoLink'),
                'managerAppDemoLink' => config('variables.saasManagerAppDemoLink'),
                'chatAppDemoLink' => null, // Coming soon
            ];
        } else {
            $mobileAppLinks = [
                'employeeAppDemoLink' => config('variables.employeeAppDemoLink'),
                'managerAppDemoLink' => config('variables.managerAppDemoLink'),
                'chatAppDemoLink' => null, // Coming soon
            ];
        }

        return view('demo.index', [
            'pageConfigs' => $pageConfigs,
            'isSaaSMode' => $isSaaSMode,
            'demoLinks' => $demoLinks,
            'mobileAppLinks' => $mobileAppLinks,
        ]);
    }
}
