export interface ContactSummaryData {
  readonly mostRecently: string | null;
  readonly overallSummary: string | null;
  readonly recap: string | null;
}

export interface Contact {
  readonly id: string;
  readonly deviceId: string;
  readonly handle: string;
  readonly displayName: string;
  readonly phoneNumbers: readonly string[];
  readonly emails: readonly string[];
  readonly rawData: string;
  readonly syncedAt: string;
  readonly updatedAt: string;
  readonly summaryData: ContactSummaryData | null;
  readonly summaryGeneratedAt: string | null;
}

export interface ContactDraft {
  readonly id: string;
  readonly deviceId: string;
  readonly handle: string;
  readonly displayName: string;
  readonly phoneNumbers: readonly string[];
  readonly emails: readonly string[];
  readonly rawData?: string;
}

/** What about the contact matched the query (drives ranking). */
export type ContactMatchField = 'display_name' | 'handle' | 'phone' | 'email';

/** Strength of the match — exact > prefix > substring. */
export type ContactMatchStrength = 'exact' | 'prefix' | 'substring';

export interface ContactSearchHit {
  readonly contact: Contact;
  readonly matchField: ContactMatchField;
  readonly matchStrength: ContactMatchStrength;
  /** 1.0 (exact display_name) … 0.0 (weakest substring). Drives unified ranking. */
  readonly rank: number;
}

export interface ContactSearchFilter {
  readonly query: string;
  readonly deviceId?: string;
  readonly limit?: number;
}
