import { LogHandler } from '../../modules/logging';
import { Audience, Experiment, FeatureFlag, FeatureVariable, Group, OptimizelyVariation, Rollout, TrafficAllocation, Variation, VariableType, VariationVariable, Integration, FeatureVariableValue } from '../../shared_types';
interface TryCreatingProjectConfigConfig {
    datafile: string | object;
    jsonSchemaValidator?: {
        validate(jsonObject: unknown): boolean;
    };
    logger: LogHandler;
}
interface Event {
    key: string;
    id: string;
    experimentsIds: string[];
}
interface VariableUsageMap {
    [id: string]: VariationVariable;
}
export interface ProjectConfig {
    revision: string;
    projectId: string;
    sdkKey: string;
    environmentKey: string;
    sendFlagDecisions?: boolean;
    experimentKeyMap: {
        [key: string]: Experiment;
    };
    featureKeyMap: {
        [key: string]: FeatureFlag;
    };
    rollouts: Rollout[];
    featureFlags: FeatureFlag[];
    experimentIdMap: {
        [id: string]: Experiment;
    };
    experimentFeatureMap: {
        [key: string]: string[];
    };
    experiments: Experiment[];
    eventKeyMap: {
        [key: string]: Event;
    };
    audiences: Audience[];
    attributeKeyMap: {
        [key: string]: {
            id: string;
        };
    };
    variationIdMap: {
        [id: string]: OptimizelyVariation;
    };
    variationVariableUsageMap: {
        [id: string]: VariableUsageMap;
    };
    audiencesById: {
        [id: string]: Audience;
    };
    __datafileStr: string;
    groupIdMap: {
        [id: string]: Group;
    };
    groups: Group[];
    events: Event[];
    attributes: Array<{
        id: string;
        key: string;
    }>;
    typedAudiences: Audience[];
    rolloutIdMap: {
        [id: string]: Rollout;
    };
    anonymizeIP?: boolean | null;
    botFiltering?: boolean;
    accountId: string;
    flagRulesMap: {
        [key: string]: Experiment[];
    };
    flagVariationsMap: {
        [key: string]: Variation[];
    };
    integrations: Integration[];
    integrationKeyMap?: {
        [key: string]: Integration;
    };
    publicKeyForOdp?: string;
    hostForOdp?: string;
    pixelUrlForOdp?: string;
    allSegments: string[];
}
/**
 * Creates projectConfig object to be used for quick project property lookup
 * @param  {Object}        datafileObj   JSON datafile representing the project
 * @param  {string|null}   datafileStr   JSON string representation of the datafile
 * @return {ProjectConfig} Object representing project configuration
 */
export declare const createProjectConfig: (datafileObj?: JSON, datafileStr?: string | null) => ProjectConfig;
/**
 * Extract all audience segments used in this audience's conditions
 * @param  {Audience}     audience  Object representing the audience being parsed
 * @return {string[]}               List of all audience segments
 */
export declare const getAudienceSegments: (audience: Audience) => string[];
/**
 * Get experiment ID for the provided experiment key
 * @param  {ProjectConfig}    projectConfig   Object representing project configuration
 * @param  {string}           experimentKey   Experiment key for which ID is to be determined
 * @return {string}                           Experiment ID corresponding to the provided experiment key
 * @throws If experiment key is not in datafile
 */
export declare const getExperimentId: (projectConfig: ProjectConfig, experimentKey: string) => string;
/**
 * Get layer ID for the provided experiment key
 * @param  {ProjectConfig}    projectConfig   Object representing project configuration
 * @param  {string}           experimentId    Experiment ID for which layer ID is to be determined
 * @return {string}                           Layer ID corresponding to the provided experiment key
 * @throws If experiment key is not in datafile
 */
export declare const getLayerId: (projectConfig: ProjectConfig, experimentId: string) => string;
/**
 * Get attribute ID for the provided attribute key
 * @param  {ProjectConfig}   projectConfig    Object representing project configuration
 * @param  {string}          attributeKey     Attribute key for which ID is to be determined
 * @param  {LogHandler}      logger
 * @return {string|null}     Attribute ID corresponding to the provided attribute key. Attribute key if it is a reserved attribute.
 */
