import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HandoverTemplateVO, HandoverTemplateForm, HandoverTemplateQuery } from '@/api/residential/handoverTemplate/types';

/**
 * 查询交接班模板列表
 * @param query
 * @returns {*}
 */

export const listHandoverTemplate = (query?: HandoverTemplateQuery): AxiosPromise<HandoverTemplateVO[]> => {
  return request({
    url: '/residential/handoverTemplate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询交接班模板详细
 * @param id
 */
export const getHandoverTemplate = (id: string | number): AxiosPromise<HandoverTemplateVO> => {
  return request({
    url: '/residential/handoverTemplate/' + id,
    method: 'get'
  });
};

/**
 * 新增交接班模板
 * @param data
 */
export const addHandoverTemplate = (data: HandoverTemplateForm) => {
  return request({
    url: '/residential/handoverTemplate',
    method: 'post',
    data: data
  });
};

/**
 * 修改交接班模板
 * @param data
 */
export const updateHandoverTemplate = (data: HandoverTemplateForm) => {
  return request({
    url: '/residential/handoverTemplate',
    method: 'put',
    data: data
  });
};

/**
 * 删除交接班模板
 * @param id
 */
export const delHandoverTemplate = (id: string | number | Array<string | number>) => {
  return request({
    url: '/residential/handoverTemplate/' + id,
    method: 'delete'
  });
};
