export interface HostInfo {
  ip?: string;
  lastreport?: number;
  firstreport?: number;
  iscallcollected?: boolean;
  lastAgentExecutionTime?: number;
  agentexecutioninterval?: number;
  hostname?: string;
  Hostnames?: { Fqhost?: string; [k: string]: unknown };
  CFEngine?: { Version?: string; [k: string]: unknown };
  System?: { OS?: string; [k: string]: unknown };
  Network?: { address?: string | string[] };
  [k: string]: unknown;
}

export interface HostListEntry {
  hostkey: string;
  hostname?: string;
  ip?: string;
  os?: string;
  lastreport?: number;
  [k: string]: unknown;
}

export interface PolicyExecutionResponse {
  header: { columnName: string }[];
  rows: (string | number | null)[][];
  rowCount: number;
}

export interface SoftwareSummary {
  installedCount: number;
  availableCount: number;
  installedState: string;
  availableState: string;
}

export interface StatusMeasured {
  load: string | number | null;
  free: string | number | null;
}

export interface SharedGroup {
  id: number | string;
  name: string;
}

export interface SharedGroupsResponse {
  groups: SharedGroup[];
  accessDenied?: boolean;
  error?: boolean;
}

export interface PinnedItem {
  id: number | string;
  name: string;
  value: unknown;
}

export type PinnedItemsResponse = {
  class?: PinnedItem[];
  variable?: PinnedItem[];
  inventory?: PinnedItem[];
} & Record<string, PinnedItem[] | undefined>;

// Tabular inventory/classes/variables data for the "Show all" dialog.
// Mirrors the {header, rows} payload returned by the query API.
export interface InventoryTableResponse {
  header: { columnName: string }[];
  rows: (string | string[] | null)[][];
  pinType: string | null;
}