export declare const getAttributeId: (projectConfig: ProjectConfig, attributeKey: string, logger: LogHandler) => string | null;
/**
 * Get event ID for the provided
 * @param  {ProjectConfig}   projectConfig  Object representing project configuration
 * @param  {string}          eventKey       Event key for which ID is to be determined
 * @return {string|null}     Event ID corresponding to the provided event key
 */
export declare const getEventId: (projectConfig: ProjectConfig, eventKey: string) => string | null;
/**
 * Get experiment status for the provided experiment key
 * @param  {ProjectConfig}  projectConfig   Object representing project configuration
 * @param  {string}         experimentKey   Experiment key for which status is to be determined
 * @return {string}         Experiment status corresponding to the provided experiment key
 * @throws If experiment key is not in datafile
 */
export declare const getExperimentStatus: (projectConfig: ProjectConfig, experimentKey: string) => string;
/**
 * Returns whether experiment has a status of 'Running'
 * @param  {ProjectConfig}  projectConfig   Object representing project configuration
 * @param  {string}         experimentKey   Experiment key for which status is to be compared with 'Running'
 * @return {boolean}                        True if experiment status is set to 'Running', false otherwise
 */
export declare const isActive: (projectConfig: ProjectConfig, experimentKey: string) => boolean;
/**
 * Determine for given experiment if event is running, which determines whether should be dispatched or not
 * @param  {ProjectConfig}  configObj       Object representing project configuration
 * @param  {string}         experimentKey   Experiment key for which the status is to be determined
 * @return {boolean}                        True if the experiment is running
 *                                          False if the experiment is not running
 *
 */
export declare const isRunning: (projectConfig: ProjectConfig, experimentKey: string) => boolean;
/**
 * Get audience conditions for the experiment
 * @param  {ProjectConfig}  projectConfig   Object representing project configuration
 * @param  {string}         experimentId    Experiment id for which audience conditions are to be determined
 * @return {Array<string|string[]>}         Audience conditions for the experiment - can be an array of audience IDs, or a
 *                                          nested array of conditions
 *                                          Examples: ["5", "6"], ["and", ["or", "1", "2"], "3"]
 * @throws If experiment key is not in datafile
 */
export declare const getExperimentAudienceConditions: (projectConfig: ProjectConfig, experimentId: string) => Array<string | string[]>;
/**
 * Get variation key given experiment key and variation ID
 * @param  {ProjectConfig}  projectConfig   Object representing project configuration
 * @param  {string}         variationId     ID of the variation
 * @return {string|null}    Variation key or null if the variation ID is not found
 */
export declare const getVariationKeyFromId: (projectConfig: ProjectConfig, variationId: string) => string | null;
/**
 * Get variation given variation ID
 * @param  {ProjectConfig}  projectConfig   Object representing project configuration
 * @param  {string}         variationId     ID of the variation
 * @return {Variation|null}    Variation or null if the variation ID is not found
 */
export declare const getVariationFromId: (projectConfig: ProjectConfig, variationId: string) => Variation | null;
/**
 * Get the variation ID given the experiment key and variation key
 * @param  {ProjectConfig}  projectConfig   Object representing project configuration
 * @param  {string}         experimentKey   Key of the experiment the variation belongs to
 * @param  {string}         variationKey    The variation key
 * @return {string|null}    Variation ID or null
 */
export declare const getVariationIdFromExperimentAndVariationKey: (projectConfig: ProjectConfig, experimentKey: string, variationKey: string) => string | null;
/**
 * Get experiment from provided experiment key
 * @param  {ProjectConfig}  projectConfig  Object representing project configuration
 * @param  {string}         experimentKey  Event key for which experiment IDs are to be retrieved
 * @return {Experiment}     Experiment
 * @throws If experiment key is not in datafile
 */
export declare const getExperimentFromKey: (projectConfig: ProjectConfig, experimentKey: string) => Experiment;
/**
 * Given an experiment id, returns the traffic allocation within that experiment
 * @param  {ProjectConfig}  projectConfig  Object representing project configuration
 * @param  {string}         experimentId   Id representing the experiment
 * @return {TrafficAllocation[]}           Traffic allocation for the experiment
 * @throws If experiment key is not in datafile
 */
