export interface FacebookCampaign {
  campaign_id: string;
  name: string;
  status: string;
  objective: string;
  daily_budget: string;
  start_time: string;
}

export interface FacebookForm {
  form_id: string;
  name: string;
  status: string;
}

/* Google Ads counterpart of FacebookCampaign — its own campaign cache
 * (google_campaigns), not the Facebook one. */
export interface GoogleCampaign {
  campaign_id: string;
  name: string;
  status: string;
  advertising_channel_type?: string;
  campaign_budget_micros?: number;
  start_date?: string;
}

/* A microsite plays the role a Facebook lead form plays — the thing a
 * campaign's ads actually point traffic at — just identified by URL. */
export interface GoogleMicrosite {
  microsite_url: string;
}

/* One row in the Campaigns list page — a distinct campaign/city combination
 * that already has a saved rotation in auto_lead_round_robin. */
export interface ConfiguredCampaign {
  campaign_id: string;
  name: string;
  source: string;
  city_id: number;
  city_name: string;
  is_active: boolean;
}

export interface SalesTeamMember {
  field_sales_id: number;
  field_sales_name: string;
  field_sales_leads: number;
}

export interface RotationTarget {
  user_id: number;
  role: SalesTeamRole;
  lead: number;
  assigned: number;
}

export interface RotationInfo {
  cycle: number;
  cycle_status: string;
  target: RotationTarget[];
}

export interface NextUp {
  user_id: number;
  role: SalesTeamRole;
}

export interface SalesTeamRotationResponse {
  launch_id: string;
  sales_team: SalesTeamMember[];
  rotation: RotationInfo;
  next_up: NextUp | null;
}

export type SalesTeamRole = 'team-lead' | 'field-sales' | 'pre-sales';

export interface RotationRow {
  user_id: number;
  name: string;
  role: SalesTeamRole;
  leads_per_round: number;
  assigned?: number;
}

/* A duplicate (non-dead) lead came in again via the same source — no new
  lead was created, this just tells whoever already owns it. */
/* null for rows created before the type column existed. */
export type AutoLeadNotificationType = 'duplicate' | 'new_lead' | 'reassigned' | 'overdue';

export interface AutoLeadNotification {
  id: number;
  seller_id: number;
  lead_id: number;
  launch_id: number;
  source: string;
  message: string;
  type: AutoLeadNotificationType | null;
  is_read: boolean;
  created_at: string;
}

/* SMS lead source — a project's saved (or, before the first save, default)
 * SMS template plus how a bulk-SMS gateway would actually bill it. */
export interface SmsTemplate {
  template: string;
  char_count: number;
  encoding: 'GSM-7' | 'UCS-2';
  segments: number;
  is_saved: boolean;
}

/* One row of an SMS rotation's read-only, derived seller pool — see
 * housieyCampaign.helper.js. There is no launch multi-select or per-person
 * quota UI for SMS: this table is what that derivation currently produces. */
export interface SmsPoolRow {
  seller_id: number;
  seller_name: string;
  role: SalesTeamRole;
  lead_priority: number;
  launch_id: number;
  launch_name: string;
  no_of_lead: number;
  assigned_count: number;
}

/* A saved SMS campaign — sms_lead_campaigns row, keyed by project_id (the
 * project itself plays the role a Facebook/Google campaign_id plays). */
export interface SmsCampaign {
  id: number;
  project_id: number;
  project_name?: string;
  city_id: number | null;
  campaign_name: string;
  template: string;
  is_active: boolean;
}
