import 'package:flutter/material.dart';
import '../../../core/theme/halo_tokens.dart';
import '../../../core/theme/widgets/halo_button.dart';

/// Floating banner injected above the chat input bar when the session timer
/// has hit zero but the session is still in `closing` grace. Phase 4 Stage 6:
/// gives the customer a soft, in-place way to extend instead of the modal-only
/// flow from Phase 3.
class ChatExpiredBanner extends StatelessWidget {
  final VoidCallback onExtend;

  const ChatExpiredBanner({super.key, required this.onExtend});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.fromLTRB(
        HaloSpacing.s12,
        HaloSpacing.s8,
        HaloSpacing.s12,
        HaloSpacing.s8,
      ),
      padding: const EdgeInsets.fromLTRB(
        HaloSpacing.s16,
        HaloSpacing.s12,
        HaloSpacing.s12,
        HaloSpacing.s12,
      ),
      decoration: const BoxDecoration(
        color: HaloTokens.danger,
        borderRadius: HaloRadius.lg,
        boxShadow: HaloShadows.card,
      ),
      child: Row(
        children: [
          const Text('⏰', style: TextStyle(fontSize: 20)),
          const SizedBox(width: HaloSpacing.s12),
          const Expanded(
            child: Text(
              'waktu curhat habis',
              style: TextStyle(
                fontFamily: HaloTokens.fontBody,
                fontSize: 14,
                fontWeight: FontWeight.w600,
                color: Colors.white,
              ),
            ),
          ),
          HaloButton(
            label: 'perpanjang',
            size: HaloButtonSize.sm,
            variant: HaloButtonVariant.secondary,
            onPressed: onExtend,
          ),
        ],
      ),
    );
  }
}
