import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { KeywordVO, KeywordForm, KeywordQuery } from '@/api/setting/keyword/types';

/**
 * 查询文件夹关键词设置列表
 * @param query
 * @returns {*}
 */

export const listKeyword = (query?: KeywordQuery): AxiosPromise<KeywordVO[]> => {
  return request({
    url: '/setting/keyword/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询文件夹关键词设置详细
 * @param id
 */
export const getKeyword = (id: string | number): AxiosPromise<KeywordVO> => {
  return request({
    url: '/setting/keyword/' + id,
    method: 'get'
  });
};

/**
 * 新增文件夹关键词设置
 * @param data
 */
export const addKeyword = (data: KeywordForm) => {
  return request({
    url: '/setting/keyword',
    method: 'post',
    data: data
  });
};

/**
 * 修改文件夹关键词设置
 * @param data
 */
export const updateKeyword = (data: KeywordForm) => {
  return request({
    url: '/setting/keyword',
    method: 'put',
    data: data
  });
};

/**
 * 删除文件夹关键词设置
 * @param id
 */
export const delKeyword = (id: string | number | Array<string | number>) => {
  return request({
    url: '/setting/keyword/' + id,
    method: 'delete'
  });
};
