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

/// Container standardisé UnionFlow
/// 
/// Composant Container unifié avec styles prédéfinis.
/// Garantit la cohérence des espacements, rayons et ombres.
/// 
/// Usage:
/// ```dart
/// UFContainer(
///   child: Text('Contenu'),
/// )
/// 
/// UFContainer.rounded(
///   color: ColorTokens.primary,
///   child: Text('Contenu'),
/// )
/// 
/// UFContainer.elevated(
///   child: Text('Contenu'),
/// )
/// ```
class UFContainer extends StatelessWidget {
  final Widget child;
  final Color? color;
  final EdgeInsets? padding;
  final EdgeInsets? margin;
  final double? width;
  final double? height;
  final AlignmentGeometry? alignment;
  final BoxConstraints? constraints;
  final Gradient? gradient;
  final double borderRadius;
  final Border? border;
  final List<BoxShadow>? boxShadow;

  /// Container standard
  const UFContainer({
    super.key,
    required this.child,
    this.color,
    this.padding,
    this.margin,
    this.width,
    this.height,
    this.alignment,
    this.constraints,
    this.gradient,
    this.border,
    this.boxShadow,
  }) : borderRadius = SpacingTokens.radiusMd;

  /// Container avec coins arrondis
  const UFContainer.rounded({
    super.key,
    required this.child,
    this.color,
    this.padding,
    this.margin,
    this.width,
    this.height,
    this.alignment,
    this.constraints,
    this.gradient,
    this.border,
    this.boxShadow,
  }) : borderRadius = SpacingTokens.radiusMd;

  /// Container très arrondi
  const UFContainer.extraRounded({
    super.key,
    required this.child,
    this.color,
    this.padding,
    this.margin,
    this.width,
    this.height,
    this.alignment,
    this.constraints,
    this.gradient,
    this.border,
    this.boxShadow,
  }) : borderRadius = SpacingTokens.radiusLg;

  /// Container avec ombre
  UFContainer.elevated({
    super.key,
    required this.child,
    this.color,
    this.padding,
    this.margin,
    this.width,
    this.height,
    this.alignment,
    this.constraints,
    this.gradient,
    this.border,
  })  : borderRadius = SpacingTokens.radiusMd,
        boxShadow = null;

  /// Container circulaire
  const UFContainer.circular({
    super.key,
    required this.child,
    this.color,
    this.padding,
    this.margin,
    this.width,
    this.height,
    this.alignment,
    this.constraints,
    this.gradient,
    this.border,
    this.boxShadow,
  }) : borderRadius = SpacingTokens.radiusCircular;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width,
      height: height,
      padding: padding,
      margin: margin,
      alignment: alignment,
      constraints: constraints,
      decoration: BoxDecoration(
        color: gradient == null ? (color ?? Theme.of(context).colorScheme.surface) : null,
        gradient: gradient,
        borderRadius: BorderRadius.circular(borderRadius),
        border: border,
        boxShadow: boxShadow,
      ),
      child: child,
    );
  }
}

