library unionflow_design_system;

import 'package:flutter/material.dart';
import 'tokens/app_colors.dart';
import 'tokens/app_typography.dart';
import 'tokens/spacing_tokens.dart';

// ═══════════════════════════════════════════════════════════════════════════
// EXPORTS - Point d'entrée unique (DRY)
// ═══════════════════════════════════════════════════════════════════════════

export 'tokens/app_colors.dart';
export 'tokens/app_typography.dart';
export 'tokens/spacing_tokens.dart';
export 'theme/app_theme.dart';
export 'components/components.dart';

// ═══════════════════════════════════════════════════════════════════════════
// SHIMS DE COMPATIBILITÉ — Migration progressive vers design system unifié
// ═══════════════════════════════════════════════════════════════════════════

/// Shim ColorTokens — palette Vert Forêt/Ardoise
class ColorTokens {
  // Primaires
  static const Color primary = AppColors.primaryGreen;           // #2E7D32
  static const Color primaryLight = AppColors.brandGreenLight;   // #4CAF50
  static const Color primaryDark = AppColors.brandGreen;         // #1B5E20
  static const Color primaryContainer = Color(0xFFE8F5E9);
  static const Color onPrimary = Colors.white;
  static const Color onPrimaryContainer = AppColors.textPrimaryLight;

  // Secondaires
  static const Color secondary = AppColors.brandGreenLight;
  static const Color secondaryContainer = Color(0xFFC8E6C9);
  static const Color onSecondary = Colors.white;
  static const Color onSecondaryContainer = AppColors.textPrimaryLight;

  // Tertiaires
  static const Color tertiary = AppColors.brandMint;
  static const Color tertiaryContainer = Color(0xFFDCEDC8);
  static const Color onTertiary = Colors.white;

  // Surfaces
  static const Color surface = AppColors.lightSurface;
  static const Color surfaceVariant = AppColors.lightBackground;
  static const Color surfaceContainer = AppColors.lightSurface;
  static const Color background = AppColors.lightBackground;
  static const Color onSurface = AppColors.textPrimaryLight;
  static const Color onSurfaceVariant = AppColors.textSecondaryLight;
  static const Color outline = AppColors.lightBorder;
  static const Color outlineVariant = Color(0xFFDCEDC8);

  // Erreur / succès
  static const Color error = AppColors.error;
  static const Color onError = Colors.white;
  static const Color errorContainer = Color(0xFFFEF2F2);
  static const Color success = AppColors.success;
  static const Color onSuccess = Colors.white;
  static const Color warning = AppColors.warning;
  static const Color info = AppColors.info;

  // Navigation
  static const Color navigationBackground = AppColors.lightSurface;
  static const Color navigationSelected = AppColors.primaryGreen;
  static const Color navigationUnselected = AppColors.textSecondaryLight;
  static const Color navigationIndicator = Color(0xFFE8F5E9);

  // Ombres
  static const Color shadow = Color(0x1A1C2B1C);
  static const Color shadowMedium = Color(0x331C2B1C);

  // Verre / glassmorphism
  static const Color glassBackground = Color(0x80FFFFFF);
  static const Color glassBorder = Color(0x33FFFFFF);

  // Gradients
  static const List<Color> primaryGradient = [
    AppColors.brandGreen,
    AppColors.primaryGreen,
    Color(0xFF388E3C),
  ];
}

/// Shim ShadowTokens
class ShadowTokens {
  static const List<BoxShadow> sm = [
    BoxShadow(
      color: Color(0x1A1C2B1C),
      blurRadius: 4,
      offset: Offset(0, 2),
    ),
  ];
  static const List<BoxShadow> md = [
    BoxShadow(
      color: Color(0x261C2B1C),
      blurRadius: 8,
      offset: Offset(0, 4),
    ),
  ];
  static const List<BoxShadow> primary = md;
}

/// Shim RadiusTokens
class RadiusTokens {
  static const double sm = SpacingTokens.radiusSm;
  static const double md = SpacingTokens.radiusMd;
  static const double lg = SpacingTokens.radiusLg;
  static const double xl = SpacingTokens.radiusXl;
  static const double circular = SpacingTokens.radiusCircular;
  static const double round = SpacingTokens.radiusCircular;
}

/// Shim TypographyTokens
class TypographyTokens {
  // Display (Playfair Display via AppTypography getters — non-const)
  static TextStyle get displayLarge => AppTypography.displayLarge;
  static TextStyle get displayMedium => AppTypography.displayMedium;
  static TextStyle get displaySmall => AppTypography.displaySmall;

  // Headlines
  static const TextStyle headlineLarge = AppTypography.headerLarge;
  static const TextStyle headlineMedium = AppTypography.headerSmall;
  static const TextStyle headlineSmall = AppTypography.titleMedium;

  // Titles
  static const TextStyle titleLarge = AppTypography.headerSmall;
  static const TextStyle titleMedium = AppTypography.titleMedium;
  static const TextStyle titleSmall = AppTypography.titleSmall;

  // Body
  static const TextStyle bodyLarge = AppTypography.bodyLarge;
  static const TextStyle bodyMedium = AppTypography.bodyMedium;
  static const TextStyle bodySmall = AppTypography.bodyTextSmall;

  // Labels
  static const TextStyle labelLarge = AppTypography.actionText;
  static const TextStyle labelMedium = AppTypography.labelMedium;
  static const TextStyle labelSmall = AppTypography.badgeText;

  // Buttons
  static const TextStyle buttonLarge = AppTypography.buttonLabel;
  static const TextStyle buttonMedium = AppTypography.actionText;

  // Cards
  static const TextStyle cardTitle = AppTypography.headerSmall;
  static const TextStyle cardSubtitle = AppTypography.bodyTextSmall;
  static const TextStyle cardValue = AppTypography.headerLarge;

  // Inputs
  static const TextStyle inputLabel = AppTypography.labelMedium;
  static const TextStyle inputText = AppTypography.bodyLarge;
  static const TextStyle inputHint = AppTypography.bodyTextSmall;

  // Navigation
  static const TextStyle navigationLabel = AppTypography.navLabel;
  static const TextStyle navigationLabelSelected = AppTypography.navLabelSelected;
}
