"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseFieldIdFromPop = exports.getPopFieldId = exports.POP_PREVIOUS_PERIOD_SUFFIX = exports.isSupportedPeriodOverPeriodGranularity = exports.periodOverPeriodGranularityLabels = exports.validPeriodOverPeriodGranularities = void 0;
const timeFrames_1 = require("./timeFrames");
exports.validPeriodOverPeriodGranularities = [
    timeFrames_1.TimeFrames.DAY,
    timeFrames_1.TimeFrames.WEEK,
    timeFrames_1.TimeFrames.MONTH,
    timeFrames_1.TimeFrames.QUARTER,
    timeFrames_1.TimeFrames.YEAR,
];
exports.periodOverPeriodGranularityLabels = {
    [timeFrames_1.TimeFrames.YEAR]: 'Year',
    [timeFrames_1.TimeFrames.QUARTER]: 'Quarter',
    [timeFrames_1.TimeFrames.MONTH]: 'Month',
    [timeFrames_1.TimeFrames.WEEK]: 'Week',
    [timeFrames_1.TimeFrames.DAY]: 'Day',
    [timeFrames_1.TimeFrames.HOUR]: 'Hour',
    [timeFrames_1.TimeFrames.MINUTE]: 'Minute',
    [timeFrames_1.TimeFrames.SECOND]: 'Second',
    [timeFrames_1.TimeFrames.MILLISECOND]: 'Millisecond',
    [timeFrames_1.TimeFrames.RAW]: 'Raw',
    [timeFrames_1.TimeFrames.DAY_OF_WEEK_INDEX]: 'Day of Week Index',
    [timeFrames_1.TimeFrames.DAY_OF_MONTH_NUM]: 'Day of Month',
    [timeFrames_1.TimeFrames.DAY_OF_YEAR_NUM]: 'Day of Year',
    [timeFrames_1.TimeFrames.WEEK_NUM]: 'Week Number',
    [timeFrames_1.TimeFrames.MONTH_NUM]: 'Month Number',
    [timeFrames_1.TimeFrames.QUARTER_NUM]: 'Quarter Number',
    [timeFrames_1.TimeFrames.YEAR_NUM]: 'Year Number',
    [timeFrames_1.TimeFrames.DAY_OF_WEEK_NAME]: 'Day of Week Name',
    [timeFrames_1.TimeFrames.MONTH_NAME]: 'Month Name',
    [timeFrames_1.TimeFrames.QUARTER_NAME]: 'Quarter Name',
    [timeFrames_1.TimeFrames.HOUR_OF_DAY_NUM]: 'Hour of Day',
    [timeFrames_1.TimeFrames.MINUTE_OF_HOUR_NUM]: 'Minute of Hour',
};
const isSupportedPeriodOverPeriodGranularity = (granularity) => exports.validPeriodOverPeriodGranularities.includes(granularity);
exports.isSupportedPeriodOverPeriodGranularity = isSupportedPeriodOverPeriodGranularity;
/**
 * Suffix used for period-over-period comparison columns.
 * This is the single source of truth for the PoP column naming convention.
 */
exports.POP_PREVIOUS_PERIOD_SUFFIX = '_previous';
/**
 * Gets the PoP field ID for a base metric field ID.
 * @param baseFieldId - The field ID of the base metric (e.g., "orders_total_revenue")
 * @returns The PoP field ID (e.g., "orders_total_revenue_previous")
 */
const getPopFieldId = (baseFieldId) => `${baseFieldId}${exports.POP_PREVIOUS_PERIOD_SUFFIX}`;
exports.getPopFieldId = getPopFieldId;
/**
 * Gets the base field ID from a PoP field ID.
 * @param fieldId - The field ID to check
 * @returns The base field ID if this is a PoP field, null otherwise
 */
const getBaseFieldIdFromPop = (fieldId) => fieldId.endsWith(exports.POP_PREVIOUS_PERIOD_SUFFIX)
    ? fieldId.slice(0, -exports.POP_PREVIOUS_PERIOD_SUFFIX.length)
    : null;
exports.getBaseFieldIdFromPop = getBaseFieldIdFromPop;
//# sourceMappingURL=periodOverPeriodComparison.js.map