import { getUserId } from '@/services/bus/account';
import { commonSearch_go } from '@/services/go';
import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
import {getUserAccountType} from "@/services/bus/user";

/** ================================= 业务 - 计划 ================================**/

/**
 * 查询套保计划 /Ermcp3/QueryHedgePlan
 * @param hedgeplanstatus 套保计划状态(允许多个，逗号隔开) - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
 * @constructor
 */
export function QueryHedgePlan(hedgeplanstatus: string): Promise<Ermcp3HedgePlan[]> {
    const param = {
        userid: getUserId(),
        hedgeplanstatus: hedgeplanstatus,
        usertype: getUserAccountType()
    }
    return commonSearch_go('/Ermcp3/QueryHedgePlan', param).catch((err) => {
        throw new Error(`查询套保计划: ${err}`);
    });
}
