/*
 * @Author: your name
 * @Date: 2021-06-24 23:22:18
 * @LastEditTime: 2021-06-25 00:00:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \Mina_B_T\miniprogram\service\hwRequirement.ts
 */
import api from "../api/api";
import { $request } from "../utils/request";

/**
 * 获取需求列表
 * @param data 
 */
export const getRequirementsApi = (data: getRequirementsData): Promise<responseOptions> => {
  const options: requestOptionsType<any> = {
    url: api.hwRequirement.getRequirements,
    data
  }
  return $request(options)
}

/**
 * 报名需求
 * @param data 
 */
export const enrollmentRequireApi = (data: enrollmentRequireDataType): Promise<responseOptions> => {
  const options: requestOptionsType<any> = {
    url: api.hwRequirement.enrollmentRequire,
    data
  }
  return $request(options)
}

/**
 * 取消报名
 * @param data 
 */
export const cancelEnrollmentApi = (data: cancelEnrollmentDataType): Promise<responseOptions> => {
  const options: requestOptionsType<any> = {
    url: api.hwRequirement.cancelEnrollment,
    data,
    type: 'post'
  }
  return $request(options)
}

/**
 * 获取需求详情
 * @param data 
 */
export const getRequirementDetailApi = (data: getRequirementDetailDataType): Promise<responseOptions> => {
  const options: requestOptionsType<any> = {
    url: api.hwRequirement.getRequirementDetail,
    data,
  }
  return $request(options)
}