package org.springblade.common.upyzt.model;

import org.springblade.common.upyzt.exception.UpyztException;
import org.springblade.common.upyzt.net.APIResource;
import org.springblade.common.upyzt.resp.WithdrawableDepositResp;
import java.util.Map;
import lombok.experimental.Accessors;

/**
 * 可提现充值订单表
 */
@Accessors(chain = true)
public class WithdrawableDeposit extends APIResource {

    /**
     * 可提现充值
     *
     * @param params 参数
     * @return 返回结果
     * @throws UpyztException 异常
     */
    public static WithdrawableDepositResp create(Map<String, Object> params) throws UpyztException {
        return APIResource
            .request(RequestMethod.POST,
                classURL(WithdrawableDeposit.class), params,
                WithdrawableDepositResp.class, null);
    }

    /**
     * 可提现充值订单查询（系统订单号）
     *
     * @param withdrawableDepositId 提现充值id
     * @return 返回结果
     * @throws UpyztException 异常
     */
    public static WithdrawableDepositResp retrieveById(String withdrawableDepositId) throws UpyztException {
        return APIResource
            .request(RequestMethod.GET,
                instanceURL(WithdrawableDeposit.class, withdrawableDepositId), null,
                WithdrawableDepositResp.class, null);
    }

    /**
     * 可提现充值订单查询（平台订单号）
     *
     * @param outOrderNo 平台订单号
     * @return 返回结果
     * @throws UpyztException 异常
     */
    public static WithdrawableDepositResp retrieveByOutOrderNo(String outOrderNo) throws UpyztException {
        return APIResource
            .request(APIResource.RequestMethod.GET,
                instanceURL(WithdrawableDeposit.class, "_by_out_order_no", outOrderNo), null,
                WithdrawableDepositResp.class, null);
    }
}
