import { DealStage } from '@prisma/client';

export const DEAL_STAGES: readonly DealStage[] = [DealStage.QUALIFICATION, DealStage.NEEDS_ANALYSIS, DealStage.PROPOSAL, DealStage.NEGOTIATION, DealStage.CLOSED_WON, DealStage.CLOSED_LOST];

export const OPEN_DEAL_STAGES: readonly DealStage[] = [DealStage.QUALIFICATION, DealStage.NEEDS_ANALYSIS, DealStage.PROPOSAL, DealStage.NEGOTIATION];

export const STAGE_PROBABILITY: Record<DealStage, number> = {
  QUALIFICATION: 10,
  NEEDS_ANALYSIS: 25,
  PROPOSAL: 50,
  NEGOTIATION: 75,
  CLOSED_WON: 100,
  CLOSED_LOST: 0,
};

export const STAGE_LABEL: Record<DealStage, string> = {
  QUALIFICATION: 'Qualification',
  NEEDS_ANALYSIS: 'Needs analysis',
  PROPOSAL: 'Proposal',
  NEGOTIATION: 'Negotiation',
  CLOSED_WON: 'Closed won',
  CLOSED_LOST: 'Closed lost',
};

export const ENGAGEMENT_MODELS = ['Fixed price', 'Time and materials', 'Retainer', 'Dedicated team'] as const;

export const LOSS_REASONS = ['Price / budget', 'Lost to competitor', 'Timeline / urgency', 'Scope / capability gap', 'No decision / stalled', 'Other'] as const;

export const DEAL_VIEWS = ['all', 'mine', 'closing', 'won', 'lost', 'board'] as const;
export type DealView = (typeof DEAL_VIEWS)[number];
export type DealTabView = Exclude<DealView, 'board'>;
export const DEAL_TAB_VIEWS: readonly DealTabView[] = ['all', 'mine', 'closing', 'won', 'lost'];

export const DEAL_SORT_FIELDS = ['title', 'stage', 'amount', 'closeDate', 'stageChangedAt', 'owner', 'createdAt'] as const;
export type DealSortField = (typeof DEAL_SORT_FIELDS)[number];
