module RepoDetail {
//宏伟
//如果有指定repo，那就是指定repo的DOlist。
//如果没指定repo，那就是全部的。
//这是search engine的接口，为什么还没接上？？
//TODO TODO
    export function getDoList(arg) {
        if (arg.indexOf("shanxi/Repository") != - 1){
            var ret = {
            };
            ret.result = {
            };
            var data = [];
            data.push({
                "createTime":1676481531275, "owner":"大同市人力资源和社会保障局",
                "type":"CSV",
                "description":"大同市人力资源和社会保障局2022年取证补贴资金统计表",
                "schema":"{\"序号\":\"number\",\"项目名称\":\"string\",\"高标准农田建设项目\":\"number\",\"高效节水灌溉措施\":\"number\",\"总计\":\"number\",\"财政资金\":\"number\",\"自筹资金\":\"number\",\"其他资金\":\"number\",\"高标准农田建设地点\":\"string\",\"高效节水灌溉建设地点\":\"string\"}",
                "doId":"shanxi/Repository/6ca5a5e3-f2b4-43c3-bdcd-280889bbd12f"
            });
            data.push({
                "createTime":1676481514049,
                "owner":"大同市农业局", "type":"CSV",
                "description":"大同市2021年第二批拟建高标准农田项目情况表",
                "schema":"",
                "doId":"shanxi/Repository/a1838f08-56d4-45ca-a9c4-afaa389b4b14"
            });
            data.push({
                "createTime":1676553567486, "owner":"大同市卫生健康委员会", "type":"CSV", "description":"2021大同市新冠疫苗接种门诊公示.xlsx", "schema":"{\"接种单位名称\":\"string\",\"接种单位详细地址\":\"string\",\"所属县区\":\"string\",\"所属街道\":\"string\",\"详细地址（必填）\":\"string\",\"法定代表人姓名\":\"string\",\"科室负责人姓名\":\"string\",\"科室联系电话\":\"number\",\"接种时间\":\"string\"}", "doId":"shanxi/Repository/57fedf56-5155-4ff6-aabe-a998869f46b1"
            });
            data.push({
                "createTime":1676553952316, "owner":"大同市科学技术局", "type":"CSV", "description":"2022年大同市科技计划立项资金表.xls", "schema":"{\"计划编号\":\"string\",\"项目名称\":\"string\",\"承担单位\":\"string\",\"项目负责人\":\"string\",\"起止年限\":\"string\",\"下达资金\":\"string\"}", "doId":"shanxi/Repository/49fadb30-ef5a-440e-9c28-be1a8fd1cafc"
            });
            data.push({
                "createTime":1676554675160, "owner":"大同市人力资源和社会保障局", "type":"CSV", "description":"2022年度大同市市直企业职业技能提升部分培训补贴资金统计表（第一批)", "schema":"{\"企业名称\":\"string\",\"培训期号\":\"string\",\"培训人数\":\"string\",\"合格人数\":\"string\",\"补贴人数\":\"string\",\"培训补贴资金\":\"string\",\"单位补贴汇总\":\"string\",\"备注\":\"string\"}", "doId":"shanxi/Repository/4780c075-4608-48a0-9083-6c0a9a7f4357"
            });

            data.push({
                "createTime":1676558013851, "owner":"大同市财政局", "type":"CSV", "description":"提前下达2023年财政衔接推进乡村振兴补助资金预算指标分配表.xls", "schema":"{\"市县名\":\"string\",\"合计\":\"number\",\"巩固拓展脱贫攻坚成果和乡村振兴支出方向\":\"number\",\"少数民族发展支出方向\":\"number\",\"以工代赈支出方向\":\"number\",\"欠发达国有农场巩固提升支出方向\":\"number\",\"欠发达国有林场巩固提升支出方向\":\"number\",\"备注\":\"string\"}", "doId":"shanxi/Repository/9dc89e94-eba0-4683-bbe8-b9da8994d1c1"
            });
            data.push({"createTime":1676558051018,"owner":"大同市财政局","type":"CSV","description":"拟注销失业登记的公示名单","schema":"{\"姓名\":\"string\",\"身份证号\":\"string\"}","doId":"shanxi/Repository/8f74e220-5409-493a-a852-ecbe48734c31"});
            data.push({"createTime":1676558067499,"owner":"大同市卫生健康委","type":"CSV","description":"大同市中医医院2022年公开招聘编外聘用制工作人员岗位表","schema":"{\"招聘部门\":\"string\",\"招聘单位\":\"string\",\"招聘人数\":\"number\",\"年龄\":\"string\",\"学历\":\"string\",\"学位\":\"string\",\"专业\":\"string\",\"其它\":\"string\",\"备注\":\"string\"}","doId":"shanxi/Repository/90dfcb72-fad8-4f70-b672-e79416fd60ff"});
            data.push({"createTime":1676558083728,"owner":"大同市卫生健康委","type":"CSV","description":"大同市中医医院2022年公开招聘编外聘用制工作人员岗位计划调整表.xls","schema":"{\"招聘单位\":\"string\",\"招聘岗位\":\"string\",\"岗位代码\":\"string\",\"年龄\":\"string\",\"学历\":\"string\",\"学位\":\"string\",\"专业\":\"string\",\"其它\":\"string\",\"原招聘人数\":\"string\",\"调整情况\":\"string\",\"调整后招聘人数\":\"string\"}","doId":"shanxi/Repository/f56094c4-0a41-430d-865e-70ce142a43e5"});
            data.push({"createTime":1676558104281,"owner":"大同市人力资源和社会保障局","type":"CSV","description":"大同市代表队参加第三届全省职业技能大赛赛前培训补贴资金统计表","schema":"{\"序号\":\"string\",\"选手派出单位\":\"string\",\"参赛项目\":\"string\",\"参赛选手人数\":\"string\",\"指导老师人数\":\"string\",\"裁判老师人数\":\"string\",\"裁判人数\":\"string\",\"补贴标准（元）\":\"string\",\"补贴金额（元）\":\"string\",\"补贴金额小计（元）\":\"string\",\"备注\":\"string\"}","doId":"shanxi/Repository/24e8d16f-ac53-4bdb-88b6-c7d9993e48cf"});
            data.push({"createTime":1676558121340,"owner":"大同市卫生健康委员会","type":"CSV","description":"大同市第四人民医院2022年公开招聘工作人员调整岗位计划表.xls","schema":"{\"招聘单位\":\"string\",\"招聘岗位\":\"string\",\"岗位代码\":\"string\",\"年龄\":\"string\",\"学历\":\"string\",\"学位\":\"string\",\"专业\":\"string\",\"其它\":\"string\",\"原计划招聘人数\":\"string\",\"岗位变更情况\":\"string\",\"调整后招聘人数\":\"string\",\"备注\":\"string\"}","doId":"shanxi/Repository/ca7bb2d5-3e8b-4f90-a698-0c10afe41574"});
            data.push({"createTime":1676558261544,"owner":"大同市人力资源和社会保障局","type":"CSV","description":"市直2020度创业培训补贴20%资金统计表","schema":"{\"培训单位，联系人、电话、地点\":\"string\",\"期数\":\"string\",\"培训时间\":\"string\",\"培训人数\":\"string\",\"合格人数\":\"string\",\"合计人数\":\"string\",\"创业人数\":\"string\",\"补贴人数\":\"string\",\"培训补贴资金（元）\":\"string\"}","doId":"shanxi/Repository/21e4e085-aa88-40aa-b38e-6f1a00042141"});
            data.push({"createTime":1676558289718,"owner":"大同市人力资源和社会保障局","type":"CSV","description":"市直2020度创业培训补贴20%资金统计表","schema":"{\"培训单位，联系人、电话、地点\":\"string\",\"期数\":\"string\",\"培训时间\":\"string\",\"培训人数\":\"string\",\"合格人数\":\"string\",\"合计人数\":\"string\",\"创业人数\":\"string\",\"补贴人数\":\"string\",\"培训补贴资金（元）\":\"string\"}","doId":"shanxi/Repository/e8e5eefc-e481-4e47-8222-7eb9b7c824ae"});
            data.push({"createTime":1676558304736,"owner":"大同市人力资源和社会保障局","type":"CSV","description":"全民技能提升工程部分培训补贴资金统计表","schema":"{\"培训地点\":\"string\",\"期数\":\"string\",\"培训专业\":\"string\",\"培训时间\":\"string\",\"培训人数\":\"string\",\"合格人数\":\"string\",\"补贴人数\":\"string\",\"合计人数\":\"string\",\"补贴天数\":\"string\",\"培训补贴资金（元）\":\"string\",\"合计补贴资金（元）\":\"string\"}","doId":"shanxi/Repository/1d003549-ab2e-4cfb-8810-4a6b03518581"});
            data.push({"createTime":1676558329896,"owner":"大同市人力资源和社会保障局","type":"CSV","description":"就业创业补贴项目清单","schema":"{\"项目\":\"string\",\"名称\":\"string\",\"享受对象\":\"string\",\"申请资料\":\"string\",\"执行标准\":\"string\",\"享受期限\":\"string\",\"政策依据\":\"string\",\"受理机构\":\"string\",\"备注\":\"string\"}","doId":"shanxi/Repository/869482df-8d5d-49fc-8559-ce14206c991d"});
            data.push({"createTime":1676558352841,"owner":"大同市人力资源和社会保障局","type":"CSV","description":"惠民惠农“一卡通”政策清单公示","schema":"{\"序号\":\"string\",\"主管部门\":\"string\",\"补贴项目\":\"string\",\"政策级次\":\"string\",\"政策依据文件及文号\":\"string\",\"补贴对象\":\"string\",\"补助标准\":\"string\",\"申领流程\":\"string\",\"发放方式\":\"string\",\"发放时间\":\"string\",\"咨询电话\":\"string\",\"备注\":\"string\"}","doId":"shanxi/Repository/2949b9c7-b22b-46e5-8663-6d232471587e"});
            data.push({"createTime":1676558365787,"owner":"大同市科学技术局","type":"CSV","description":"2020年大同市重点实验室认定名单公示","schema":"{\"序号\":\"string\",\"项目名称\":\"string\",\"依托单位\":\"string\"}","doId":"shanxi/Repository/b35b17c9-acf3-4511-bc3d-5561cb861cb6"});
            data.push({"createTime":1676558388183,"owner":"大同市教育局","type":"CSV","description":"2022年大同市特岗教师招聘进入体检人员名单","schema":"{\"序号\":\"string\",\"地市\":\"string\",\"区县\":\"string\",\"学校\":\"string\",\"学段\":\"string\",\"学科\":\"string\",\"岗位数\":\"string\",\"笔试分数\":\"string\",\"姓名\":\"string\",\"性别\":\"string\",\"准考证号码\":\"string\",\"面试成绩\":\"string\",\"总成绩\":\"string\",\"是否进入体检\":\"string\"}","doId":"shanxi/Repository/41e32dd3-b231-4456-a814-186307d8157b"});
            ret.result.data = data;
            ret.result.total = data.length;
            return ret;
        }

        return "success";
    }
    export function getDoList3(arg) {
        arg = convertArgToJson(arg);
        //if (arg.doId == null)
        //  return {
        //    "msg":"missing arguments doId", "code":1, params: arg
        //  };
        //if (arg.count>1000)
        //  return {
        //    "msg":"request to much!", "code":1
        //  };
        var ret = [];
        if (arg.count == undefined) arg.count = 10;
        if (arg.offset == undefined) arg.offset = 0;
        for (var i = arg.offset; i < arg.offset / 1.0 + arg.count / 1.0; i ++) {
            var fakeDo = {
            };
            fakeDo.doId = "bdware.ss/Repo1/abc" + i;
            fakeDo.originalData = {
                doid : fakeDo.doId, info : "ddddd", tag : ["aaa", "bbb", "ccc"]
            }
                    fakeDo.enableIndex = true
                    ret.push(fakeDo);
        }
        return {
            data : ret, total : 100
        };
    }
//TODO check arguments
    export function getRepoTopology(arg) {
        return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopologyByDoId(arg, 2);
    }
//指标1 获取某个repo的DO数量。
//使用search.yjs里的getDoCount
//指标2 获取某个repo的操作次数。使用search.yjs中的
//countRecordByDate
//参数格式为：
//{"repoId":"xxx.xxx/xxx","startTime":1641454745128, "endTime":1641454746128,"interval":5000, "eventPrefix":["abc"]}"
//比如，查询总搜索次数，参数格式为：eventPrefix:["doip_search"]
//查询调用统计，参数格式为eventPrefix:[""]，然后interval/startTime/fromTime传对了就行。
//索引统计，暂时还没有。
    export function getStaticIndex(arg) {
        arg = convertArgToJson(arg);
        if (arg.from == undefined)
            return {
                "msg" : "missing arguments: from", "code" : 1
            };
        if (arg.to == undefined)
            return {
                "msg" : "missing arguments: to", "code" : 1
            };
        if (arg.interval == undefined)
            return {
                "msg" : "missing arguments: interval", "code" : 1
            };
        switch(arg.tag) {
        case "search" :
        case "index" :
        case "call" : return fakeList(from, to, interval);
        }
        return {
            "msg" : "unreconized tag", "code" : 1
        };
    }
    function fakeList(from, to, interval) {
        var ret = [];
        for (i = from; i < to; i ++) {
            ret.push(Math.floor(Math.random() * 200 + 20));
        }
        return ret;
    }
}
