"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTypeWithKeywordQuery = getTypeWithKeywordQuery;
const getEntityTypeFromType_1 = require("../../search/_internal/getEntityTypeFromType");
/**
 * @private
 * Construct an IQuery to fetch a set of items by type(s)
 * with a specified typeKeyword. Note: if an array of types
 * is provided, they must be the same underlying target
 * entity type.
 *
 * @param itemType - The type(s) of item to fetch
 * @param keyword - The typeKeyword to filter by
 * @returns
 */
function getTypeWithKeywordQuery(itemType, keyword) {
    const targetEntity = typeof itemType === "string"
        ? (0, getEntityTypeFromType_1.getEntityTypeFromType)(itemType)
        : (0, getEntityTypeFromType_1.getEntityTypeFromType)(itemType[0]);
    return {
        targetEntity,
        filters: [
            {
                operation: "AND",
                predicates: [
                    {
                        type: itemType,
                        typekeywords: [keyword],
                    },
                ],
            },
        ],
    };
}
//# sourceMappingURL=getTypeWithKeywordQuery.js.map