export const features = {
  reports: {
    enabled: import.meta.env.VITE_FEATURE_REPORTS !== 'false',
    modules: {
      dashboard: true,
      invoices: true,
      bankCash: true,
      trialBalance: true,
      telegram: true,
      cacheStats: true
    }
  },
  dataEntry: {
    enabled: import.meta.env.VITE_FEATURE_DATA_ENTRY !== 'false',
    modules: {
      receipts: true,
      ocr: true
    }
  }
}

export function isFeatureEnabled(module, subModule = null) {
  if (!features[module]?.enabled) return false
  if (subModule && !features[module]?.modules?.[subModule]) return false
  return true
}

export function getEnabledMenuSections(menuSections) {
  return menuSections.filter(section => {
    if (section.title === 'Rapoarte') return features.reports.enabled
    if (section.title === 'Introduceri Date') return features.dataEntry.enabled
    return true // System section always visible
  })
}
