import NewAxiosInstanceFunc from '../Service/NewAxiosInstance'
import { INewResponse } from '../Service/INewResponse'
import { IIndustrialSubjectList, IIndustyListItem, IReportBillboardIndustryItem } from 'Indepth/Indepth.service'
import { IPaging } from 'Material/Material.service'

export interface IArticleTypeList {
  ArticleTypeId: number //文章类型ID
  ArticleTypeName: string //类型名称
  ButtonStyle: string //按钮展示样式
}
export interface ICommunityArticleList {
  Abstract: string // 摘要
  Annotation: string // 核心观点
  ArticleId: number // 文章id
  ArticleTypeId: number // 文章类型ID -1为研选专栏
  ArticleTypeName: string // 类型名称
  ButtonStyle: string // 按钮展示样式
  CollectNum: number // 收藏人数
  CompanyTags: string[] // 公司标签
  DepartmentId: number // 作者Id
  ImgUrlPc: string // 图片链接
  IndustryTags: string[] // 产业标签
  IsCollect: boolean // 本人是否收藏
  IsSpecial: boolean // 是否是专栏
  List: IReportBillboardIndustryItem[] // 列表数据
  ListSubject: IIndustrialSubjectList[]
  NickName: string // 作者昵称
  PublishDate: string // 发布时间
  Pv: number // PV
  Source: number
  SpecialColumnId: number // 专栏ID
  Title: string // 标题
  TopTime: number // 置顶时间
}
export interface IKOLList {
  DepartmentId: number // 作者Id
  CreateTime: string
  PublishDate: string // 发布时间
  NickName: string // 作者昵称
  ImgUrl: string // 头像
  IsFollow: boolean // 是否关注
  IsHot: boolean // 是否热标签
  FllowNum: number // 关注数量
  List: IAuthorIndustyList[] // 产业列表数据
}
export interface IAuthorIndustyList {
  IndustrialManagementId: number // 产业Id
  IndustryName: string // 产业Id
  DepartmentId: number
  List: null
}
export interface IApplyFollowDepartmentRes {
  Status: number // 1:关注，2：取消关注
  GoFollow: boolean
}
export interface IThemeDetailRes {
  IndustrialManagementId: number // 产业Id
  IndustryName: string // 产业名称
  IsFollow: boolean // 是否关注
  ListSubject: IIndustrialSubjectList[] // 标的列表
  List: ICommunityArticleList[]
}
export interface IAuthorDetailRes {
  DepartmentId: number // 作者Id
  NickName: string // 作者昵称
  ImgUrl: string // 图片链接
  FllowNum: number // 多少人关注
  ArticleNum: number // 文章数量
  CollectNum: number // 收藏人数
  IsFollow: boolean // 是否关注
  List: ICommunityArticleList[]
  ListIndustrial: IListIndustrialList[]
  Paging: IPaging
}
export interface IListIndustrialList {
  IndustrialManagementId: number //产业ID
  IndustryName: string //产业名称
  IsHot: boolean
  ArticleReadNum: number
}
export interface ICommunityBannerRes {
  ListA: ICBannerList[]
  ListB: ICBannerList[]
  ListC: ICBannerList[]
}
export interface ICBannerList {
  IndexImg: string
  Path: string
}
export const CommunityService = {
  getArticleTypeList: (): INewResponse<{ List: IArticleTypeList[] }> =>
    NewAxiosInstanceFunc({
      url: `/research/article/typeList`,
      method: 'get'
    }),
  getResearchArticleList: (
    PageSize: number,
    CurrentIndex: number,
    ArticleTypeIds: string
  ): INewResponse<{ List: ICommunityArticleList[]; Paging: IPaging }> =>
    NewAxiosInstanceFunc({
      url: `/research/article/newList`,
      method: 'get',
      params: { PageSize, CurrentIndex, ArticleTypeIds }
    }),
  getCollectList: (PageSize?: number): INewResponse<{ List: ICommunityArticleList[]; Paging: IPaging }> =>
    NewAxiosInstanceFunc({
      url: `/research/article/billboard`,
      method: 'get',
      params: { PageSize }
    }),
  getThemeHotList: (
    PageSize: number,
    CurrentIndex: number,
    ThemeType: number
  ): INewResponse<{ List: IIndustyListItem[]; Paging: IPaging }> =>
    NewAxiosInstanceFunc({
      url: `/research/hotList`,
      method: 'get',
      params: { PageSize, CurrentIndex, ThemeType } // 主题类型，1主题热度、2近期更新 默认1
    }),
  getKOLList: (
    PageSize: number,
    CurrentIndex: number,
    ThemeType: number
  ): INewResponse<{ List: IKOLList[]; Paging: IPaging }> =>
    NewAxiosInstanceFunc({
      url: `/research/kolList`,
      method: 'get',
      params: { PageSize, CurrentIndex, ThemeType } // 主题类型，1关注度、2更新时间
    }),
  getThemeDetail: (IndustrialManagementId: number): INewResponse<IThemeDetailRes> =>
    NewAxiosInstanceFunc({
      url: `/research/theme/detail`,
      method: 'get',
      params: { IndustrialManagementId }
    }),
  getAuthorDetail: (DepartmentId: number): INewResponse<IAuthorDetailRes> =>
    NewAxiosInstanceFunc({
      url: `/research/departmentId/detail`,
      method: 'get',
      params: { DepartmentId }
    }),
  getCommunityBanner: (): INewResponse<ICommunityBannerRes> =>
    NewAxiosInstanceFunc({
      url: `banner/listYx`,
      method: 'get'
    }),
  postFlowDepartment: (DepartmentId: number): INewResponse<IApplyFollowDepartmentRes> =>
    NewAxiosInstanceFunc({
      url: `/research/fllowDepartment`,
      method: 'post',
      data: { DepartmentId }
    }),
  postAddYXSurvey: (Content: string): INewResponse =>
    NewAxiosInstanceFunc({
      url: `/banner/add/yxSurvey`,
      method: 'post',
      data: { Content }
    })
}
