/**
 * S-002: Device Configuration Types
 */

/** Connection mode for the Gateway */
export type TransportMode = "sse" | "websocket" | "stdio";

export interface GatewayConfig {
  url: string;
  token?: string;
  transport: TransportMode;
  reconnectDelay: number;    // ms, default 1000
  maxReconnectDelay: number; // ms, default 30000
  heartbeatInterval: number; // ms, default 15000
}

export interface DeviceIdentity {
  id: string;         // unique device ID (UUID)
  name: string;       // human-readable name
  platform: NodeJS.Platform;
  arch: string;
  hostname: string;
  osVersion: string;
}

export interface ProxyConfig {
  enabled: boolean;
  host: string;
  port: number;
  auth?: { username: string; password: string };
}

export interface DeviceConfig {
  identity: DeviceIdentity;
  gateway: GatewayConfig;
  proxy?: ProxyConfig;
  capabilities: string[];  // enabled MCP tool names
  logLevel: "debug" | "info" | "warn" | "error";
}

export const DEFAULT_GATEWAY_CONFIG: GatewayConfig = {
  url: "http://localhost:3000",
  transport: "sse",
  reconnectDelay: 1000,
  maxReconnectDelay: 30000,
  heartbeatInterval: 15000,
};
