// ignore_for_file: unused_import

import 'package:flutter/material.dart';
import 'package:kmobile/features/card/screens/block_card_screen.dart';
import 'package:kmobile/features/card/screens/card_details_screen.dart';
import 'package:kmobile/features/card/screens/card_pin_change_details_screen.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart';

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

  @override
  State<CardManagementScreen> createState() => _CardManagementScreen();
}

class _CardManagementScreen extends State<CardManagementScreen> {
  @override
  Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      automaticallyImplyLeading: false,
      title: Text(
        AppLocalizations.of(context).cardManagement,
      ),
      centerTitle: false,
    ),
    body: ListView(
      children: [
        CardManagementTile(
          icon: Symbols.add,
          label: AppLocalizations.of(context).applyDebitCard,
          onTap: () {},
          disabled: true, // Add this
        ),
        const Divider(height: 1),
        CardManagementTile(
          icon: Symbols.remove_moderator,
          label: AppLocalizations.of(context).blockUnblockCard,
          onTap: () {
            Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => const BlockCardScreen(),
                ),
              );
          },
          disabled: true, 
        ),
        const Divider(height: 1),
        CardManagementTile(
          icon: Symbols.password_2,
          label: AppLocalizations.of(context).changeCardPin,
          onTap: () {
            Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => const CardPinChangeDetailsScreen(),
                ),
              );
          },
          disabled: true, 
        ),
        const Divider(height: 1),
        CardManagementTile(
          icon: Symbols.payment_card,
          label: AppLocalizations.of(context).viewCardDeatils,
          onTap: () {
                Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => const CardDetailsScreen(),
                ),
              );
          },
          disabled: true, 
        ),
        const Divider(height: 1),
      ],
    ),
  );
 }  
}

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

  const CardManagementTile({
    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, 
    );
  }
}