/** OpenAPI: handler.ErrorResponse */
export interface ApiErrorBody {
  code?: string;
  error?: string;
}

export interface CreateSessionRequest {
  title: string;
}

export interface CreateSessionResponse {
  id: number;
  session_key: string;
  status: string;
  title: string;
  created_at: string;
}

export interface SessionSummary {
  id: string;
  user_id?: string;
  status: string;
  started_at?: string;
  ended_at?: string;
  chunks_total?: number;
  events_total?: number;
  /** в списке сессий с бэка, не всегда в swagger */
  title?: string;
}

export interface SessionListResponse {
  sessions: SessionSummary[];
  total: number;
  limit: number;
  offset: number;
}

export interface StreamInfo {
  stream_type: string;
  chunk_count?: number;
  duration_ms?: number;
  playlist_url: string;
}

export interface SessionDetailResponse {
  session: SessionSummary;
  streams: StreamInfo[];
}

export interface TelemetryEvent {
  id: number;
  session_id: number;
  user_id?: number;
  event_type: string;
  created_at: string;
  payload?: number[];
}

export interface ParsedEvent {
  event_type: string;
  timestamp: number;
  data?: unknown;
}

export interface ParsedEventsResponse {
  session_id: number;
  count: number;
  events: ParsedEvent[];
}

export type StreamType = 'screen' | 'webcam';

export interface FingerprintHeartbeatPayload {
  machine_id_hash: string;
  cpu_model_hash?: string;
  board_serial_hash?: string;
  board_uuid_hash?: string;
  primary_mac_hash?: string;
  disk_serial_hash?: string;
  boot_time_ms?: number;
  uptime_ms?: number;
  agent_pid?: number;
  agent_uptime_ms?: number;
  hostname: string;
  username: string;
  tz_offset_min?: number;
  locale?: string;
  screen_layout: string;
  active_iface: string;
  hypervisor_present: boolean;
}

export interface FingerprintHeartbeat {
  timestamp_ms: number;
  payload: FingerprintHeartbeatPayload;
}

export interface FingerprintHeartbeatsResponse {
  count: number;
  session_id: number;
  heartbeats: FingerprintHeartbeat[];
}
