/**
 * 存储Key常量
 */
export const STORAGE_KEYS = {
  // 用户标识
  DISTINCT_ID: 'ph_distinct_id',
  ANONYMOUS_ID: 'ph_anonymous_id',

  // 会话
  SESSION_ID: 'ph_session_id',
  SESSION_START_TIME: 'ph_session_start_time',
  LAST_ACTIVE_TIME: 'ph_last_active_time',

  // 离线事件缓存
  OFFLINE_EVENTS: 'ph_offline_events',

  // 用户属性缓存
  USER_PROPERTIES: 'ph_user_properties',

  // 设备ID
  DEVICE_ID: 'ph_device_id',
}

/**
 * PostHog保留事件名
 */
export const RESERVED_EVENTS = {
  IDENTIFY: '$identify',
  PAGE_VIEW: '$pageview',
  PAGE_LEAVE: '$pageleave',
  AUTOCAPTURE: '$autocapture',
}

/**
 * 默认配置
 */
export const DEFAULT_CONFIG = {
  // 队列配置
  queue: {
    maxSize: 20,
    flushInterval: 30000,
  },

  // 请求配置
  request: {
    timeout: 10000,
    maxRetries: 3,
    retryDelay: 1000,
  },

  // 会话配置
  session: {
    timeout: 30 * 60 * 1000, // 30分钟
  },

  // 离线缓存配置
  offline: {
    maxEvents: 100,
  },
}

/**
 * HTTP状态码
 */
export const HTTP_STATUS = {
  OK: 200,
  CREATED: 201,
  BAD_REQUEST: 400,
  UNAUTHORIZED: 401,
  NOT_FOUND: 404,
  SERVER_ERROR: 500,
}