/**
 * Application Constants
 * 
 * Centralized configuration constants to avoid magic numbers and strings.
 * Update these values to change application behavior.
 */

/**
 * Refetch intervals for different data types (in milliseconds)
 */
export const REFETCH_INTERVALS = {
  /** Dashboard data refresh interval */
  DASHBOARD: 10000, // 10 seconds
  /** Real-time data refresh interval */
  REAL_TIME: 5000, // 5 seconds
  /** Background data refresh interval (when tab is hidden) */
  BACKGROUND: 30000, // 30 seconds
} as const;

/**
 * API request configuration
 */
export const API_CONFIG = {
  /** Request timeout in milliseconds */
  TIMEOUT: 30000, // 30 seconds
  /** Maximum retry attempts for failed requests */
  MAX_RETRIES: 3,
  /** Retry delay multiplier (exponential backoff) */
  RETRY_DELAY_MULTIPLIER: 1000, // 1 second base delay
} as const;

/**
 * Pagination defaults
 */
export const PAGINATION = {
  /** Default page size */
  DEFAULT_PAGE_SIZE: 50,
  /** Maximum page size */
  MAX_PAGE_SIZE: 100,
  /** Page size options */
  PAGE_SIZE_OPTIONS: [10, 25, 50, 100] as const,
} as const;

/**
 * Debounce delays (in milliseconds)
 */
export const DEBOUNCE_DELAYS = {
  /** Search input debounce */
  SEARCH: 300,
  /** Filter changes debounce */
  FILTER: 500,
  /** Form input debounce */
  FORM_INPUT: 200,
} as const;

/**
 * Storage keys
 */
export const STORAGE_KEYS = {
  AUTH_TOKEN: 'auth_token',
  USER: 'user',
  THEME: 'theme',
  PREFERENCES: 'preferences',
} as const;

/**
 * Error messages
 */
export const ERROR_MESSAGES = {
  NETWORK_ERROR: 'Network error. Please check your connection.',
  UNAUTHORIZED: 'Session expired. Please login again.',
  FORBIDDEN: 'You do not have permission to perform this action.',
  NOT_FOUND: 'Resource not found.',
  SERVER_ERROR: 'Server error. Please try again later.',
  VALIDATION_ERROR: 'Validation error. Please check your input.',
  UNEXPECTED_ERROR: 'An unexpected error occurred.',
} as const;

/**
 * Success messages
 */
export const SUCCESS_MESSAGES = {
  SAVED: 'Changes saved successfully.',
  DELETED: 'Item deleted successfully.',
  CREATED: 'Item created successfully.',
  UPDATED: 'Item updated successfully.',
} as const;
