const nodeEnv = normalizeNodeEnv(process.env.NODE_ENV || 'production');
const isDevelopment = nodeEnv === 'development';
const isProduction = nodeEnv === 'production';
const logEnabled = isDevelopment && parseBoolean(process.env.PHOTO_RENAMER_LOGS, true);

module.exports = {
  isDevelopment,
  isProduction,
  logEnabled,
  nodeEnv,
};

function normalizeNodeEnv(value) {
  return value === 'product' ? 'production' : value;
}

function parseBoolean(value, fallback) {
  if (value === undefined) return fallback;
  return ['1', 'true', 'yes', 'on'].includes(String(value).toLowerCase());
}
