import server from '@/utils/request'

//新增
interface Addobj{
  pkId?:String
  name:String                 //名称
  stationCode:String	        //换电站编码
  stationName:String	        //换电站名称
  miniLimit:String|Number	    //最低数量
  status?:String|Number	      //状态：0-未启用，1-启用
}

export function addhdz(data:Addobj) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/add',
    method: 'post',
    data
  })
}

//修改
export function update(data:Addobj) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/update',
    method: 'post',
    data
  })
}

//查询
interface Querydata{
  stationCode:String          //换电站编码  
  status:String|Number        //状态
}
export function getjqrlist(params:Querydata) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/list',
    method: 'get',
    params
  })
}

//删除
export function delhdz(id:string) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/del',
    method: 'post',
    data:{
      id
    }
  })
}



interface Addxq{
  pkId?:String
  stationCode:String	        //换电站编码
  stationName:String	        //换电站名称
  strategyId:String	          //策略ID
  beginTime:String	          //开始时间,示例值(20:01:32)
  endTime:String	            //结束时间,示例值(23:05:41)
  chargingPower?:String	      //充电功率
}

//新增详情
export function addxq(data:Addxq) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/detail/add',
    method: 'post',
    data
  })
}

//修改详情
export function updatexq(data:Addxq) { 
  return server.request({
    url: '/cloud/battery/station/cd/strategy/detail/update',
    method: 'post',
    data
  })
}


//删除详情
export function delxq(id:string) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/detail/del',
    method: 'post',
    data:{
      id
    }
  })
}


//查询详情
export function getxql(strategyId:String) {
  return server.request({
    url: '/cloud/battery/station/cd/strategy/detail/list',
    method: 'get',
    params:{
      strategyId
    }
  })
}