/**
 * 所有跟用户相关的接口（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 getCustomerClueRuleConfig(data: any): Promise<HttpResponse> {
    return Axios('/QYCustomer/GetCustomerClueRuleConfig', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  // 设置客户线索配置
  static async setCustomerClueRuleConfig(data: any): Promise<HttpResponse> {
    return Axios('/QYCustomer/SetCustomerClueRuleConfig', {
      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 setCustomerClueRuleInfo(data: any): Promise<HttpResponse> {
    return Axios('/QYCustomer/SetCustomerClueRuleInfo', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  // 设置线索规则状态
  static async setCustomerClueRuleState(data: any): Promise<HttpResponse> {
    return Axios('/QYCustomer/SetCustomerClueRuleState', {
      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
    })
  }
  //获取客户阶段流程列表
  static async getCustomerStageFlowList(data: msg): Promise<HttpResponse> {
    return Axios('/QYCustomer/GetCustomerStageFlowList', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  //设置客户阶段流程状态
  static async setCustomerStageFlowState(data: { Type: number; FlowId: number }): Promise<HttpResponse> {
    return Axios('/QYCustomer/SetCustomerStageFlowState', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  //验证该阶段是否可以删除
  static async validataCustomerStageDel(data: { StageId: number }): Promise<HttpResponse> {
    return Axios('/QYCustomer/ValidataCustomerStageDel', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  // 验证阶段输单/无效的 原因选项是否可以删除
  static async validataCustomerCauseDel(data: { CauseId: number; Type: number }): Promise<HttpResponse> {
    return Axios('/QYCustomer/ValidataCustomerCauseDel', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
  // 验证阶段输单/无效的 原因选项是否可以删除
  static async setCustomerStageInfo(data: { Id: number; Type: number; Name: string; Sort: number; OptionsList: Array<IdName>; IsDefault: number }): Promise<HttpResponse> {
    return Axios('/QYCustomer/SetCustomerStageInfo', {
      method: 'post',
      responseType: 'json',
      data
    })
  }
}

export default customerService
