import * as v from "../../../../../../shared/src/valita.js";
import { resetRequiredSchema } from "./control.js";
import { beginSchema, commitSchema, dataChangeSchema, rollbackSchema, } from "./data.js";
import { statusMessageSchema } from "./status.js";
const begin = v.tuple([
    v.literal('begin'),
    beginSchema,
    v.object({ commitWatermark: v.string() }),
]);
const data = v.tuple([v.literal('data'), dataChangeSchema]);
const commit = v.tuple([
    v.literal('commit'),
    commitSchema,
    v.object({ watermark: v.string() }),
]);
const rollback = v.tuple([v.literal('rollback'), rollbackSchema]);
export const changeStreamDataSchema = v.union(begin, data, commit, rollback);
export const changeStreamControlSchema = v.tuple([
    v.literal('control'),
    resetRequiredSchema, // TODO: Add statusRequestedSchema
]);
/** Downstream messages consist of data plane and control plane messages. */
export const changeStreamMessageSchema = v.union(changeStreamDataSchema, changeStreamControlSchema, statusMessageSchema);
//# sourceMappingURL=downstream.js.map