/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { isDefined, isObject } from '@tylertech/forge-core';
export var SelectOptionType;
(function (SelectOptionType) {
    SelectOptionType[SelectOptionType["Option"] = 0] = "Option";
    SelectOptionType[SelectOptionType["Group"] = 1] = "Group";
})(SelectOptionType || (SelectOptionType = {}));
/**
 * Determines if the provided options are of the specified type.
 * @param options The options either grouped or individual.
 * @param type The type of option to detect.
 */
export function isSelectOptionType(options, type) {
    const isOptionGroups = options.some((o) => isOptionGroupObject(o));
    const isOptionTypes = options.some((o) => isOptionObject(o));
    return (isOptionGroups && type === SelectOptionType.Group) || (isOptionTypes && type === SelectOptionType.Option);
}
export function isOptionGroupObject(o) {
    return isDefined(o) && isObject(o) && o.hasOwnProperty('options');
}
export function isOptionObject(o) {
    return isDefined(o) && isObject(o) && o.hasOwnProperty('label') && o.hasOwnProperty('value');
}
