import http from "@/api/http.js"

/* 期货数据库/商品曲线 */

export default {
  /**
   * 期货数据库指标搜索
   * @param {*} params  Keyword
   * @returns 
   */
  targetSearch: params => {
    return http.get('/future_good/edb_info/list',params)
  },

  /**
   * 期货数据列表
   * @param {*} params
   * CurrentIndex
   * PageSize
   * StartDate
   * EndDate
   * FutureGoodEdbCode
   * @returns 
   */
  futuresTargetList: params => {
    return http.get('/future_good/edb_info/data/list',params)
  },

  /**
   * 获取分类
   * @returns 
   */
  classifyList:  params =>{
    return http.get('/future_good/chart_classify/list',params)
  },

  /**
   * 新增分类
   * @param {*} params  "ChartClassifyName": "分类1-2"
   * @returns 
   */
  classifyAdd:  params =>{
    return http.post('/future_good/chart_classify/add',params)
  },

  /**
   * 编辑分类
   * @param {*} params  ChartClassifyName ChartClassifyId
   * @returns 
   */
  classifyEdit: params =>{
    return http.post('/future_good/chart_classify/edit',params)
  },

  /**
   * 删除分类检测
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDelCheck: params =>{
    return  http.post('/future_good/chart_classify/delete/check',params)
  },

  /**
   * 删除分类
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDel: params =>{
    return  http.post('/future_good/chart_classify/delete',params)
  },

  /**
   * 移动分类
   * @param {*} params ClassifyId "PrevClassifyId":1, "NextClassifyId":2,
   * @returns 
   */
  classifyMove: params => {
    return http.post('/future_good/chart_classify/move',params)
  },

  /**
   * 移动图表
   * @param {*} params 
   */
  chartMove: params => {
    return http.post('/future_good/chart_info/move',params)
  },
  
  /**
   * 图表分类option
   * @param {*} params 
   * @returns 
   */
  classifyOne: params => {
    return http.get('/future_good/chart_classify/items',params)
  },

  /**
   * 期货指标分类option
   * @param {} params 
   * @returns 
   */
  futuresTargetClassify: params => {
    return http.get('/future_good/edb_info/group/list',params)
  },

  /**
   * 商品价格图表详情
   * @param {ChartInfoId} params 
   * @returns 
   */
  chartDetail: params => {
    return http.get('/future_good/chart_info/detail',params)
  },

  /**
   * 获取商品价格图表数据
   * @param {*} params 
   * EdbInfoIdList  [{"EdbInfoId": 101452,"Name": "","Source": 1}]
   * DateList [{ "Type": 1,"Date": "","Value": 0,"Name": "","Color": "#00f" }]
   * @returns 
   */
  getChartData: params => {
    return http.post('/future_good/chart_info/preview_bar',params)
  },

  /**
   * 新增图表
   * @param {*} params 
    "ChartClassifyId": 228,
    "ChartName": "商品价格曲线图2",
    "ChartType": 7,
    "DateType": 6,
    "LeftMin": "212.07",
    "LeftMax": "7700",
    "BarChartInfo": {
      "EdbInfoIdList": [{"EdbInfoId": 101452,"Name": "","Source": 1},
      ],
      "DateList": [{"Type": 1,"Date": "","Value": 0,"Name": "","Color": "#00f"}]
    }
   * @returns 
   */
  chartAdd: params => {
    return http.post('/future_good/chart_info/add',params)
  },

  /**
   * "ChartInfoId": 399,
    "ChartClassifyId": 228,
    "ChartName": "商品价格曲线图2",
    "ChartType": 7,
    "DateType": 6,
    "LeftMin": "212.07",
    "LeftMax": "7700",
    "BarChartInfo": {
      "EdbInfoIdList": [{"EdbInfoId": 101452,"Name": "","Source": 1},
      ],
      "DateList": [{"Type": 1,"Date": "","Value": 0,"Name": "","Color": "#00f"}]
    }
   * @param {*} params 
   * @returns 
   */
  chartEdit: params => {
    return http.post('/future_good/chart_info/edit',params)
  },

  /**
   * 搜索图表
   * @param {*} params Keyword IsShowMe
   * @returns 
   */
  searchChart: params => {
    return http.get('/future_good/chart_info/search_by_es',params)
  },

  /**
   * 获取图表bycode
   * @param {*} params UniqueCode IsCache
   * @returns 
   */
  getChartDetailByCode: params => {
    return http.get('/future_good/chart_info/detail/from_unique_code',params)
  },

  /**
   * 编辑英文信息
   * @param {*} params  ChartInfoId ChartNameEn UnitEn
   * @returns 
   */
  editChartEn: params => {
    return http.post('/future_good/chart_info/en/edit',params)
  },

  /**
   * 获取最新的图表 Keyword
   * @param {*} params 
   * @returns 
   */
  getNewestChart: params => {
    return http.get('/future_good/chart_info/newest',params)
  },

  /**
   * 另存为
   * @param {*} params ChartInfoId  ChartClassifyId  ChartName
   * @returns 
   */
  saveOtherChart: params => {
    return http.post('/future_good/chart_info/copy',params)
  },

  /**
   * 商品价格图表列表
   * @param {*} params CurrentIndex PageSize ChartClassifyId Keyword IsShowMe
   * @returns 
   */
  getChartList: params => {
    return http.get('/future_good/chart_info/list',params)
  },

  /**
   * 刷新图表 
   * @param {*} params ChartInfoId
   * @returns 
   */
  refreshChart: params => {
    return http.get('/future_good/chart_info/refresh',params)
  },

  /**
   * 保存图表
   * @param {*} param ChartInfoId LeftMin LeftMax
   * @returns  
   */
  chartSave: params => {
    return http.post('/future_good/chart_info/save',params)
  },

  /**
   * 交易所列表
   * @param {*RegionType} parmas 
   * @returns 
   */
  exchangeList: parmas => {
    return http.get('/future_good/exchange/list',parmas)
  },

  /**
   * 利润曲线预览
   * @param {*} params 
   *"FutureGoodEdbInfoIdList": [
        {
            "EdbInfoId": 5001015,
            "FromTag": "A",
        }
      ],
      BaseEdbInfoId":101452,
    "CalculateFormula":"A+B",
    DateList
   * @returns 
   */
  previewProfitData: params => {
    return http.post('/future_good/chart_info/profit/preview',params)
  },
  
  /**
   * 利润曲线新增
   * @param {*} params 
   * "ChartClassifyId": 228,
    "ChartName": "商品利润曲线",
    "ChartType": 7,
    "DateType": 6,
    "LeftMin": "212.07",
    "LeftMax": "7700",
    "Extra": {
        "FutureGoodEdbInfoIdList": [
            {
                "EdbInfoId": 5001678,
                "FromTag": "A",
            }
        ],
        "BaseEdbInfoId": 101452,
        "CalculateFormula": "A+1",
        "DateList": [
            {
                "Type": 1,
                "Date": "",
                "Value": 0,
                "Name": "",
                "Color": "#00f"
            }    
        ]
    }
   * @returns 
   */
  profitChartAdd: params => {
    return http.post('/future_good/chart_info/profit/add',params)
  },

  /**
   * 利润曲线编辑
   * @param {*} params ChartInfoId
   * @returns 
   */
  profitChartEdit: params => {
    return http.post('/future_good/chart_info/profit/edit',params)
  },
  
}