// @ts-ignore
/* eslint-disable */
import {request} from 'umi';


export async function enroll(courseId: number, phone: string, captcha: string) {
  return request<API.Response<string>>('/api/v1/enroll/enroll', {
    method: 'POST',
    data: {courseId, phone, captcha},
    skipErrorHandler: true
  },);
}


export async function getEnrollInfo(token: string) {
  return request<API.Response<API.Enroll>>('/api/v1/enroll/getInfo', {
    method: 'POST',
    data: {token},
  },);
}

export async function sendCaptcha(phone: string) {
  return request<API.Response<any>>('/api/v1/enroll/sendCaptcha', {
    method: 'POST',
    data: {phone}
  });
}

export async function submit(param: API.SubmitEnrollParam) {
  return request<API.Response<any>>('/api/v1/enroll/submit', {
    method: 'POST',
    data: param,
    requestType: 'json',
  });
}

export async function sign(token: string, idCard: string) {
  return request<API.Response<any>>('/api/v1/enroll/sign', {
    method: 'POST',
    data: {token, idCard}
  });
}

export async function pay(token: string, payInfo: string,
                          taxNumber: string, taxInstitutionName: string, taxInstitutionAddress: string,
                          taxBank: string, taxBankAccount: string, taxPhone: string
) {
  return request<API.Response<any>>('/api/v1/enroll/pay', {
    method: 'POST',
    data: {token, payInfo, taxNumber, taxInstitutionName, taxInstitutionAddress, taxBank, taxBankAccount, taxPhone}
  });
}


