export const AssetType = {
  IMAGE: 1,
  VIDEO: 2,
  AUDIO: 3
}

export const Role = {
  SUPER_ADMIN: 'ROLE_SUPER_ADMIN',
  ADMIN: 'ROLE_ADMIN',
  SUPERVISOR: 'ROLE_OPERATION_SUPERVISOR',
  STAFF: 'ROLE_OPERATION_STAFF',
  VISITOR: '__ROLE_VISITOR__'
}

export const State = {
  READY: 0,
  SUBMITTED: 1,
  RESOLVED: 2,
  REJECTED: 3,
  // 占位值，用于区分是审核还是查看自身的数据，发送请求前会被修改为SUBMITTED
  REVIEW: 99
}

export const ScheduleType = {
  RECUR: 2,
  COMPLEX: 3
}

export const PublishType = {
  CALENDAR: 1,
  EVENT: 2
}

export const EventPriority = {
  DEFAULT: 1,
  NORMAL: 2,
  INSERTED: 3
}

export const EventFreq = {
  ONCE: 'ONCE',
  WEEKLY: 'WEEKLY'
}

export const EventTarget = {
  PROGRAM: 1,
  RECUR: 2
}

export const ThirdPartyDevice = {
  GATEWAY: 0,
  RECEIVING_CARD: 1,
  SENDING_CARD: 2,
  SCREEN: 3,
  LED_CAMERA: 4,
  TRAFFIC_CAMERA: 5
}

export const Transmitter = {
  IS_ASYNC: 1,
  SUPPORT_DETECTION: 1 << 1,
  SUPPORT_CONTENT_PROTECTION: 1 << 2
}

export const Access = {
  // frontend
  VIEW_CAMERAS: 'frontend:cameras',
  VIEW_SENSORS: 'frontend:sensors',
  // backend
  MANAGE_TENANTS: 'manange-tenants',
  MANAGE_TENANT: 'manange-tenant',
  MANAGE_GROUP: 'manage-group',
  MANAGE_DEVICE: 'manage-device',
  MANAGE_CALENDAR: 'manage-calendar',
  VIEW_LOGS: 'view-logs'
}

export const RoleAccess = {
  [Role.SUPER_ADMIN]: [
    Access.MANAGE_TENANTS,
    Access.MANAGE_DEVICE,
    Access.MANAGE_CALENDAR,
    Access.MANAGE_GROUP,
    Access.VIEW_LOGS
  ],
  [Role.ADMIN]: [
    Access.MANAGE_TENANT,
    Access.MANAGE_DEVICE,
    Access.MANAGE_CALENDAR,
    Access.MANAGE_GROUP,
    Access.VIEW_LOGS
  ],
  [Role.SUPERVISOR]: [
    Access.MANAGE_DEVICE,
    Access.VIEW_CALENDAR,
    Access.MANAGE_GROUP,
    Access.VIEW_LOGS
  ],
  [Role.STAFF]: [
    Access.MANAGE_DEVICE,
    Access.MANAGE_CALENDAR,
    Access.VIEW_LOGS
  ],
  [Role.VISITOR]: [
  ]
}

Object.values(RoleAccess).forEach(roles => {
  if (__SENSOR__) {
    roles.push(Access.VIEW_SENSORS)
  }
  if (__CAMERA__) {
    roles.push(Access.VIEW_CAMERAS)
  }
})

export const AlarmStrategy = {
  note: '短信',
  email: '邮件',
  wechat: '微信',
  wechatApplet: '小程序'
}

export const AlarmStrategies = ['note', 'email', 'wechat', 'wechatApplet']
