// import { OptionsDto } from '@/components/TabSwitch';
import { request } from '@umijs/max';

/**
 *
 * @param url 接口地址
 * @returns 首页体征physicalsignindex
 */
const IS_PROD = process.env.NODE_ENV === 'production' ? true : false;
export const reqBaseUrl = IS_PROD
  ? '/apis/physicalsignindex'
  : '/apis/physicalsignindex';
const urlProxyApis = (url: string) => {
  return `${reqBaseUrl}${url}`;
};

//体征首页
export async function queryTzzsPhysicalSign(
  data: PhysicalsignApi.QueryTzzsPhysicalSignIndexInstanceDataParams,
): Promise<
  PhysicalsignApi.Result<PhysicalsignApi.QueryTzzsPhysicalSignIndexInstanceDataList>
> {
  return request(
    urlProxyApis(`/physicalsignindexinstance/queryIndexInstanceHomepageData`),
    {
      params: data,
    },
  );
}
//获取体征体系
export async function getPhysicalSignSystem(): Promise<
  PhysicalsignApi.Result<PhysicalsignApi.SignWeightSystem>
> {
  return request(urlProxyApis(`/physicalSignModel/getPhysicalSignSystem`));
}
//获取体征权重
export async function getWeightSystem(): Promise<
  PhysicalsignApi.Result<PhysicalsignApi.SignWeightSystem>
> {
  return request(urlProxyApis(`/physicalSignModel/getWeightSystem`));
}

//宏观体征首页数据
export async function getMacroscopicPhysicalSign(
  data: PhysicalsignApi.MacroscopicPhysicalSignParams,
): Promise<PhysicalsignApi.Result<PhysicalsignApi.SignIndexTabs>> {
  return request(urlProxyApis(`/macroscopicPhysicalSign/getIndexInstance`), {
    params: data,
  });
}

//中观体征底部指数
export async function getPhysicalSignIndexTabs(): Promise<
  PhysicalsignApi.Result<PhysicalsignApi.SignIndexTabs>
> {
  return request(urlProxyApis(`/middlePhysicalSign/getPhysicalSignIndexTabs`));
}

//影响体征Top5
export async function getlistTopNItems(
  data: any,
): Promise<PhysicalsignApi.Result<PhysicalsignApi.ListTopNItems>> {
  return request(
    urlProxyApis(`/physicalsignindexquestioninstance/listTopNItems`),
    {
      params: data,
    },
  );
}

//中观体征地图边界
export async function getObjectPolygon(): Promise<
  PhysicalsignApi.Result<PhysicalsignApi.ListTopNItems>
> {
  return request(
    urlProxyApis(`/middlePhysicalSign/getObjectPolygon?objectId=1`),
  );
}

//中观体征县区体征数据
export async function getGroupObjectPhysicalSignIndex(data: {
  physicalSignType: number;
  indexType: number;
}): Promise<PhysicalsignApi.Result<string[][]>> {
  return request(
    urlProxyApis(
      `/middlePhysicalSign/getGroupObjectPhysicalSignIndex?physicalSignType=1&indexType=1`,
    ),
    {
      params: data,
    },
  );
}

/**
 * @description 获取体征指数对比结果接口
 */
export async function getComparisonIndexInstance(
  data: any,
): Promise<PhysicalsignApi.Result<any>> {
  return request(urlProxyApis(`/main/getComparisonIndexInstance`), {
    params: data,
  });
}

/**
 * @description 基于对象与指数查询指标影响top5
 */
export async function getPhysicalsignindexquestioninstanceListTop(
  data: any,
): Promise<PhysicalsignApi.Result<string[][]>> {
  return request(
    urlProxyApis(`/physicalsignindexquestioninstance/listTopNItems`),
    {
      params: data,
    },
  );
}

/**
 * @description 预警区域
 */
export async function getWarningDistrictIndexInstance(
  data: PhysicalsignApi.PhysicalSignParams,
): Promise<PhysicalsignApi.Result<any>> {
  return request(urlProxyApis(`/main/getWarningDistrictIndexInstance`), {
    params: data,
  });
}

/**
 * @description 重点区域
 */
export async function getImportantDistrictIndexInstance(
  data: PhysicalsignApi.PhysicalSignParams,
): Promise<PhysicalsignApi.Result<any>> {
  return request(urlProxyApis(`/main/getImportantDistrictIndexInstance`), {
    params: data,
  });
}

/**
 * @description 指标体系查询，附带查询对象的各子级的得分和丢失分数
 */
export async function getIndexSystem(
  id: any,
): Promise<PhysicalsignApi.Result<any>> {
  return request(urlProxyApis(`/physicalSignIndex/getIndexSystem`), {
    params: {
      indexId: id,
    },
  });
}

/**
 * @description 具体问题列表
 */
export async function getIndexSafetyProblemList(
  data: any,
): Promise<PhysicalsignApi.Result<any>> {
  return request(
    urlProxyApis(
      `/livePhysicalSignInfluenceFactor/listTzzsLivePhysicalSignInfluenceFactorQuestionVO`,
    ),
    {
      params: data,
    },
  );
}

/**
 * @description 查询体征指数数据
 */
export async function getTzzsPhysicalSignIndexInstanceData(
  data: any,
): Promise<PhysicalsignApi.Result<any>> {
  return request(
    urlProxyApis(
      `/physicalsignindexinstance/queryTzzsPhysicalSignIndexInstanceDataVO`,
    ),
    {
      params: data,
    },
  );
}

/**
 * @description 城市安全态势指数
 */
export async function getIndexInstanceData(
  data: any,
): Promise<PhysicalsignApi.Result<any>> {
  return request(
    urlProxyApis(
      `/main/getIndexInstance`,
    ),
    {
      params: data,
    },
  );
}

/**
 * @description 行业体征指数
 */
export async function getDepartIndustryPhysicalSignIndex(
  data: any,
): Promise<PhysicalsignApi.Result<any>> {
  return request(
    urlProxyApis(
      `/middlePhysicalSign/getDepartIndustryPhysicalSignIndex`,
    ),
    {
      params: data,
    },
  );
}
///zhgl/getIndexDetailEventStatic?physicalSignType=2&indexType=1&indexId=1&objectId=510100&startTime=&endTime=
/**
 * @description 城市问题
 */
export async function getIndexDetailEventStatic(
  data: any,
): Promise<{noHandleEventCount:string,safetyWarningEventCount:string}> {
  return request(
    urlProxyApis(
      `/zhgl/getIndexDetailEventStatic`,
    ),
    {
      params: data,
    },
  );
}

//获取区域数据/physicalSignObject/getOptions?count=10&page=1
export const getIndicatorGapAnalysis = (): Promise<
  PhysicalsignApi.Result<{ items: { label: string; value: string }[] }>
> => {
  return request(
    urlProxyApis(`/physicalSignObject/getOptions?count=100&page=1`),
  );
};