export declare const getTrafficAllocation: (projectConfig: ProjectConfig, experimentId: string) => TrafficAllocation[];
/**
 * Get experiment from provided experiment id. Log an error if no experiment
 * exists in the project config with the given ID.
 * @param  {ProjectConfig}  projectConfig  Object representing project configuration
 * @param  {string}         experimentId   ID of desired experiment object
 * @param  {LogHandler}     logger
 * @return {Experiment|null}               Experiment object or null
 */
export declare const getExperimentFromId: (projectConfig: ProjectConfig, experimentId: string, logger: LogHandler) => Experiment | null;
/**
 * Returns flag variation for specified flagKey and variationKey
 * @param  {flagKey}        string
 * @param  {variationKey}   string
 * @return {Variation|null}
 */
export declare const getFlagVariationByKey: (projectConfig: ProjectConfig, flagKey: string, variationKey: string) => Variation | null;
/**
 * Get feature from provided feature key. Log an error if no feature exists in
 * the project config with the given key.
 * @param  {ProjectConfig}    projectConfig
 * @param  {string}           featureKey
 * @param  {LogHandler}       logger
 * @return {FeatureFlag|null} Feature object, or null if no feature with the given
 *                            key exists
 */
export declare const getFeatureFromKey: (projectConfig: ProjectConfig, featureKey: string, logger: LogHandler) => FeatureFlag | null;
/**
 * Get the variable with the given key associated with the feature with the
 * given key. If the feature key or the variable key are invalid, log an error
 * message.
 * @param  {ProjectConfig}        projectConfig
 * @param  {string}               featureKey
 * @param  {string}               variableKey
 * @param  {LogHandler}           logger
 * @return {FeatureVariable|null} Variable object, or null one or both of the given
 * feature and variable keys are invalid
 */
export declare const getVariableForFeature: (projectConfig: ProjectConfig, featureKey: string, variableKey: string, logger: LogHandler) => FeatureVariable | null;
/**
 * Get the value of the given variable for the given variation. If the given
 * variable has no value for the given variation, return null. Log an error message if the variation is invalid. If the
 * variable or variation are invalid, return null.
 * @param  {ProjectConfig}     projectConfig
 * @param  {FeatureVariable}   variable
 * @param  {Variation}         variation
 * @param  {LogHandler}        logger
 * @return {string|null}       The value of the given variable for the given
 * variation, or null if the given variable has no value
 * for the given variation or if the variation or variable are invalid
 */
export declare const getVariableValueForVariation: (projectConfig: ProjectConfig, variable: FeatureVariable, variation: Variation, logger: LogHandler) => string | null;
/**
 * Given a variable value in string form, try to cast it to the argument type.
 * If the type cast succeeds, return the type casted value, otherwise log an
 * error and return null.
 * @param {string}     variableValue  Variable value in string form
 * @param {string}     variableType   Type of the variable whose value was passed
 *                                    in the first argument. Must be one of
 *                                    FEATURE_VARIABLE_TYPES in
 *                                    lib/utils/enums/index.js. The return value's
 *                                    type is determined by this argument (boolean
 *                                    for BOOLEAN, number for INTEGER or DOUBLE,
 *                                    and string for STRING).
 * @param {LogHandler} logger         Logger instance
 * @returns {*}                       Variable value of the appropriate type, or
 *                                    null if the type cast failed
 */
export declare const getTypeCastValue: (variableValue: string, variableType: VariableType, logger: LogHandler) => FeatureVariableValue;
/**
 * Returns an object containing all audiences in the project config. Keys are audience IDs
 * and values are audience objects.
 * @param   {ProjectConfig}     projectConfig
 * @returns {{ [id: string]: Audience }}
 */
export declare const getAudiencesById: (projectConfig: ProjectConfig) => {
    [id: string]: Audience;
};
/**
 * Returns true if an event with the given key exists in the datafile, and false otherwise
 * @param   {ProjectConfig}     projectConfig
 * @param   {string}            eventKey
 * @returns {boolean}
 */
export declare const eventWithKeyExists: (projectConfig: ProjectConfig, eventKey: string) => boolean;
/**
 * Returns true if experiment belongs to any feature, false otherwise.
 * @param   {ProjectConfig}       projectConfig
 * @param   {string}              experimentId
 * @returns {boolean}
 */
