function parseBooleanFlag(value: string | undefined, defaultValue = false) {
  if (value == null) {
    return defaultValue;
  }

  const normalized = value.trim().toLowerCase();

  if (['1', 'true', 'yes', 'on', 'enabled'].includes(normalized)) {
    return true;
  }

  if (['0', 'false', 'no', 'off', 'disabled'].includes(normalized)) {
    return false;
  }

  return defaultValue;
}

export function isGeneralEnquiryEnabled() {
  return parseBooleanFlag(process.env.ENABLE_GENERAL_ENQUIRIES, false);
}
