// ── Flow Proposals (Knowledge Flywheel / Review Queue) ──

export interface FlowProposalSummary {
  id: string
  proposal_type: 'new_flow' | 'enhancement' | 'branch_addition' | 'auto_reinforced'
  title: string
  description: string | null
  problem_domain: string | null
  confidence_score: number
  supporting_session_count: number
  status: 'pending' | 'approved' | 'modified' | 'rejected' | 'dismissed' | 'auto_reinforced'
  target_flow_id: string | null
  source_session_id: string
  created_at: string
}

export interface FlowProposalDetail extends FlowProposalSummary {
  proposed_flow_data: Record<string, unknown>
  proposed_diff: Record<string, unknown> | null
  supporting_session_ids: string[]
  reviewer_notes: string | null
  reviewed_by: string | null
  reviewed_at: string | null
}

export interface ReviewProposalRequest {
  action: 'approve' | 'reject' | 'modify' | 'dismiss'
  reviewer_notes?: string | null
  modified_flow_data?: Record<string, unknown> | null
}

export interface FlowProposalStats {
  pending_count: number
  approved_this_week: number
  rejected_this_week: number
  auto_reinforced_this_week: number
  top_domains: Array<{ domain: string; count: number }>
}
