import { ApiCall } from "tsrpc";
import { WangZheRongYaofun } from "../../public/wzry";
import { ReqZuanShiOpen, ResZuanShiOpen } from "../../shared/protocols/wzry/PtlZuanShiOpen";

export default async function (call: ApiCall<ReqZuanShiOpen, ResZuanShiOpen>) {
    let status = await WangZheRongYaofun.getWangZheStatus()
    if (status.status < 5) {
        // 未到报名时间
        return call.error('', { code: -1, message: globalThis.lng.wzry_5 })
    }
    let _myFight = await WangZheRongYaofun.getMyFight(call)
    if (!_myFight) {
        return call.error('', { code: -4, message: globalThis.lng.wzry_16 })
    }

    let _mygroup = _myFight?.groupinfo?.groupid || 0

    call.succ({ mygroup: _mygroup });
}