import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';

/// A view to display when a rapid order has been successfully created.
class RapidOrderSuccessView extends StatelessWidget {
  /// Creates a [RapidOrderSuccessView].
  const RapidOrderSuccessView({
    required this.title,
    required this.message,
    required this.buttonLabel,
    required this.onDone,
    super.key,
  });

  /// The title of the success message.
  final String title;

  /// The body of the success message.
  final String message;

  /// Label for the completion button.
  final String buttonLabel;

  /// Callback when the completion button is tapped.
  final VoidCallback onDone;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: double.infinity,
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
            colors: <Color>[
              UiColors.primary,
              UiColors.primary.withValues(alpha: 0.85),
            ],
          ),
        ),
        child: SafeArea(
          child: Center(
            child: Container(
              margin: const EdgeInsets.symmetric(
                horizontal: UiConstants.space10,
              ),
              padding: const EdgeInsets.all(UiConstants.space8),
              decoration: BoxDecoration(
                color: UiColors.white,
                borderRadius: UiConstants.radiusLg,
                boxShadow: <BoxShadow>[
                  BoxShadow(
                    color: UiColors.black.withValues(alpha: 0.2),
                    blurRadius: 20,
                    offset: const Offset(0, 10),
                  ),
                ],
              ),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  Container(
                    width: 64,
                    height: 64,
                    decoration: const BoxDecoration(
                      color: UiColors.accent,
                      shape: BoxShape.circle,
                    ),
                    child: const Center(
                      child: Icon(
                        UiIcons.zap,
                        color: UiColors.textPrimary,
                        size: 32,
                      ),
                    ),
                  ),
                  const SizedBox(height: UiConstants.space6),
                  Text(title, style: UiTypography.headline1m.textPrimary),
                  const SizedBox(height: UiConstants.space3),
                  Text(
                    message,
                    textAlign: TextAlign.center,
                    style: UiTypography.body2r.copyWith(
                      color: UiColors.textSecondary,
                      height: 1.5,
                    ),
                  ),
                  const SizedBox(height: UiConstants.space8),
                  SizedBox(
                    width: double.infinity,
                    child: UiButton.primary(
                      text: buttonLabel,
                      onPressed: onDone,
                      size: UiButtonSize.large,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
