import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:iop_console/iop_console.dart';

import 'client_bootstrap.dart';
import 'client_home_page.dart';
import 'control_plane_status_client.dart';
import 'iop_wire/client_wire_client.dart';
import 'src/integrations/nexo/nexo_notification_host_integration.dart';

Future<void> main() => runIopClient();

Future<void> applyFullscreenMode() async {
  await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
  SystemChrome.setSystemUIOverlayStyle(
    const SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      systemNavigationBarColor: Colors.transparent,
      systemNavigationBarDividerColor: Colors.transparent,
    ),
  );
}

class IopClientApp extends StatelessWidget {
  final ClientWireClient? testClient;
  final NexoNotificationHostIntegration? notificationHost;
  final ControlPlaneStatusRepository? statusRepository;

  const IopClientApp({
    super.key,
    this.testClient,
    this.notificationHost,
    this.statusRepository,
  });

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IOP Client',
      debugShowCheckedModeBanner: false,
      theme: ThemeData.dark(useMaterial3: true).copyWith(
        colorScheme: ColorScheme.fromSeed(
          seedColor: const Color(0xFF6366F1),
          brightness: Brightness.dark,
          primary: const Color(0xFF6366F1),
          secondary: const Color(0xFF10B981),
        ),
        scaffoldBackgroundColor: const Color(0xFF0F172A),
      ),
      home: ClientHomePage(
        testClient: testClient,
        notificationHost: notificationHost,
        statusRepository: statusRepository,
      ),
    );
  }
}
