import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PrintTemplateListVO, PrintTemplateListForm, PrintTemplateListQuery } from '@/api/system/printTemplateList/types';

/**
 * 查询打印模板列表列表
 * @param query
 * @returns {*}
 */

export const listPrintTemplateList = (query?: PrintTemplateListQuery): AxiosPromise<PrintTemplateListVO[]> => {
  return request({
    url: '/system/printTemplateList/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询打印模板列表详细
 * @param templateListId
 */
export const getPrintTemplateList = (templateListId: string | number): AxiosPromise<PrintTemplateListVO> => {
  return request({
    url: '/system/printTemplateList/' + templateListId,
    method: 'get'
  });
};

/**
 * 新增打印模板列表
 * @param data
 */
export const addPrintTemplateList = (data: PrintTemplateListForm) => {
  return request({
    url: '/system/printTemplateList',
    method: 'post',
    data: data
  });
};

/**
 * 修改打印模板列表
 * @param data
 */
export const updatePrintTemplateList = (data: PrintTemplateListForm) => {
  return request({
    url: '/system/printTemplateList',
    method: 'put',
    data: data
  });
};

/**
 * 删除打印模板列表
 * @param templateListId
 */
export const delPrintTemplateList = (templateListId: string | number | Array<string | number>) => {
  return request({
    url: '/system/printTemplateList/' + templateListId,
    method: 'delete'
  });
};


/**
 * 下拉框查询打印模板列表列表
 * @param query
 * @returns {*}
 */
export function getSysPrintTemplateListList (query) {
    return request({
        url: '/system/printTemplateList/getSysPrintTemplateListList',
        method: 'get',
        params: query
    });
};
