import 'package:flutter/material.dart';

import 'package:badges/badges.dart' as badges;

import 'package:pshared/models/payment/status.dart';

import 'package:pweb/utils/payment/status_view.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class OperationStatusBadge extends StatelessWidget {
  final OperationStatus status;

  const OperationStatusBadge({super.key, required this.status});

  @override
  Widget build(BuildContext context) {
    final l10n = AppLocalizations.of(context)!;
    final view = operationStatusView(
      l10n,
      Theme.of(context).colorScheme,
      status,
    );
    final label = view.label;
    final bg = view.backgroundColor;
    final fg = view.foregroundColor;

    return badges.Badge(
      badgeStyle: badges.BadgeStyle(
        shape: badges.BadgeShape.square,
        badgeColor: bg,
        borderRadius: BorderRadius.circular(12), // fully rounded
        padding: const EdgeInsets.symmetric(
          horizontal: 6,
          vertical: 2, // tighter padding
        ),
      ),
      badgeContent: Text(
        label.toUpperCase(), // or keep sentence case
        style: TextStyle(
          color: fg,
          fontSize: 11, // smaller text
          fontWeight: FontWeight.w500, // medium weight
        ),
      ),
    );
  }
}
