import baseAxios from '../index'
import { eLoanMode } from '@/views/withMenu/Loan/types'
import { iLoanProdcutItem,eProductStatus } from "./type"

const prefix = '/loan/query'

export function queryLoanProductList(data: {
  limit: number,
  loan_type:eLoanMode,
  product_status:eProductStatus,
  offset: number
}) {
  return baseAxios<{
    count: number,
    uuid: string[],
    total: number
  }>({
    url: prefix+'/list',
    method: 'POST',
    data
  })
}

export function queryLoanProductInfo(data: { uuid: string }) {
  return baseAxios<iLoanProdcutItem>({
    url: prefix+'/info',
    method: 'GET',
    params: data
  })
}

export function queryBankList() {
  return baseAxios<{
    item:{
      code:number,
      name:string
    }[]
  }>({
    url: '/query/banks',
    method: 'GET',
  })
}

export function queryDirectLoanReq(data: {
  date: number
  bank_code: number
  rate:number
  min_amount:number
  max_amount:number
  loan_type: number
  product_status:number
  guarantee_type:number
}) {
  return baseAxios<{
    count: number
    items: iLoanProdcutItem[]
    total: number
  }>({
    url: prefix+'/direct/list',
    method: 'POST',
    data,
  })
}

export function queryLimit() {
  return baseAxios<{
    en_max_amount:string,
    en_rate_lower:string,
    max_amount:string,
  }>({
    url: prefix+'/max_limit',
    method: 'GET',
  })
}



