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;
  /** The campaign's microsite (its ads' Final URL), saved by the Refresh button. Null until the first refresh finds it. */
  microsite_url?: string | null;
}

/* 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;
  /** Looked up by the backend when notifications are fetched — null if missing. */
  client_name?: string | null;
  launch_name?: string | null;
  project_name?: string | null;
  type: AutoLeadNotificationType | null;
  is_read: boolean;
  created_at: string;
}

/** What GET /api/v1/auto-lead-assignment/notifications gives the notifier. */
export interface AutoLeadNotificationList {
  /** False while the pop-ups are switched off on the Feature Control page. */
  enabled: boolean;
  data: AutoLeadNotification[];
}

// A saved SMS campaign.
export interface SMSCampaign {
  id: number;
  campaign_id: string;
  name: string;
  status: string;
  campaign_name: string;
  city_id: number;
  /** Null until a key frame is set. */
  key_frame: string | null;
}
