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

export interface RawTcpExpectConfig {
  banner?: RawContentExpectations;
  connected?: boolean;
  durationMs?: RawValueExpectation;
}

export interface ResolvedTcpConfig {
  bannerReadTimeout: number;
  host: string;
  maxBannerBytes: number;
  port: number;
  readBanner: boolean;
}

export interface ResolvedTcpExpectConfig {
  banner?: ContentExpectations;
  connected: boolean;
  durationMs?: ValueExpectation;
}

export interface ResolvedTcpTarget extends ResolvedTargetBase {
  expect?: ResolvedTcpExpectConfig;
  group: string;
  intervalMs: number;
  name: null | string;
  rawExpect?: RawTcpExpectConfig;
  tcp: ResolvedTcpConfig;
  timeoutMs: number;
  type: "tcp";
}

export interface TcpDefaultsConfig {
  bannerReadTimeout?: number;
  maxBannerBytes?: number | string;
}

export interface TcpTargetConfig {
  bannerReadTimeout?: number;
  host: string;
  maxBannerBytes?: number | string;
  port: number;
  readBanner?: boolean;
}
