import { SupportedDbtAdapter } from '../types/dbt';
import { DimensionType, type TimestampDomain } from '../types/field';
import { TimeFrames } from '../types/timeFrames';
export declare enum WeekDay {
    MONDAY = 0,
    TUESDAY = 1,
    WEDNESDAY = 2,
    THURSDAY = 3,
    FRIDAY = 4,
    SATURDAY = 5,
    SUNDAY = 6
}
export declare const isWeekDay: (value: unknown) => value is WeekDay;
/** Per-warehouse SQL for the DATE_TRUNC timezone round-trip. `toProjectTz`
 *  shifts into project-local wall-clock before truncation; `toUTC` converts
 *  the truncated value back into a proper UTC instant. `castAsDate` casts a
 *  truncated wall-clock value to a real DATE (GLITCH-452) — every adapter's
 *  wrapped path truncates a naive project-local wall-clock, so `CAST(x AS DATE)`
 *  reads the right date. `sourceTimezone` is the timezone the
 *  column is in — only Snowflake uses it explicitly (in `CONVERT_TIMEZONE`);
 *  other adapters ignore it.
 *
 *  `castToInstant` rebases a naive timestamp into a true instant via the
 *  warehouse session timezone; identity in value for aware columns. It is the
 *  inner term of `toProjectTz`, composed below so the two cannot drift.
 *
 *  `castNaiveToInstant` is the explicit, session-independent version for a
 *  known-naive column: rebase the stored wall clock from its data timezone
 *  `z` into an instant. Null where the domain-directed path never fires
 *  (Snowflake's compile-time wrap + session already handle NTZ; ClickHouse
 *  has no naive columns). `toProjectTzFromInstant` is the outer term of
 *  `toProjectTz` — it accepts an already-instant input so the naive rebase
 *  can replace the inner `castToInstant` without double-wrapping. */
type DateTruncTimezoneConversion = {
    toProjectTz: (sql: string, tz: string, sourceTimezone?: string) => string;
    toProjectTzFromInstant: (instantSql: string, tz: string) => string;
    toUTC: (sql: string, tz: string) => string;
    castAsDate: (sql: string, tz: string) => string;
    castToInstant: (sql: string) => string;
    castNaiveToInstant: ((sql: string, z: string) => string) | null;
    /** Explicit naive rebase for aggregate OUTPUTS (MIN/MAX over a bare
     *  column). Equals `castNaiveToInstant` except on Snowflake, whose dim
     *  path is compile-time wrapped (so `castNaiveToInstant` stays null until
     *  the wrap is retired) while its aggregates see the bare column and can
     *  rebase explicitly. Null only where no naive columns exist. */
    castNaiveAggregateToInstant: ((sql: string, z: string) => string) | null;
    /** Explicit session-proof instant for a KNOWN-AWARE column. Non-null only
     *  on adapters whose bare aware outputs depend on the session timezone
     *  (Databricks/Spark); everywhere else the bare column is already an
     *  instant on the wire. */
    castAwareToInstant: ((sql: string) => string) | null;
    /** Applied to the final sub-day output of the explicit truncation path so
     *  the wire value stops depending on the session timezone. Non-null only
     *  on Databricks/Spark (TIMESTAMP_NTZ freeze); day-or-coarser grains exit
     *  via castAsDate, which is already session-proof. */
    freezeInstantOutput: ((sql: string) => string) | null;
};
export declare const naiveTimestampRebaseAdapters: ReadonlySet<SupportedDbtAdapter>;
export declare const dateTruncTimezoneConversions: Record<SupportedDbtAdapter, DateTruncTimezoneConversion>;
type DateExtractTimezoneConversion = {
    toExtractInputTz: (sql: string, tz: string, sourceTimezone?: string) => string;
    toExtractInputTzFromInstant: (instantSql: string, tz: string) => string;
};
export declare const dateExtractsTimezoneConversions: Record<SupportedDbtAdapter, DateExtractTimezoneConversion>;
/** Shift an EXTRACT/format input into the project zone. For a known-naive
 *  column the session-based inner cast is replaced by the explicit
 *  `castNaiveToInstant` rebase from the data timezone; aware/unknown domains
 *  emit exactly the legacy `toExtractInputTz` form. */
