import request from '@/utils/request'

export interface NewsData {
  content: string,
  date: string,
  id:number,
  title: string,
  specialColumn:string,
  files:FileType[],
  createBy:string,
  updateTime:string,
  dataSource:string
}

export interface NewsResponseData extends AxiosResponse{
  data:NewsData[]
}
export interface NewsResponseDataById extends AxiosResponse{
  data:NewsData
}
enum API {
  GET_NEWS_URL = '/crmNewsRelease/getList',
  GET_NEWS_BY_ID_URL = '/crmNewsRelease/getById/',
  GET_DICK_URL = '/system/dict/data/type/',
  GET_ADMINISTRATIVE_LICENSING = '/crmAdministrativeLicense/findByPage',
  GET_ADMINISTRATIVE_PENALTY = '/crmAdministrativePenalty/findByPage',
  GET_CREDIT_REDLIST_INFO = '/crmCreditRedlistInfo/findByPage',
  GET_C_D_COMPANY = '/crmHighTechZoneEnterprises/getCreditScoreList'
}

export const getNews = (params:object)=>{
  return request<any,NewsResponseData>({
    url:API.GET_NEWS_URL,
    method:'get',
    params
  })
}
export const getNewsById = (id:number)=>{
  return request.get<any,NewsResponseDataById>(API.GET_NEWS_BY_ID_URL+ id);
}
export const getDick = ()=>{
  return request.get<any,any>(API.GET_DICK_URL+'news_type');
}
export const get1 = (params={pageNum:1,pageSize:10})=>{
  return request<any,any>({
    url:API.GET_ADMINISTRATIVE_LICENSING,
    method:'get',
    params
  })
}
export const get2 = (params={pageNum:1,pageSize:10})=>{
  return request<any,any>({
    url:API.GET_ADMINISTRATIVE_PENALTY,
    method:'get',
    params
  })
}
export const get3 = (params={pageNum:1,pageSize:10})=>{
  return request<any,any>({
    url:API.GET_CREDIT_REDLIST_INFO,
    method:'get',
    params
  })
}
export const get4 = (params={pageNum:1,pageSize:10})=>{
  return request<any,any>({
    url:API.GET_C_D_COMPANY,
    method:'get',
    params:{
      pageNum:1,
      pageSize:10,
      unifiedSocialCreditCode:'',
      condition:'C,D'
    }
  })
}
