/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { Multiplicity } from "../../core/index.js";
import { requiredIdentifier, identifierFieldIdentifier } from "../fieldKindIdentifiers.js";
import { FlexFieldKind, } from "../modular-schema/index.js";
import { optionalChangeHandler, optionalFieldEditor } from "./optionalField.js";
export const requiredFieldEditor = {
    ...optionalFieldEditor,
    set: (ids) => optionalFieldEditor.set(false, ids),
};
export const requiredFieldChangeHandler = {
    ...optionalChangeHandler,
    editor: requiredFieldEditor,
};
/**
 * Exactly one item.
 */
export const required = new FlexFieldKind(requiredIdentifier, Multiplicity.Single, {
    changeHandler: requiredFieldChangeHandler,
    allowMonotonicUpgradeFrom: new Set([identifierFieldIdentifier]),
});
//# sourceMappingURL=requiredField.js.map