import { useColorScheme } from 'react-native';
import { colors, darkColors } from '../constants/theme';
import { useThemeStore, ThemeMode } from '../store/themeStore';

export type AppColors = typeof colors;

export function useThemeColor(): { colors: AppColors; isDark: boolean; mode: ThemeMode } {
  const systemScheme = useColorScheme();
  const mode = useThemeStore((s) => s.mode);

  const isDark =
    mode === 'dark' || (mode === 'system' && systemScheme === 'dark');

  return {
    colors: isDark ? darkColors : colors,
    isDark,
    mode,
  };
}
