/** Consumer and messaging types (aligned with Rails ConsumerSerializer and conversation endpoints). */

export interface Consumer {
  id: number;
  email: string | null;
  phone: string | null;
  primary_identifier: string | null;
  contacts?: ConsumerContact[];
}

export interface ConsumerContact {
  id: number;
  display_name: string;
  account?: { id: number; name: string; slug?: string };
}

export interface ConversationSummary {
  contact_id: number;
  business?: { id: number; name: string; company_name?: string };
  last_message_at: string | null;
  last_message_preview?: string | null;
  message_count: number;
}

export interface Message {
  id: number;
  body: string | null;
  /** "outbound" = sent by the business; "inbound" = sent by the contact/member. */
  direction: 'inbound' | 'outbound';
  sender_type: 'contact' | 'agent' | 'human';
  sender_display_name?: string;
  created_at: string;
}

export interface ContactSummary {
  id: number;
  display_name: string;
  business?: { id: number; name: string; company_name?: string };
}
