//api公共请求地址
import { request } from '@umijs/max';
import { RespResult } from './Resp';
/**
 *
 * @param url 接口地址
 * @returns 诚管24
 * @description 首页-城市实况-城市问题
 */
const IS_PROD = process.env.NODE_ENV === 'production' ? true : false;
export const reqBaseUrl = IS_PROD
  ? '/cd-comprehensive/apis/city-comprehensive-coordination'
  : '/apis/city-comprehensive-coordination';

const urlProxyApis = (url: string) => {
  return `${reqBaseUrl}${url}`;
};

// 城市问题数量统计
export async function getCityProblemStatistics() {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/getLargeScreenData'),
    {
      method: 'get',
    },
  );
}

/**
 *
 * @description 事件汇总顶部筛选
 */
export async function getComprehensiveDiscoveryStatistics(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/homePage/comprehensiveDiscoveryStatistics'),
    {
      method: 'get',
      params,
    },
  );
}

/**
 *
 * @description 事件汇总左侧顶部统计
 */
export async function getContentStatisticsApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/comprehensiveDiscovery/getContentStatistics'),
    {
      method: 'post',
      params,
    },
  );
}

/**
 *
 * @description 事件汇总高发类别统计
 */
export async function getCategoryAnalysisApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/comprehensiveDiscovery/getCategoryAnalysis'),
    {
      method: 'post',
      params,
    },
  );
}

/**
 *
 * @description 事件汇总高发区域统计
 */
export async function getAreaAnalysisApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/comprehensiveDiscovery/getAreaAnalysis'),
    {
      method: 'post',
      params,
    },
  );
}

/**
 *
 * @description 事件汇总高发区域统计
 */
export async function getCaseSourceTypeList() {
  return request<RespResult<any>>(
    urlProxyApis('/config-case-source-type/list'),
    {
      method: 'post',
    },
  );
}


/**
 *
 * @description 全部状态
 */
export async function getCaseStatusListApi() {
  return request<RespResult<any>>(
    urlProxyApis('/comprehensiveDiscovery/getCaseStatusList'),
    {
      method: 'get',
    },
  );
}

/**
 *
 * @description 事件类型
 */
export async function getEventTypeListApi() {
  return request<RespResult<any>>(
    urlProxyApis('/comprehensiveDiscovery/getEventTypeList'),
    {
      method: 'get',
    },
  );
}

/**
 *
 * @description 事件列表
 */
export async function getZzEventListApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/zongzhi/getZzEventList'),
    {
      method: 'post',
      params
    },
  );
}

/**
 *
 * @description 类别分析top
 */
export async function getCategoryTopAnalysisApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/getCategoryTopAnalysis'),
    {
      method: 'post',
      params
    },
  );
}

/**
 *
 * @description 类别分析top
 */
export async function getAreaDistribAnalysisApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/getAreaDistribAnalysis'),
    {
      method: 'post',
      params
    },
  );
}

/**
 *
 * @description 重要事件统计
 */
export async function getImportEventStatisticsApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/importEventStatistics'),
    {
      method: 'get',
      params
    },
  );
}

/**
 *
 * @description 待处置统计
 */
export async function getSourceStatisticsApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/getSourceStatistics'),
    {
      method: 'post',
      params
    },
  );
}

/**
 *
 * @description 统计整体结案率分析
 */
export async function getAllCloseCaseStatisticsApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/getAllCloseCaseStatistics'),
    {
      method: 'post',
      params
    },
  );
}

/**
 *
 * @description 时限统计
 */
export async function getTimeLimitsApi(params: any) {
  return request<RespResult<any>>(
    urlProxyApis('/cityScreen/getTimeLimits'),
    {
      method: 'get',
      params
    },
  );
}

//获取最新事件
export async function getUpToDateEvent(
  params: {
    page: number;
    count: number;
    protrudeFlag?: string;//1待确认 2 已确认推送 3 不推送
  },
): Promise<PhysicalsignApi.Result<any>> {
  return request(urlProxyApis(`/comprehensiveDiscovery/getUpToDateEvent`), {
    method: 'POST',
    params,
  });
}