import 'package:flutter/material.dart';
import 'package:dialer/presentation/features/settings/call/settings_call.dart';
import 'package:dialer/presentation/features/settings/cryptography/key_management.dart';
import 'package:dialer/presentation/features/settings/blocked/settings_blocked.dart';
import 'package:dialer/presentation/features/settings/sim/settings_sim.dart';

class SettingsPage extends StatelessWidget {
  const SettingsPage({super.key});

  void _navigateToSettings(BuildContext context, String setting) {
    switch (setting) {
      case 'Calling settings':
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => const SettingsCallPage()),
        );
        break;
      case 'Key management':
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => ManageKeysPage()),
        );
        break;
      case 'Blocked numbers':
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => const BlockedNumbersPage()),
        );
        break;
      case 'Default SIM':
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => const SettingsSimPage()),
        );
        break;
      // Add more cases for other settings pages
      default:
        // Handle default or unknown settings
        break;
    }
  }

  @override
  Widget build(BuildContext context) {
    final settingsOptions = [
      'Calling settings',
      'Key management',
      'Blocked numbers',
      'Default SIM',
    ];

    return Scaffold(
      backgroundColor: Colors.black,
      appBar: AppBar(
        title: const Text('Settings'),
      ),
      body: ListView.builder(
        itemCount: settingsOptions.length,
        itemBuilder: (context, index) {
          return ListTile(
            title: Text(
              settingsOptions[index],
              style: const TextStyle(color: Colors.white),
            ),
            trailing: const Icon(Icons.arrow_forward_ios, color: Colors.white),
            onTap: () {
              _navigateToSettings(context, settingsOptions[index]);
            },
          );
        },
      ),
    );
  }
}
