import { request } from '../request'

/**
 * 获取模板列表
 */
export function fetchTemplateList(data?: Api.Template.TemplateSearchParams) {
  return request<App.Service.Response<Api.Common.PaginatingQueryRecord<Api.Template.CommonRecord>>>({
    url: '/Base/ActivityMain/GetTemplete_Pag',
    method: 'get',
    params: data || {},
  })
}

/**
 * 新增模板
 */
export function fetchAddTemplate(data?: Api.Template.AddTemplateParams) {
  return request<App.Service.Response<Api.Common.PaginatingQueryRecord<Api.Template.CommonRecord>>>({
    url: '/Base/ActivityMain/AddOrUpdateTemplete_Pag',
    method: 'post',
    data: data || {},
  })
}

/**
 * 获取模板详情
 */
export function fetchTemplateDetail(id: number) {
  return request<App.Service.Response<Api.Common.PaginatingQueryRecord<Api.Template.CommonRecord>>>({
    url: `/Base/ActivityMain/GetTemplete_PagByID?id=${id}`,
    method: 'get',
  })
}

/**
 * 删除模板
 */
export function fetchDeleteTemplate(id: number) {
  return request<App.Service.Response<Api.Common.PaginatingQueryRecord<Api.Template.CommonRecord>>>({
    url: `/Base/ActivityMain/DeleteTemplete_Pag?id=${id}`,
    method: 'post',
  })
}
