import { http } from '@/utils/http/axios';
import type { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';

import type {
  InnerPersonTableQuery,
  InnerPersonTableData,
} from '@/views/security-confidentiality/person-management/inner-person/types';

export const getDeptNameList = () => {
  return http.request<Array<string>>({
    url: '/personnelManagement/queryEmployeeAccessDeptList',
    method: 'post',
  });
};

export const getInnerPersonRecordList = (params: QueryPageRequest<InnerPersonTableQuery>) => {
  return http.request<QueryPageResponse<InnerPersonTableData>>({
    url: '/personnelManagement/queryEmployeeAccessRecordPage',
    method: 'post',
    params,
  });
};

export const exportInnerPersonRecordList = (data: InnerPersonTableQuery) => {
  return http.request(
    {
      url: '/personnelManagement/exportEmployeeAccessRecordList',
      method: 'post',
      data,
      responseType: 'blob',
    },
    {
      isTransformResponse: false,
    },
  );
};
