import "../../../../../../shared/src/valita.js";
import { resetRequiredSchema } from "./control.js";
import { beginSchema, dataChangeSchema, schemaChangeSchema, commitSchema, rollbackSchema } from "./data.js";
import { downstreamStatusMessageSchema } from "./status.js";
import { tuple, literal, object, string, union } from "@badrap/valita";
const begin = tuple([
  literal("begin"),
  beginSchema,
  object({ commitWatermark: string() })
]);
const data = tuple([
  literal("data"),
  union(dataChangeSchema, schemaChangeSchema)
]);
const commit = tuple([
  literal("commit"),
  commitSchema,
  object({ watermark: string() })
]);
const rollback = tuple([literal("rollback"), rollbackSchema]);
const changeStreamDataSchema = union(begin, data, commit, rollback);
const changeStreamControlSchema = tuple([
  literal("control"),
  resetRequiredSchema
  // TODO: Add statusRequestedSchema
]);
const changeStreamMessageSchema = union(
  changeStreamDataSchema,
  changeStreamControlSchema,
  downstreamStatusMessageSchema
);
export {
  changeStreamControlSchema,
  changeStreamDataSchema,
  changeStreamMessageSchema
};
//# sourceMappingURL=downstream.js.map
