import Mock from 'mockjs'// es6语法引入mock模块

// 后续项目需要产生模拟数据即可使用此工具
export default {
  data: Mock.mock({
    'examList|10': [{
      'id|+1': 1,
      'name': '@cname',
      'ago|18-28': 25,
      'sex|1': ['男', '女'],
      'job|1': ['web', 'UI', 'python', 'php']
    }],
    'classList|8': [{
      'id|+1': 1,
      'name': function() {
        return '高二' + this.id + '班'
      },
      'classId|+1': 140015511001,
      'average|520-630': 630,
      'totalNum|50-70': 70,
      'entryNum|50-70': function() {
        return (this.totalNum - Math.ceil(Math.random() * 20))
      },
      'gradeRank': function() {
        return this.id
      },
      'entryRate': function() {
        return (this.entryNum / this.totalNum).toFixed(2) * 100 + '%'
      },
      'standardDeviation': 55,
      'rankStatus|1-8': 1
    }],
    'studentList|60': [{
      'id|+1': 1,
      'name': '@cname',
      'className': '初一5班',
      'memberId|+1': 140015511001,
      'score|520-630': 630,
      'classRank|1-60': 1,
      'classPR': function() {
        return 100 - Math.ceil(Math.random() * 20)
      },
      'gradeRank|1-200': function() {
        return this.classRank + Math.ceil(Math.random() * 100)
      },
      'gradePR': function() {
        return 100 - Math.ceil(Math.random() * 20)
      },
      'areaRank|1-400': function() {
        return this.classRank + Math.ceil(Math.random() * 300)
      },
      'areaPR': function() {
        return 100 - Math.ceil(Math.random() * 20)
      },
      'chinese|90-150': 150,
      'math|90-150': 150,
      'english|90-150': 150,
      'chemistry|60-100': 100,
      'physics|60-100': 100,
      'biology|60-100': 100,
      'chineseRank|1-400': 400,
      'mathRank|1-400': 400,
      'englishRank|1-400': 400,
      'chemistryRank|1-400': 400,
      'physicsRank|1-400': 400,
      'biologyRank|1-400': 400,
      'changesStatus|1': [1, -1, 0],
      'changesStatus2|1': [1, -1, 0],
      'changesStatus3|1': [1, -1, 0],
      'changesVal|1-30': 1,
      'changesVal2|1-30': 1,
      'changesVal3|1-30': 1
      }],
      'studentList|2-5': [{
          'name|+1': ['初一一班', '初一二班', '初一三班', '初一四班'],
          'classId|+1': 1400111001,
          'studentScore|45-65': [{
              'name': '@cname',
              'score|50-100': 100,
              'autoQue|0-40': 40,
              'manualQue': function(){ 
                  return this.score - this.autoQue
              }
          }]
      }],
      'classData|5': [{
          'type|+1': ['评量测验', '自主学习', '作业活动', '投票活动', '问卷调查'],
          'code|+1': [1, 2, 3, 4, 5],
          'data|8-15': [{
              'name': '@cword(3, 10)',
              'time': '@date',
              'endTime':'@date',
              'class|1-3': [{
                  'value|+1': ['初一五班', '初一一班', '初一二班', '初一三班', '初一四班']
              }]
          }
          ]

      }],
      'studentQue|0-50': [
          {
              'name': '@cname',
              'sueList|10': [
                  {

                  }
              ]
      }
      ],
    'subjectList|10': [{
      'id|+1': 1,
      'className|1-10': 1,
      'chinese|60-120': 60,
      'math|60-120': 60,
      'english|60-120': 60,
      'physics|60-120': 60,
      'chemistry|60-120': 60,
      'biology|60-120': 60
    }],
    "schoolList|50": [{
      'picture': '@dataImage("100x100")',
      'schoolName': '@ctitle(10,20)',
      'schoolCode': '@word(5, 10)',
      'address': '@ctitle(20,40)'
    }],
    "teacherList|50": [{
      'id':  /[a-z]{2}[A-Z]{2}[0-9]/,
      'TEAMModelId': function(){ // 隨機ID
          return this.id + '#' + (10000 - Math.ceil(Math.random() * (Math.random() * 10000)))
      },
      'name': '@ctitle(10,20)',
      'jobTitle|1': ['工程師', '資訊組長', '身教組長', '教務主任', '活動統籌', '註冊組長', '教務組長', '體育組長'],
      'roles|1': ['teacher', 'admin'], // 角色
      'permissions|1-3': ['teacherMgmt_read', 'teacherMgmt_crt','teacher1','teacher2','teacher3','teacher4','teacher5','teacher6','teacher7'],  // 權限
      'cellphone|1': ['','0911234567', '123234234234', '23423423','0982348833'],
      'email|1': ['', '123@gmai.com', 'mmm@outlook.com', '3434@baidu.com', '234234@habook.com.tw'],
      'loginCount|1-999': 999 
    }],
    "Mocklogin" :{
      'id':  /[a-z]{2}[A-Z]{2}[0-9]/,
      'TEAMModelId': function(){ // 隨機ID
          return this.id + '#' + (10000 - Math.ceil(Math.random() * (Math.random() * 10000)))
      },
      'name': '@cname',  // 中文名称
      'emal': /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/,
      'joinSchool|10':  // 已加入的學校List P.S. 先預設一個
        [
          {
            'avatar': '@dataImage("100x100")',
            'name': '@ctitle(10,20)',
            'shortCode': '@word(5, 10)',
            'code': /\d{10,10}/
          }        
        ],
      'applicationSchool':  // 申請中的學校List
        [
          
        ],
      'roles': ['admin', 'student,'], // 角色
      'permissions': ['TRM_Read'],  // 權限
      'identity': 'T', // T: 老師, S: 學生
      'studentURL': function(){ // 連到Aclassone
        if(this.identity == 'S'){ 
          return 'http://ies.habook.com.tw/cms/aclass_one/home/index'
        } 
      }
    },
    'personnelList|30': [{
      'type|1': ["invite", "apply"],
      'identy|+1': 123456789,
      'id': function(){ // 隨機ID
          return "TB"+this.identy
      },
      'name': '@name',
      'crtDatatime': '@datetime',
      'crtDate': function(){
        let date = new Date(this.crtDatatime)
        return date.getTime()
      },
      'remindDatetime': '@datetime',
      'remindDate': function(){
        let date = new Date(this.remindDatetime)
        return date.getTime()
      }
    }],
      'userListFromCoreID': [
          {
              'id': 'jeffmk30033',
              'mail': 'jeffmk3@gmail.com',
              'mobile': '955493542',
              'country': '886',
              'name': 'jeff',
              'picture': 'http://icons.iconarchive.com/icons/hopstarter/iron-man-avatar/128/Iron-Man-Mark-III-01-icon.png'
          },
          {
              'id': 'conniee01072426',
              'mail': 'aliceluying17@gmail.com',
              'mobile': '972118402',
              'country': '886',
              'name': 'Connie Lu',
              'picture': 'http://icons.iconarchive.com/icons/chanut/role-playing/128/Elf-icon.png'
          },
          {
              'id': 'gina7209',
              'mail': 'gina@aclass.com.tw',
              'mobile': '963669876',
              'country': '886',
              'name': '紀滎姿',
              'picture': null
          },
          {
              'id': 'accounttest10989',
              'mail': 'accounttest1@habook.com.tw',
              'mobile': null,
              'country': null,
              'name': '啊康測試123',
              'picture': 'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10141-girl-light-skin-tone-icon.png'
          }
      ],
      'userFromCoreID': {
          'id': '@datetime',
          'id': '@id',
          'mail': '@email',
          'mobile': /\d{8,10}/,
          'country|1': ['886', '86'],
          'name': '@name',
          'picture|1': [
              'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10141-girl-light-skin-tone-icon.png',
              'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10159-woman-light-skin-tone-icon.png',
              'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10136-boy-medium-light-skin-tone-icon.png',
              'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10142-girl-medium-light-skin-tone-icon.png',
              'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10135-boy-light-skin-tone-icon.png',
              'http://icons.iconarchive.com/icons/google/noto-emoji-people-face/256/10147-adult-light-skin-tone-icon.png'
          ]
      },
      //Osbert-classroom的假資料
      'hiteachSetting|20': [{
        'id|+1': 1234567,
        'serial': '12DLT43F-EE20-4775-93F5-6BCC',
        'prodGroup': 'HiTeach 5',
        'prodName|1' : ['PRO', 'TBL','STD'],
        'deviceMax': '@natural(0, 10)', // 可綁定最大值，如只有一則回傳單一
        'DateDate|1': [0, 1, 1602691199], //已到期，無限期或有一個結束時間
        'aprule': {
          'sokapp|1': true, // 蘇格拉底議課
          'sokvdo|1': true, // 蘇格拉底報告
          'ezs|1': true, // 錄播系統

          // 目前沒有的
          'remoteSys|1': true, // 遠距教室服務
          'sokDestop|1': true, // 蘇格拉底桌面
          'sokreport|1': true, // 蘇格拉底報告
        },
        "deviceBound": function(){
          let max = this.deviceMax
          let data = []
          for(let i = 0; i< max; i++){
            data.push({
              'uuid': "OSBERT-COMPUTER",
              'ip': '192.168.0.1',
              'classId': 'hbcn0101',
              'computer': "Microsoft Winfows NT 10.0.18883.0 | Intel(R Core(TM i7-10700 CPU @ 2.9Ghz",
              'deveiceId': '12DLT43F-EE20-4775-93F5-6BCC'
            })
          }
          return data
        }
      }],
  })
}