import type {
  ContentExpectations,
  KeyedExpectations,
  RawContentExpectations,
  RawKeyedExpectations,
  RawValueExpectation,
  ValueExpectation,
} from "../../expect/types";
import type { ResolvedTargetBase } from "../../types";

export interface RawWsExpectConfig {
  connected?: boolean;
  connectTimeMs?: RawValueExpectation;
  durationMs?: RawValueExpectation;
  handshakeHeaders?: RawKeyedExpectations;
  message?: RawContentExpectations;
}

export interface ResolvedWsConfig {
  headers: Record<string, string>;
  ignoreSSL: boolean;
  maxMessageBytes: number;
  receiveTimeout: number;
  send?: string;
  subprotocols: string[];
  url: string;
}

export interface ResolvedWsExpectConfig {
  connected: boolean;
  connectTimeMs?: ValueExpectation;
  durationMs?: ValueExpectation;
  handshakeHeaders?: KeyedExpectations;
  message?: ContentExpectations;
}

export interface ResolvedWsTarget extends ResolvedTargetBase {
  expect?: ResolvedWsExpectConfig;
  group: string;
  intervalMs: number;
  name: null | string;
  timeoutMs: number;
  type: "ws";
  ws: ResolvedWsConfig;
}

export interface WsTargetConfig {
  headers?: Record<string, string>;
  ignoreSSL?: boolean;
  maxMessageBytes?: number | string;
  receiveTimeout?: number;
  send?: string;
  subprotocols?: string[];
  url: string;
}
