import SplitIO from '../../../types/splitio';

// Special treatments
export const CONTROL = 'control';
export const CONTROL_WITH_CONFIG = {
  treatment: CONTROL,
  config: null
};

// Constants for unknown and not-applicable values
export const UNKNOWN = 'unknown';
export const NA = 'NA';

// Integration data types
export const SPLIT_IMPRESSION = 'IMPRESSION';
export const SPLIT_EVENT = 'EVENT';

// Impression collection modes
export const DEBUG = 'DEBUG';
export const OPTIMIZED = 'OPTIMIZED';
export const NONE = 'NONE';

// SDK Modes
export const LOCALHOST_MODE = 'localhost';
export const STANDALONE_MODE = 'standalone';
export const PRODUCER_MODE = 'producer';
export const CONSUMER_MODE = 'consumer';
export const CONSUMER_PARTIAL_MODE = 'consumer_partial';

// Storage types
export const STORAGE_MEMORY: SplitIO.StorageType = 'MEMORY';
export const STORAGE_LOCALSTORAGE: SplitIO.StorageType = 'LOCALSTORAGE';
export const STORAGE_REDIS: SplitIO.StorageType = 'REDIS';
export const STORAGE_PLUGGABLE: SplitIO.StorageType = 'PLUGGABLE';

// User consent
export const CONSENT_GRANTED = 'GRANTED'; // The user has granted consent for tracking events and impressions
export const CONSENT_DECLINED = 'DECLINED'; // The user has declined consent for tracking events and impressions
export const CONSENT_UNKNOWN = 'UNKNOWN'; // The user has neither granted nor declined consent for tracking events and impressions

// Client method names
export const GET_TREATMENT = 'getTreatment';
export const GET_TREATMENTS = 'getTreatments';
export const GET_TREATMENT_WITH_CONFIG = 'getTreatmentWithConfig';
export const GET_TREATMENTS_WITH_CONFIG = 'getTreatmentsWithConfig';
export const GET_TREATMENTS_BY_FLAG_SET = 'getTreatmentsByFlagSet';
export const GET_TREATMENTS_BY_FLAG_SETS = 'getTreatmentsByFlagSets';
export const GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET = 'getTreatmentsWithConfigByFlagSet';
export const GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS = 'getTreatmentsWithConfigByFlagSets';
export const TRACK_FN_LABEL = 'track';

// Manager method names
export const SPLIT_FN_LABEL = 'split';
export const SPLITS_FN_LABEL = 'splits';
export const NAMES_FN_LABEL = 'names';

// Telemetry
export const QUEUED = 0;
export const DROPPED = 1;
export const DEDUPED = 2;

export const STANDALONE_ENUM = 0;
export const CONSUMER_ENUM = 1;
export const CONSUMER_PARTIAL_ENUM = 2;

export const OPTIMIZED_ENUM = 0;
export const DEBUG_ENUM = 1;
export const NONE_ENUM = 2;

export const SPLITS = 'sp';
export const IMPRESSIONS = 'im';
export const IMPRESSIONS_COUNT = 'ic';
export const EVENTS = 'ev';
export const TELEMETRY = 'te';
export const TOKEN = 'to';
export const SEGMENT = 'se';
export const MEMBERSHIPS = 'ms';

export const TREATMENT = 't';
export const TREATMENTS = 'ts';
export const TREATMENT_WITH_CONFIG = 'tc';
export const TREATMENTS_WITH_CONFIG = 'tcs';
export const TREATMENTS_BY_FLAGSET = 'tf';
export const TREATMENTS_BY_FLAGSETS = 'tfs';
export const TREATMENTS_WITH_CONFIG_BY_FLAGSET = 'tcf';
export const TREATMENTS_WITH_CONFIG_BY_FLAGSETS = 'tcfs';
export const TRACK = 'tr';

export const CONNECTION_ESTABLISHED = 0;
export const OCCUPANCY_PRI = 10;
export const OCCUPANCY_SEC = 20;
export const STREAMING_STATUS = 30;
export const SSE_CONNECTION_ERROR = 40;
export const TOKEN_REFRESH = 50;
export const ABLY_ERROR = 60;
export const SYNC_MODE_UPDATE = 70;
export const AUTH_REJECTION = 80;

export const STREAMING = 0;
export const POLLING = 1;
export const REQUESTED = 0;
export const NON_REQUESTED = 1;
export const DISABLED = 0;
export const ENABLED = 1;
export const PAUSED = 2;

export const FLAG_SPEC_VERSION = '1.3';

// Matcher types
export const IN_SEGMENT = 'IN_SEGMENT';
export const IN_LARGE_SEGMENT = 'IN_LARGE_SEGMENT';
export const IN_RULE_BASED_SEGMENT = 'IN_RULE_BASED_SEGMENT';

export const STANDARD_SEGMENT = 'standard';
export const LARGE_SEGMENT = 'large';
export const RULE_BASED_SEGMENT = 'rule-based';
