/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { assert } from "@fluidframework/common-utils";
import { brand, brandedNumberType } from "../../util";
/**
 * @alpha
 */
export var CrossFieldTarget;
(function (CrossFieldTarget) {
    CrossFieldTarget[CrossFieldTarget["Source"] = 0] = "Source";
    CrossFieldTarget[CrossFieldTarget["Destination"] = 1] = "Destination";
})(CrossFieldTarget || (CrossFieldTarget = {}));
export const ChangesetLocalIdSchema = brandedNumberType();
/**
 * @alpha
 */
export function idAllocatorFromMaxId(maxId = undefined) {
    return idAllocatorFromState({ maxId: maxId !== null && maxId !== void 0 ? maxId : brand(-1) });
}
export function idAllocatorFromState(state) {
    return (c) => {
        const count = c !== null && c !== void 0 ? c : 1;
        assert(count > 0, 0x5cf /* Must allocate at least one ID */);
        const id = brand(state.maxId + 1);
        state.maxId = brand(state.maxId + count);
        return id;
    };
}
//# sourceMappingURL=crossFieldQueries.js.map