import { ApiCall } from "tsrpc";
import { EquipFun } from '../../public/equip';
import { ReqTakeOff, ResTakeOff } from "../../shared/protocols/equip/PtlTakeOff";
import { ServiceType } from '../../shared/protocols/serviceProto';
import kfjsFun from "../../public/kaifujingsai";

export default async function (call: ApiCall<ReqTakeOff, ResTakeOff, ServiceType>) {
    let equip = await EquipFun.getEquip(call, call.req.equipId);

    if (!equip) return call.error(globalThis.lng.equip_1);
    if (!equip.wearaId) return call.error(globalThis.lng.equip_9);

    await EquipFun.changeEquipAttr(call, equip, { wearaId: '' });

    call.succ({});

    kfjsFun.setEquipLvCount(call)

}