export function assertFixture(value) {
    if (!isRecord(value)) {
        throw new Error("Fixture must be an object");
    }
    if (value.schemaVersion !== 1) {
        throw new Error("Unsupported fixture schemaVersion");
    }
    if (!isRecord(value.redaction) || value.redaction.status !== "sanitized") {
        throw new Error("Fixture must be sanitized before use");
    }
    assertMessage(value.request, "request");
    assertMessage(value.response, "response");
}
function assertMessage(value, name) {
    if (!isRecord(value)) {
        throw new Error(`${name} must be an object`);
    }
    for (const field of [
        "httpVersion",
        "path",
        "headers",
        "trailers",
        "bodySha256",
        "bodyBase64",
    ]) {
        if (!(field in value)) {
            throw new Error(`${name}.${field} is required`);
        }
    }
}
function isRecord(value) {
    return typeof value === "object" && value !== null;
}
