import DictValue from '../../viewmodel/DictValue'
import HashMap from '@ohos.util.HashMap'

export default class CommonConstants {
  // perferences数据库名称
  static readonly PREFERENCE_INSTANCE_NAME: string = 'myStore';
  static readonly RDB_NAME: string = 'Presentation.db'
  static readonly PRE_NAME: string = 'MyPreferences'
  static AUTH_TOKEN: string = ''
  // 附件地址前缀
  static FILE_URL_PREFIX: string = 'http://192.168.1.3:9000'
  // 图片地址前缀
  static PICTURE_URL_PREFIX: string = 'http://192.168.1.3:20001'

  // 当前登录用户相关信息
  // static USER_ID?: number
  // static USER_NAME: string = ''
  // static USER_AVATAR: string = ''
  // static STATION_NANE: string = ''
  // static DEPARTMENT_NANE: string = ''
  // static PRODUCT_NANE: string = ''
  // static STATION_ID: number
  // static STATION_CODE: string = ''
  // static STATION_IP: string = ''
  static stationDictValue: string = ''

  static MATERIAL_BOX_ID: string = ''
  // 是否是退出登陆
  static LOGIN_OUT: boolean = false
  static readonly STORAGE_TYPE: string[] = ['电子元器件', '电路板', '结构件', '辅助材料']
  static readonly ipPrefix: string = '192.168.1.'
  static mqttSubscribeTopic1: string = 'station11/data/devices';
  static readonly mqttSubscribeTopic2: string = 'station11/data/devices';
  static readonly mqttSubscribeTopic3: string = 'station100/data/devices';
  static readonly mqttSubscribePublish: string = 'station11/cmd/devices';
  // 默认随机ip
  static readonly STATION_DEFAULT_IP: string = '192.168.1.' + Math.floor(Math.random() * 90 + 10)

  // 电烙铁允许最大、最小温度
  static readonly ironTempMin: number = 150
  static readonly ironTempMax: number = 450

  static OPERATION_COMPONENT_TYPE: Map<string, string> = new Map<string, string>([
    ['wuliaocaiji', '1'],
    ['jiluxiang', '2'],
    ['duomeiticaiji', '3'],
    ['ESOP', '4'],
    ['dianjian', '5'],
    ['shebeiqueren', '6'],
    ['jingu', '7'],
    // ['tiaoshipipei', '8'],
    ['mingpaibangding', '9'],
    ['operationExcel', '10'],
    ['zidongceshi', '11'],
    ['shebeiqueren', '12'],
  ]);

  static DICT_DATA: HashMap<string, DictValue[]> = new HashMap<string, DictValue[]>()

  static readonly attrMap: Map<string, string> = new Map([
    ['LedRed', 'SSD'],
    ['LedOrange', 'SSD'],
    ['LedGreen', 'SSD'],
    ['Buzzer', 'SSD'],
    ['ExhaustFan', 'HYPYJ'],
    ['SolderingCurrTemp', 'WKDLT'],
    ['SolderingSetTemp', 'WKDLT'],

    ['TightenTorqueMax', 'DDLSD'],
    ['TightenResult', 'DDLSD'],
    ['TightenTorqueTarget', 'DDLSD'],
    ['TorqueHoldTime', 'DDLSD'],
    ['TighteRotationDirection', 'DDLSD'],
    ['TorqueUpperLimit', 'DDLSD'],
    ['TorqueLowerLimit', 'DDLSD'],
    ['SlipDetectionTurns', 'DDLSD'],
    ['FloatDetectionTurns', 'DDLSD'],
    ['EnableFloatSlipDetection', 'DDLSD'],
    ['ScrewWarning', 'DDLSD'],

    ['RingWearNormal', 'FJDJC'],
    ['RingWearStandby', 'FJDJC'],
    ['RingWearFault', 'FJDJC'],
    ['RfidCardNum1', 'DKQ'],
    ['RfidCardNum2', 'DKQ'],
    ['lighting', 'ZM'],
    ['Temperature', 'WSDCGQ'],
    ['Humidity', 'WSDCGQ'],
  ]);
}

export enum DeviceType {
  ThreeColourLight = 'SSD',
  WeldFumeExtractor = 'HYPYJ',
  ElectricSolderingIron = 'WKDLT',
  ElectricScrewdriver = 'DDLSD',
  AntiWristStrap = 'FJDJC',
  CardReader = 'DKQ',
  Lighting = 'ZM',
  TempHumiditySensor = 'WSDCGQ',
}