export declare const isFeatureExperiment: (projectConfig: ProjectConfig, experimentId: string) => boolean;
/**
 * Returns the JSON string representation of the datafile
 * @param   {ProjectConfig}       projectConfig
 * @returns {string}
 */
export declare const toDatafile: (projectConfig: ProjectConfig) => string;
/**
 * @typedef   {Object}
 * @property  {Object|null} configObj
 * @property  {Error|null}  error
 */
/**
 * Try to create a project config object from the given datafile and
 * configuration properties.
 * Returns an object with configObj and error properties.
 * If successful, configObj is the project config object, and error is null.
 * Otherwise, configObj is null and error is an error with more information.
 * @param   {Object}         config
 * @param   {Object|string}  config.datafile
 * @param   {Object}         config.jsonSchemaValidator
 * @param   {Object}         config.logger
 * @returns {Object}         Object containing configObj and error properties
 */
export declare const tryCreatingProjectConfig: (config: TryCreatingProjectConfigConfig) => {
    configObj: ProjectConfig | null;
    error: Error | null;
};
/**
 * Get the send flag decisions value
 * @param  {ProjectConfig}   projectConfig
 * @return {boolean}         A boolean value that indicates if we should send flag decisions
 */
export declare const getSendFlagDecisionsValue: (projectConfig: ProjectConfig) => boolean;
declare const _default: {
    createProjectConfig: (datafileObj?: JSON | undefined, datafileStr?: string | null) => ProjectConfig;
    getExperimentId: (projectConfig: ProjectConfig, experimentKey: string) => string;
    getLayerId: (projectConfig: ProjectConfig, experimentId: string) => string;
    getAttributeId: (projectConfig: ProjectConfig, attributeKey: string, logger: LogHandler) => string | null;
    getEventId: (projectConfig: ProjectConfig, eventKey: string) => string | null;
    getExperimentStatus: (projectConfig: ProjectConfig, experimentKey: string) => string;
    isActive: (projectConfig: ProjectConfig, experimentKey: string) => boolean;
    isRunning: (projectConfig: ProjectConfig, experimentKey: string) => boolean;
    getExperimentAudienceConditions: (projectConfig: ProjectConfig, experimentId: string) => (string | string[])[];
    getVariationFromId: (projectConfig: ProjectConfig, variationId: string) => Variation | null;
    getVariationKeyFromId: (projectConfig: ProjectConfig, variationId: string) => string | null;
    getVariationIdFromExperimentAndVariationKey: (projectConfig: ProjectConfig, experimentKey: string, variationKey: string) => string | null;
    getExperimentFromKey: (projectConfig: ProjectConfig, experimentKey: string) => Experiment;
    getTrafficAllocation: (projectConfig: ProjectConfig, experimentId: string) => TrafficAllocation[];
    getExperimentFromId: (projectConfig: ProjectConfig, experimentId: string, logger: LogHandler) => Experiment | null;
    getFlagVariationByKey: (projectConfig: ProjectConfig, flagKey: string, variationKey: string) => Variation | null;
    getFeatureFromKey: (projectConfig: ProjectConfig, featureKey: string, logger: LogHandler) => FeatureFlag | null;
    getVariableForFeature: (projectConfig: ProjectConfig, featureKey: string, variableKey: string, logger: LogHandler) => FeatureVariable | null;
    getVariableValueForVariation: (projectConfig: ProjectConfig, variable: FeatureVariable, variation: Variation, logger: LogHandler) => string | null;
    getTypeCastValue: (variableValue: string, variableType: VariableType, logger: LogHandler) => FeatureVariableValue;
    getSendFlagDecisionsValue: (projectConfig: ProjectConfig) => boolean;
    getAudiencesById: (projectConfig: ProjectConfig) => {
        [id: string]: Audience;
    };
    getAudienceSegments: (audience: Audience) => string[];
    eventWithKeyExists: (projectConfig: ProjectConfig, eventKey: string) => boolean;
    isFeatureExperiment: (projectConfig: ProjectConfig, experimentId: string) => boolean;
    toDatafile: (projectConfig: ProjectConfig) => string;
    tryCreatingProjectConfig: (config: TryCreatingProjectConfigConfig) => {
        configObj: ProjectConfig | null;
        error: Error | null;
    };
};
export default _default;
