import { http } from '../http'

interface GetWordParams {
  spell?: string
  id?: any
  wordId?: string
  [key: string]: any
}

interface OperateTagData {
  id: any
  meaningId?: string
  levelId?: string
  knowFlag?: number | null
  strangeFlag?: number
  wordId?: string
}

// 获取单词详情
const getWord = (params: GetWordParams) =>
  http.request({
    url: '/word/get',
    params,
  })

const operateTag = (data: OperateTagData) =>
  http.request({
    url: '/word/operate',
    method: 'POST',
    data,
  })

const wordDetailApi = {
  getWord,
  operateTag,
}

export default wordDetailApi
export type { GetWordParams, OperateTagData }
