import { IQueryCommon, IRes, IResult, serialize } from '@/api/common'
import axios from '@/utils/request'
import { base, IRainfall } from './common'

const uris = {
  base: `${base}/rainfall`,
  page: `${base}/rainfall/page`,
  del: `${base}/rainfall/deleteByIds`,
  import: `${base}/rainfall/batchData`
}

export const rainFallPage = (params: Partial<IRainfall & IQueryCommon>) =>
  axios.request<IRes<IRainfall[]>>({ url: uris.page, method: 'get', params })

export const importRainfall = (data: { file: File }) =>
  axios.request<IRes<boolean>>({ url: uris.import, method: 'post', data: serialize(data) })
