export class CacheConst {
  static readonly AUTO_LOGOUT = 'auto_logout:';
  static readonly ACCESS_TOKEN = 'access_token:';
  static readonly REFRESH_TOKEN = 'refresh_token:';
  static readonly HOTP = 'hotp:';
  static readonly LINE = 'line:';
  static readonly DOCUMENT = 'document:';
  static readonly IMPORT_JOB = 'import-job';
  static readonly PUBLIC_SIGN = 'public-sign';

  async getDocumetChangeKey(userId: number) {
    return `${CacheConst.DOCUMENT}:change:${userId}`;
  }

  getDocumetFirstChangeKey(userId: number) {
    return `${CacheConst.DOCUMENT}change:${userId}:first`;
  }

  getDocumetSecondChangeKey(userId: number) {
    return `${CacheConst.DOCUMENT}change:${userId}:second`;
  }

  static getImportJobKey(uid: string) {
    return `${CacheConst.IMPORT_JOB}:${uid}`;
  }

  static getKeyDataImport(uid: string) {
    return `${CacheConst.IMPORT_JOB}:${uid}:`;
  }

  static getKeyMapData(uid: string) {
    return `${CacheConst.IMPORT_JOB}:${uid}:map`;
  }

  static genKeyAccessToken = (
    uid: string | number,
    tid: string,
    prefix = 'admin',
  ) => {
    return `${this.ACCESS_TOKEN}${prefix}:${uid}:${tid}`;
  };

  static genKeyRefreshToken = (
    uid: string | number,
    tid: string,
    prefix = 'admin',
  ) => {
    return `${this.REFRESH_TOKEN}${prefix}:${uid}:${tid}`;
  };

  static genKeyPubicName = (
    uid: string | number,
    tid: string,
    prefix = 'public_name',
  ) => {
    return `${this.PUBLIC_SIGN}:${prefix}:${uid}:${tid}`;
  };
}

export const ALL_TOPIC_LINE = 'all_topic_line';
export const TOPIC_LINE = 'topic_line:';
export const ALL_QUESTION_LINE = 'all_question_line:';
export const ANSWER_LINE = 'answer_line:';
export const ENTERING_DATA_LINE = 'entering_data_line';
export const CONTRACT_LOGIN = 'contract_login';
