import { defHttp } from '/@/utils/http/axios';
import { EventVo, pageParams, Events } from '/@/api/burialPoint/event/model/eventModel';

enum Api {
  QueryPage = '/event/queryPage',
  QueryOne = '/event/queryOne',
  Create = '/event/create',
  Update = '/event/update',
  Update2 = '/event/update2',
  Delete = '/event/delete',
}

/**
 * 分页查询
 */
export function queryPage(params: pageParams) {
  return defHttp.get<EventVo>({
    url: Api.QueryPage,
    params,
  });
}

/**
 * 通过主键查询单条数据
 */
export function queryEventOne(params: string) {
  return defHttp.get<Events>({
    url: Api.QueryOne + '?id=' + params,
  });
}

/**
 * 新增数据
 */
export function eventCreate(params: Events) {
  return defHttp.post<Events>({
    url: Api.Create,
    params,
  });
}

/**
 * 修改数据
 */
export function eventUpdate(params: Events) {
  return defHttp.post<Events>({
    url: Api.Update2,
    params,
  });
}

/**
 * 删除数据
 */
export function eventDelete(params: string) {
  return defHttp.post<boolean>({
    url: Api.Delete + '?id=' + params,
  });
}
