export interface AutoPostMonitorPlatform {
  platform: string;
  label: string;
  connected: boolean;
  ready: boolean;
  connectionStatus: string;
  statusLabel: string;
  statusTone: "ok" | "warn" | "error" | "muted";
  lastSuccessAt?: string;
  lastError?: string;
}

export interface AutoPostMonitorSnapshot {
  checkedAt: string;
  projectId: string | null;
  projectName: string | null;
  scheduler: {
    status: "running" | "stopped" | "disabled" | "tick_in_progress";
    statusLabel: string;
    cronSecretConfigured: boolean;
    internalPollerEnabled: boolean;
    pollerStarted: boolean;
    tickInProgress: boolean;
    intervalMinutes: number;
    lastRunAt: string | null;
    lastPollerStartAt?: string | null;
    minutesSinceLastTick?: number | null;
  };
  timezone: {
    raw: string;
    iana: string;
    label: string;
    currentTimeLocal: string;
    currentDateLocal: string;
  };
  schedule: {
    postsPerDay: number;
    plannedSlots: string[];
    windowMinutes: number;
    status: "active_window" | "waiting";
    statusLabel: string;
    nextSlot: {
      label: string;
      display: string;
      dayLabel: string;
      slotTimeLocal: string;
      slotAt: string;
      windowOpensAt: string;
      windowClosesAt: string;
      isWindowActive: boolean;
      startsInLabel: string;
      endsInLabel: string;
    } | null;
    activeSlotsNow: string[];
  };
  lastAttempt: {
    timestamp: string;
    event: string;
    message: string;
    resultLabel: string;
    resultTone: "ok" | "warn" | "error" | "muted";
  } | null;
  lastPublished: {
    platform: string;
    timestamp: string;
    message: string;
    permalink?: string;
  } | null;
  lastError: {
    timestamp: string;
    message: string;
    source: "scheduler" | "publish" | "oauth";
    platform?: string;
  } | null;
  platforms: AutoPostMonitorPlatform[];
  queuedCount: number;
  canAutoPost: boolean;
  executionStopsAt: string | null;
  summary: string;
  allowManualRun: boolean;
  logFiles: {
    autoPost: string;
    publish: string;
    appErrors?: string;
    generation?: string;
  };
}
