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

export interface DbTargetConfig {
  query?: string;
  url: string;
}

export interface RawDbExpectConfig {
  durationMs?: RawValueExpectation;
  result?: RawContentExpectations;
  rowCount?: RawValueExpectation;
  rows?: RawKeyedExpectations[];
}

export interface ResolvedDbConfig {
  query?: string;
  url: string;
}

export interface ResolvedDbExpectConfig {
  durationMs?: ValueExpectation;
  result?: ContentExpectations;
  rowCount?: ValueExpectation;
  rows?: KeyedExpectations[];
}

export interface ResolvedDbTarget extends ResolvedTargetBase {
  db: ResolvedDbConfig;
  expect?: ResolvedDbExpectConfig;
  group: string;
  intervalMs: number;
  name: null | string;
  rawExpect?: RawDbExpectConfig;
  timeoutMs: number;
  type: "db";
}
