module unions {
    @Descripton("无参数")
    export function getUnionMembers(arg) {
        if (!checkPermission(requester)) {
            YancloudUtil.exceptionReturn({
            "msg":"no permission", "code":1
            });
        }
        var ret = {
        };
        ret.code = 0;
        if (Global.unions==undefined){
            ret.data = [];
        } else {
            ret.data = Global.unions;
        }
        return ret;
    }
    export function resetUnionConfig() {
        Global.unions = null;
    }

    @Descripton("参数为，{\"date\": 1642467459759,\"name\": \"Repo1\",\"doId\": \"bdwaretest.loccall/Repo1\",\"version\": \"2.1\"，\"address\": \"tcp://127.0.0.1:21042\",\"status\": \"已审核\",\"protocol\": \"DOIP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
    @ArgSchema({
    "!unionName": "string", "!orgName":"string", "!email": "string", "!contact":"string"
    })
    export function createUnion(arg) {
        if (!checkPermission(requester)) {
            YancloudUtil.exceptionReturn({
            "msg":"no permission", "code":1
            });
        }
        Global.unions = [];
        Global.unions.push({
        "name":"太原节点", "address":"ws://39.106.6.6:18010", "status":"在线", "contact":"太原管理员", "email":"taiyuanadim@shanxi.com"
        });
        Global.unions.push({
        "name":"大同节点", "address":"ws://39.106.6.9:18010", "status":"在线", "contact":"大同管理员", "email":"datongadmin@shanxi.com"
        });
        return {
        "code":0
        };
    }
    export function getUnionConfig() {
        if (!checkPermission(requester)) {
            YancloudUtil.exceptionReturn({
            "msg":"no permission", "code":1
            });
        }
        var ret = {
        };
        ret.controlAddress = "ws://192.168.1.1:18000";
        ret.apiKey = "dafdsafdsa";
        ret.unionName = "山西能源联盟";
        return ret;
    }
    @ArgSchema({
    "!controlAddress": "string", "!apiKey": "string"
    })
    export function joinUnion(arg) {
        if (!checkPermission(requester)) {
            YancloudUtil.exceptionReturn({
            "msg":"no permission", "code":1
            });
        }
        var ret = {
        };
        ret.controlAddress = "ws://192.168.1.1:18000";
        ret.apiKey = "dafdsafdsa";
        ret.unionName = "高校联盟";
        return ret;
    }
}