import type { FilterDefinition } from '@/components/shared/filter-bar';
import { PIPELINE_STAGES, LEAD_CATEGORIES } from '@/lib/constants';

const STAGE_LABELS: Record<string, string> = {
  open: 'Open',
  details_sent: 'Details Sent',
  in_communication: 'In Communication',
  visited: 'Visited',
  signed_eoi_nda: 'Signed EOI/NDA',
  deposit_10pct: 'Deposit 10%',
  contract: 'Contract',
  completed: 'Completed',
};

const CATEGORY_LABELS: Record<string, string> = {
  general_interest: 'General Interest',
  specific_qualified: 'Specific Qualified',
  hot_lead: 'Hot Lead',
};

export const interestFilterDefinitions: FilterDefinition[] = [
  {
    key: 'search',
    label: 'Search',
    type: 'text',
    placeholder: 'Search interests...',
  },
  {
    key: 'pipelineStage',
    label: 'Stage',
    type: 'multi-select',
    options: PIPELINE_STAGES.map((s) => ({
      label: STAGE_LABELS[s] ?? s,
      value: s,
    })),
  },
  {
    key: 'leadCategory',
    label: 'Category',
    type: 'select',
    options: LEAD_CATEGORIES.map((c) => ({
      label: CATEGORY_LABELS[c] ?? c,
      value: c,
    })),
  },
  {
    key: 'source',
    label: 'Source',
    type: 'select',
    options: [
      { label: 'Website', value: 'website' },
      { label: 'Manual', value: 'manual' },
      { label: 'Referral', value: 'referral' },
      { label: 'Broker', value: 'broker' },
    ],
  },
  {
    key: 'eoiStatus',
    label: 'EOI Status',
    type: 'select',
    options: [
      { label: 'Waiting for Signatures', value: 'waiting_for_signatures' },
      { label: 'Signed', value: 'signed' },
      { label: 'Expired', value: 'expired' },
    ],
  },
  {
    key: 'includeArchived',
    label: 'Include Archived',
    type: 'boolean',
  },
];
