// (C) 2023-2025 GoodData Corporation
import { bucketMeasure, bucketMeasures, insightBucket, } from "@gooddata/sdk-model";
import { sdkModelPropMetas, } from "../../../utils/embeddingCodeGenerator/index.js";
export function singleSecondaryMeasureBucketConversion(propName, bucketName) {
    return bucketConversion(propName, sdkModelPropMetas.Measure.Single, bucketName, false, bucketMeasure);
}
export function multipleSecondaryMeasuresBucketConversion(propName, bucketName) {
    return bucketConversion(propName, sdkModelPropMetas.Measure.Multiple, bucketName, true, bucketMeasures);
}
export function bucketConversion(propName, propType, bucketName, shouldProcessBucketItem, bucketItemAccessor) {
    return {
        propName,
        propType,
        itemAccessor(insight) {
            const bucket = insightBucket(insight, bucketName);
            return shouldProcessBucketItem && bucket ? bucketItemAccessor(bucket) : undefined;
        },
    };
}
//# sourceMappingURL=headlineBucketConversion.js.map