import axiosInstance from '../../utils/axios';

// 导入导出 API
export const userImportApi = {
  // 导出用户
  exportUser: (params: any): Promise<Blob> => {
    return axiosInstance.get('/system/user/export', {
      params,
      responseType: 'blob',
    });
  },

  // 下载用户导入模板
  importUserTemplate: (): Promise<Blob> => {
    return axiosInstance.get('/system/user/get-import-template', {
      responseType: 'blob',
    });
  },

  // 导入用户
  importUser: (file: File, updateSupport: number): Promise<any> => {
    const formData = new FormData();
    formData.append('file', file);
    formData.append('updateSupport', updateSupport.toString());
    return axiosInstance.post('/system/user/import', formData, {
      headers: {
        'Content-Type': 'multipart/form-data',
      },
    });
  },
};

