import { get, post } from '../http'
import { BasicService } from './basic'

export const order_type_coin = 2
export const order_type_sp_coin = 3
export const order_type_sp_learn_money = 6
class OrderService extends BasicService {
  /**
   * 创建机构充值订单
   */
  async createCoinTopUpOrder(params: { money: any; schoolId: any }) {
    return await post<any>('/orderManagement/createSchoolCoinOrder', {
      ...params,
      orderType: order_type_coin,
    })
  }

  /**
   * 创建服务商充值订单
   */
  async createSpCoinTopUpOrder(params: { money: any; providerId: any }) {
    return await post<any>('/orderManagement/createProviderCoinOrder', {
      ...params,
      orderType: order_type_sp_coin,
    })
  }

  /**
   * 创建乐学金充值订单
   */
  async createSpLearnMoneyTopUpOrder(params: {
    money: any
    type: any
    typeId: any
  }) {
    return await post<any>('/orderManagement/createLearnAmountOrder', {
      ...params,
      orderType: order_type_sp_learn_money,
    })
  }

  async getOrder(id: any) {
    return await get<any>(`/orderManagement/${id}`)
  }

  protected findPageUrl(): string {
    return '/orderManagement/list'
  }

  protected removeUrl(): string {
    throw new Error('Method not implemented.')
  }

  protected saveOrUpdateUrl(): string {
    return ''
  }
}

export const orderService = new OrderService()
