import 'package:kmobile/features/service/screens/branch_locator_screen.dart';
import 'package:kmobile/features/service/screens/daily_transaction_limit.dart';
import '../../../l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import 'package:kmobile/features/service/screens/quick_links_screen.dart';
import 'package:kmobile/features/service/screens/faqs_screen.dart';

class ServiceScreen extends StatefulWidget {
  const ServiceScreen({super.key});

  @override
  State<ServiceScreen> createState() => _ServiceScreen();
}

class _ServiceScreen extends State<ServiceScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        automaticallyImplyLeading: false,
        title: Text(
          AppLocalizations.of(context).services,
        ),
        centerTitle: false,
      ),
      body: ListView(
        children: [
          ServiceManagementTile(
            icon: Symbols.add,
            label: AppLocalizations.of(context).accountOpeningDeposit,
            onTap: () {},
            disabled: true,
          ),
          const Divider(height: 1),
          ServiceManagementTile(
            icon: Symbols.add,
            label: AppLocalizations.of(context).accountOpeningLoan,
            onTap: () {},
            disabled: true,
          ),
          const Divider(height: 1),
          ServiceManagementTile(
            icon: Symbols.currency_rupee,
            label: AppLocalizations.of(context).dailylimit,
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute(
                    builder: (context) => const DailyLimitScreen()),
              );
            },
            disabled: true,
          ),
          const Divider(height: 1),
          ServiceManagementTile(
            icon: Symbols.captive_portal,
            label: AppLocalizations.of(context).quickLinks,
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute(
                    builder: (context) => const QuickLinksScreen()),
              );
            },
            disabled: true,
          ),
          const Divider(height: 1),
          ServiceManagementTile(
            icon: Symbols.question_mark,
            label: AppLocalizations.of(context).faq,
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute(builder: (context) => const FaqsScreen()),
              );
            },
            disabled: true,
          ),
          const Divider(height: 1),
          ServiceManagementTile(
            icon: Symbols.location_pin,
            label: AppLocalizations.of(context).branchLocator,
            onTap: () {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (context) => const BranchLocatorScreen()));
            },
            disabled: true,
          ),
          const Divider(height: 1),
        ],
      ),
    );
  }
}

class ServiceManagementTile extends StatelessWidget {
  final IconData icon;
  final String label;
  final VoidCallback onTap;
  final bool disabled;

  const ServiceManagementTile({
    super.key,
    required this.icon,
    required this.label,
    required this.onTap,
    this.disabled = false,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    return ListTile(
      leading: Icon(
        icon,
        color: disabled ? theme.disabledColor : null,
      ),
      title: Text(
        label,
        style: TextStyle(
          color: disabled ? theme.disabledColor : null,
        ),
      ),
      trailing: Icon(
        Symbols.arrow_right,
        size: 20,
        color: disabled ? theme.disabledColor : null,
      ),
      onTap: disabled ? null : onTap,
    );
  }
}
