import { cdcmRequestClient } from '#/api/request';
import { useTokenStore } from '#/store';

const token = useTokenStore().token;

export namespace TemplateApi {
  /** 分页查询模板请求体 */
  export interface TemplateQueryPageRequest {
    page_num: number;
    page_size: number;
    template_type?: string;
  }
}

/**
 * 查询所有模板
 */
export async function TemplateQueryPage(
  data: TemplateApi.TemplateQueryPageRequest,
) {
  return cdcmRequestClient.post('/template', data, {
    responseReturn: 'data',
    headers: {
      cdcm: token,
      action: 52_011,
    },
  });
}
