/**
 * 所有跟用户相关的接口（TODO:DEMO USER）
 */

 import { HttpResponse } from '@/@types'
 import Axios from './axios' 
 /**
  * @interface loginParams -登录参数
  * @property {string} grant_type -授权类型
  * @property {string} email -邮箱
  * @property {string} password -用户密码
  */
 interface msg {
   Enable: number
 }
 interface IdName {
   Id:number,
   Name:string
 }
 
 
 
 /**
  * @example Axios.get(`https://xxx.com}`)
  * @todo Get the exchange rate of the current currency
  */
 
 class customerService {
   // 获取客户字段列表
   static async getCustomerFiledList(data: msg): Promise<HttpResponse> {
     return Axios('/QYCustomer/GetCustomerFiledList', {
       method: 'post',
       responseType: 'json',
       data
     })
   }
   // 获取客户标签
   static async getLabelList(data: any): Promise<HttpResponse> {
     return Axios('/QYWeChat/GetWeChatLableList', {
       method: 'post',
       responseType: 'json',
       data
     })
   }
   // 客户标签移动
   static async setCustomerFiledState(data: { Type: number; SortFiledId: number; FiledId: number }): Promise<HttpResponse> {
     return Axios('/QYCustomer/SetCustomerFiledState', {
       method: 'post',
       responseType: 'json',
       data
     })
   }
   // 获取客户线索规则列表
   static async getCustomerClueRuleList(data: any): Promise<HttpResponse> {
     return Axios('/QYCustomer/GetCustomerClueRuleList', {
       method: 'post',
       responseType: 'json',
       data
     })
   }
   // 获取客户线索规则详情
   static async getCustomerClueRuleDetail(data: any): Promise<HttpResponse> {
     return Axios('/QYCustomer/GetCustomerClueRuleInfo', {
       method: 'post',
       responseType: 'json',
       data
     })
   }
   // 获取客户阶段列表
   static async getCustomerStageList(data: any): Promise<HttpResponse> {
     return Axios('/QYCustomer/GetCustomerStageList', {
       method: 'post',
       responseType: 'json',
       data
     })
   }
   // 获取客户子段类型枚举
   static async getCustomerFieldTypeEnumList(data: any): Promise<HttpResponse> {
    return Axios('/QYCustomer/GetCustomerFieldTypeEnumList', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  // 获取部门树形列表
  static async getDeptTree(data: any): Promise<HttpResponse> {
    return Axios('/User/GetDeptTree', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  // 获取部门树形列表
  static async getCustomerFieldInputTypeEnumList(data: any): Promise<HttpResponse> {
    return Axios('/QYCustomer/GetCustomerFieldInputTypeEnumList', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  //新增修改客户字段
  static async setCustomerFiledInfo(data: {
    Id:number,
    Type:number,
    Name:string,
    Required:number,
    DeptId:number,
    WordNum:number,
    InputType:string,
    OptionsList:Array<IdName>,
    Digits:number,
    Enable:number,
    [propName: string]: any
  }): Promise<HttpResponse> {
    return Axios('/QYCustomer/SetCustomerFiledInfo', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
 }
 
 export default customerService
 