import { computed } from 'vue'
import { useAlertQualityStore } from './alertQuality'

/**
 * Compatibility shim for pre–Phase 33 feedback consumers.
 * Feedback submission and analytics now live in useAlertQualityStore;
 * /feedback redirects to /analytics/alerts.
 */
export function useFeedbackStore() {
  const store = useAlertQualityStore()
  return {
    entries: computed(() => []),
    stats: computed(() => ({
      total: store.summaryStats.totalFeedback,
      usefulPct: store.summaryStats.usefulRate,
      fpPct: store.summaryStats.falsePositiveRate,
    })),
    byAlertType: computed(() => store.byAlertType),
    addFeedback: (alertId, _type, _severity, rating, notes) =>
      store.submitFeedback(alertId, rating, notes),
    getFeedback: store.getFeedback,
    exportAsJson: () => {},
    exportAsCsv: () => {},
    clearAll: () => {},
  }
}
