// ABOUTME: Application-wide constants and configuration values
// ABOUTME: Contains app metadata, database settings, theme colors, and health metric defaults
import 'package:flutter/material.dart';

/// Application constants and configuration
class AppConstants {
  // App Information
  static const String appName = 'Health Tracker';
  static const String appVersion = '1.1.7';
  static const String appDescription = 'Privacy-first health tracking app';
  
  // Database Configuration
  static const String databaseName = 'health_tracker.db';
  static const int databaseVersion = 1;
  
  // Table Names
  static const String weightEntriesTable = 'weight_entries';
  static const String bloodPressureEntriesTable = 'blood_pressure_entries';
  static const String moodEntriesTable = 'mood_entries';
}

/// Theme and UI constants
class ThemeConstants {
  // Primary Colors
  static const Color primaryGreen = Color(0xFF4CAF50);
  static const Color primaryGreenLight = Color(0xFF81C784);
  static const Color primaryGreenDark = Color(0xFF388E3C);
  
  // Accent Colors
  static const Color accentBlue = Color(0xFF2196F3);
  static const Color accentRed = Color(0xFFE53935);
  static const Color accentOrange = Color(0xFFFF9800);
  
  // Status Colors
  static const Color successColor = Color(0xFF4CAF50);
  static const Color warningColor = Color(0xFFFF9800);
  static const Color errorColor = Color(0xFFE53935);
  static const Color infoColor = Color(0xFF2196F3);
  
  // Chart Colors
  static const List<Color> chartColors = [
    Color(0xFF4CAF50), // Green
    Color(0xFF2196F3), // Blue  
    Color(0xFFFF9800), // Orange
    Color(0xFF9C27B0), // Purple
    Color(0xFFE91E63), // Pink
    Color(0xFF00BCD4), // Cyan
  ];
  
  // Common UI Values
  static const double borderRadius = 8.0;
  static const double cardElevation = 2.0;
  static const EdgeInsets defaultPadding = EdgeInsets.all(16.0);
  static const EdgeInsets smallPadding = EdgeInsets.all(8.0);
}

/// Default values for health metrics
class HealthDefaults {
  // Weight defaults
  static const double defaultWeight = 70.0; // kg
  static const double minWeight = 20.0; // kg (medical minimum)
  static const double maxWeight = 500.0; // kg (increased from 500 to support more cases)
  
  // Blood pressure defaults and ranges
  static const int defaultSystolic = 120;
  static const int defaultDiastolic = 80;
  static const int minBloodPressure = 50;
  static const int maxSystolic = 300;
  static const int maxDiastolic = 200;
  
  // Blood pressure categories (for reference)
  static const Map<String, Map<String, int>> bloodPressureCategories = {
    'normal': {'systolic_max': 119, 'diastolic_max': 79},
    'elevated': {'systolic_max': 129, 'diastolic_max': 79},
    'high_stage_1': {'systolic_max': 139, 'diastolic_max': 89},
    'high_stage_2': {'systolic_max': 179, 'diastolic_max': 119},
    'crisis': {'systolic_max': 999, 'diastolic_max': 999}, // Above 180/120
  };
  
  // Date and time formats
  static const String dateFormat = 'yyyy-MM-dd';
  static const String timeFormat = 'HH:mm';
  static const String dateTimeFormat = 'yyyy-MM-dd HH:mm';
}

/// Unit conversion constants
class UnitConstants {
  // Weight conversions (all to kg)
  static const double poundsToKg = 0.453592;
  static const double stonesToKg = 6.35029;
  static const double kgToPounds = 2.20462;
  static const double kgToStones = 0.157473;
  
  // Weight unit labels
  static const String kgUnit = 'kg';
  static const String poundsUnit = 'lbs';
  static const String stonesUnit = 'st';
  
  // Blood pressure units
  static const String mmHgUnit = 'mmHg';
}

/// Validation constants
class ValidationConstants {
  // Text field limits
  static const int notesMaxLength = 500;
  static const int weightDecimalPlaces = 1;
  
  // Error messages
  static const String requiredFieldError = 'This field is required';
  static const String invalidWeightError = 'Please enter a valid weight';
  static const String invalidBloodPressureError = 'Please enter valid blood pressure values';
  static const String futureDateError = 'Date cannot be in the future';
  static const String notesTooLongError = 'Notes cannot exceed 500 characters';
}
