import type { ActivityType } from '../../activities/types/activity.types.js';
import type { LeadStatus } from '../../leads/types/lead.types.js';

export type DashboardSummary = {
  leads: number;
  /** Leads not in WON or LOST. */
  openLeads: number;
  wonLeads: number;
  companies: number;
  /** Leads that have an email and/or phone (contactable people). Not a separate Contact model. */
  contacts: number;
};

export type DashboardPipelineItem = {
  status: LeadStatus;
  count: number;
};

export type DashboardActivityItem = {
  id: string;
  type: ActivityType;
  title: string;
  leadId: string;
  leadName: string;
  createdAt: unknown;
};

export type DashboardLeadItem = {
  id: string;
  firstName: string;
  lastName: string | null;
  email: string | null;
  status: LeadStatus;
  createdAt: unknown;
};

export type DashboardResponse = {
  summary: DashboardSummary;
  /**
   * Contacts = count of visible leads that have an email and/or phone.
   * There is no separate Contact entity in the schema.
   */
  contactsMeaning: string;
  pipeline: DashboardPipelineItem[];
  recentActivities: DashboardActivityItem[];
  recentLeads: DashboardLeadItem[];
};
