import type { GroupFilter } from '../common/InventoryFilter';

export type GroupType = 'personal' | 'shared';

// A group as returned by the personal/shared list and single-group endpoints.
export interface Group {
  creation_time?: number;
  creator?: string;
  filter?: GroupFilter;
  has_data?: boolean;
  hosts_number?: number;
  id: string | number;
  is_favorite?: boolean;
  meta_data?: { source?: string };
  name: string;
  owner?: string;
  priority?: number;
  type?: GroupType;
}

export interface SortState {
  column: string;
  descending: boolean;
}

// A compliance rule that references a shared group (shown before deletion).
export interface ReferencingRule {
  [key: string]: unknown;
  name: string;
}

// The inventory result table returned by the inventory data endpoint.
export interface InventoryTableHeader {
  columnName: string;
  columnType?: string;
}

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

export interface GroupStats {
  os: string[];
  // OS value -> host count, used for the pie chart.
  osDistribution: Record<string, number>;
  versions: string[];
}
