import { request } from '@/utils/request'
import { Base } from '@/enums/api'
import { DomainTreeResParams } from '@/types/domain'

export interface BaseApiType {
  list: { id: string; name: string }[]
}

export interface PrjPhaseList {
  list: { id: string; name: string; color: string }[]
}
export interface DocTypeList {
  list: { id: string; name: string; color: string; allow_upload: boolean }[]
}

/**
 * 获取客户级别信息列表
 * @returns
 */
export const getCustomerLevelList = () => {
  return request.post<BaseApiType>({
    url: Base.CFG_CUSTOMER_LEVEL_LIST,
    data: {}
  })
}

/**
 * 获取行业分类信息列表
 * @returns
 */
export const getIndustryTypeList = () => {
  return request.post<BaseApiType>({
    url: Base.CFG_INDUSTRY_TYPE_LIST,
    data: {}
  })
}

// 获取项目类型列表
export const getPrjTypeList = () => {
  return request.post<DomainTreeResParams>({
    url: Base.CFG_PRJ_TYPE_TREE,
    data: {}
  })
}

// 获取项目阶段列表
export const getPrjPhaseList = () => {
  return request.post<PrjPhaseList>({
    url: Base.CFG_PRJ_PHASE_GET_LIST,
    data: {}
  })
}

export const getMemberRoleList = () => {
  return request.post<BaseApiType>({
    url: Base.CFG_PRJ_ROLE_GET_LIST,
    data: {}
  })
}

export const getDocTypeList = () => {
  return request.post<DocTypeList>({
    url: Base.CFG_DOC_TYPE_LIST,
    data: {}
  })
}
