// (C) 2019-2025 GoodData Corporation
import { localIdRef, newMeasureSort, } from "@gooddata/sdk-model";
function newMeasureSortSuggestion(identifier, attributeLocators = []) {
    const { measureSortItem: { locators }, } = newMeasureSort(identifier, "asc", attributeLocators);
    return {
        type: "measureSort",
        locators,
    };
}
/**
 * @internal
 */
export const newAvailableSortsGroup = (attributeId, measureIds = [], normalSortEnabled = true, areaSortEnabled = true, explanation) => {
    const metricSortsProp = measureIds.length
        ? {
            metricSorts: [
                ...measureIds.map((localIdentifier) => newMeasureSortSuggestion(localIdentifier)),
            ],
        }
        : {};
    const explanationProp = explanation
        ? {
            explanation,
        }
        : {};
    return {
        itemId: localIdRef(attributeId),
        attributeSort: {
            normalSortEnabled,
            areaSortEnabled,
        },
        ...metricSortsProp,
        ...explanationProp,
    };
};
//# sourceMappingURL=SortConfig.js.map