import request from '@/utils/request';
import type { ApiResponse, PageData } from '../types';
import type { StaffDistributionData, StaffDetailItem, StaffQueryParams } from './types';

// 获取在职人员分布数据
export const getStaffDistribution = (params?: StaffQueryParams) => {
  return request<ApiResponse<StaffDistributionData>>({
    url: '/system/dashboard/staff-distribution',
    method: 'get',
    params
  });
};

// 获取人员详细列表
export const getStaffDetailList = (params?: StaffQueryParams & { pageNum?: number; pageSize?: number }) => {
  return request<ApiResponse<PageData<StaffDetailItem>>>({
    url: '/system/dashboard/staff-distribution/details',
    method: 'get',
    params
  });
};

// 更新人员状态
export const updateStaffStatus = (staffId: string, status: string) => {
  return request<ApiResponse<boolean>>({
    url: `/system/dashboard/staff-distribution/status/${staffId}`,
    method: 'put',
    data: { status }
  });
};

// 获取人员详细列表
export const findManagecom = () => {
  return request<ApiResponse<Array<{label:string;value:string}>>>({
    url: '/system/dashboard/staff-distribution/details',
    method: 'get'
  });
};