export declare const getExtractInputTzSql: (adapterType: SupportedDbtAdapter, originalSql: string, timezone: string, sourceTimezone?: string, timestampDomain?: TimestampDomain) => string;
export declare const SUB_DAY_TIME_FRAMES: ReadonlySet<TimeFrames>;
export declare const isSubDayTimeFrame: (tf: TimeFrames) => boolean;
export declare const isTimezoneRoundTripNoOp: (adapterType: SupportedDbtAdapter, timezone: string, sourceTimezone?: string, timestampDomain?: TimestampDomain) => boolean;
export declare const getSqlForTruncatedDate: (adapterType: SupportedDbtAdapter, timeFrame: TimeFrames, originalSql: string, type: DimensionType, startOfWeek?: WeekDay | null, timezone?: string, sourceTimezone?: string, timestampDomain?: TimestampDomain, castDayOrCoarserToDate?: boolean) => string;
export declare const getSqlForDatePart: (adapterType: SupportedDbtAdapter, timeFrame: TimeFrames, originalSql: string, type: DimensionType, startOfWeek?: WeekDay | null, timezone?: string, sourceTimezone?: string, timestampDomain?: TimestampDomain) => string;
export declare const getSqlForDatePartName: (adapterType: SupportedDbtAdapter, timeFrame: TimeFrames, originalSql: string, type: DimensionType, _startOfWeek?: WeekDay | null, timezone?: string, sourceTimezone?: string, timestampDomain?: TimestampDomain) => string;
type TimeFrameConfig = {
    getLabel: () => string;
    getDimensionType: (fallback: DimensionType) => DimensionType;
    getSql: (adapterType: SupportedDbtAdapter, timeFrame: TimeFrames, originalSql: string, type: DimensionType, startOfWeek?: WeekDay | null, timezone?: string, sourceTimezone?: string, timestampDomain?: TimestampDomain) => string;
    getAxisMinInterval: () => number | null;
    getAxisLabelFormatter: () => Record<string, string> | null;
};
export declare const timeFrameConfigs: Record<TimeFrames, TimeFrameConfig>;
export declare const getDefaultTimeFrames: (type: DimensionType) => TimeFrames[];
export type ResolvedAdditionalTimeIntervals = {
    date: (TimeFrames | string)[];
    timestamp: (TimeFrames | string)[];
};
/**
 * Built-in default time frames for a dimension type, with project-level
 * `additional_time_intervals` appended (de-duplicated, built-ins first).
 */
export declare const getTimeFramesWithProjectDefaults: (type: DimensionType, additionalTimeIntervals?: ResolvedAdditionalTimeIntervals) => (TimeFrames | string)[];
/** Time frames that use DATE_TRUNC (not EXTRACT/DATE_PART). */
export declare const truncatableTimeFrames: ReadonlySet<TimeFrames>;
/** Time frames that use EXTRACT/DATE_PART or format/name functions, not DATE_TRUNC. */
export declare const extractableTimeFrames: ReadonlySet<TimeFrames>;
export declare const isTimeInterval: (value: string) => value is TimeFrames;
export declare const validateTimeFrames: (values: string[]) => TimeFrames[];
export declare const timeFrameOrder: (TimeFrames | undefined)[];
export declare const sortTimeFrames: (a: TimeFrames, b: TimeFrames) => number;
export declare const SUB_DAY_GRANULARITIES: ReadonlySet<string>;
export declare const isSubDayGranularity: (g: string) => boolean;
export declare const getDateDimension: (dimensionId: string) => {
    baseDimensionId: string;
    newTimeFrame: TimeFrames;
} | {
    baseDimensionId?: undefined;
    newTimeFrame?: undefined;
};
export {};
//# sourceMappingURL=timeFrames.d.ts.map