import { request } from '@umijs/max';

// 行业
export async function getIndustryTrend(params?: API.Analysis.IndustryParams) {
  return request<API.Analysis.IndustryResult>('/api/cms/statics/industry', {
    method: 'GET',
    params,
  });
}

// 区域热力图
export async function getIndustryAreaTrend(params: any) {
  try {
    const response = await request('/api/cms/statics/industryArea', {
      method: 'GET',
      params,
      headers: {
        'Content-Type': 'application/json',
      },
    });

    console.log('接口原始响应:', response); // 调试日志
    return response; // 兼容不同后端响应格式
  } catch (error) {
    console.error('接口请求异常:', error);
    throw error;
  }
}

// 薪资
export async function getSalaryTrend(params?: API.Analysis.IndustryParams) {
  return request<API.Analysis.IndustryResult>('/api/cms/statics/salary', {
    method: 'GET',
    params,
  });
}

// 工作年限
export async function getWorkYearTrend(params?: API.Analysis.IndustryParams) {
  return request<API.Analysis.IndustryResult>('/api/cms/statics/workYear', {
    method: 'GET',
    params,
  });
}

// 学历趋势
export async function getEducationTrend(params?: API.Analysis.IndustryParams) {
  return request<API.Analysis.IndustryResult>('/api/cms/statics/education', {
    method: 'GET',
    params,
  });
}
