import { request } from '@/utils/request';

export async function fetchGetUserConfig(_: API.Empty, options?: { [key: string]: any }) {
    return request<API.Result<API.UserInfo>>('/app/getUserConfig', {
        method: 'POST',
        ...(options || {}),
    });
}

export async function fetchPlanList(_: API.Empty, options?: { [key: string]: any }) {
    return request<API.Result<API.PlanList>>('/user/owChannelPlanList', {
        method: 'POST',
        ...(options || {}),
        requireToken: false,
    });
}

export async function fetchPayTypeList(_: API.Empty, options?: { [key: string]: any }) {
    return request<API.Result<API.PayTypeListResp>>('/pay/payTypeList', {
        method: 'POST',
        ...(options || {}),
        requireToken: false,
    });
}

export async function fetchPayOrderCreate(body: API.PayOrderReq, options?: { [key: string]: any }) {
    return request<API.Result<API.PayOrderResp>>('/pay/userPay', {
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}

export async function fetchPayOrderStatus(
    body: API.PayOrderStatusReq,
    options?: { [key: string]: any }
) {
    return request<API.Result<API.PayOrderStatusResp>>('/pay/queryState', {
        method: 'POST',
        data: body,
        ...(options || {}),
    });
}
