import request from '@/utils/request'

const companys=(data)=>{
  return request({ 
      url:`/listByPage?id=${data.id}&name=${data.name}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
      method:"get"
  })
}
const addCompanys=(pairs)=>{
  return request({
      url:`/save`,
      method:"post",
      data: pairs
  })
}
const deleteCompanys =(data)=>{
  return request({
      url:`/remove-companys/${data.id}`,
      method:"delete",
  })
}
const lines=(data)=>{
  return request({
      url:`/line/listByPage?id=${data.id}&name=${data.name}&pagenum=${data.pageNum}&pagesize=${data.pageSize}`,
      method:"get"
  })
}

const regionList =(data)=>{
  return request({
      url:`/region/List?id=${data.id}&name=${data.name}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
      method:"get"
  })
}
const addRegion =(pairs)=>{
  return request({
      url:`/region/save`,
      method:"post",
      data: pairs
  })
}
const deleteRegion =(data)=>{
  return request({
      url:`/region/${data.id}`,
      method:"delete",
  })
}

const windpowerstationList =(data)=>{
  return request({
      url:`/windpowerstation/List?id=${data.id}&name=${data.name}&companyid=${data.companyid}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
      method:"get"
  })
}
const addWindpowerstation =(pairs)=>{
  return request({
      url:`/windpowerstation/add`,
      method:"post",
      data: pairs
  })
}
const deleteWindpowerstation =(data)=>{
  return request({
      url:`/windpowerstation/${data.id}`,
      method:"delete",
  })
}
const projectList =(data)=>{
  return request({
      url:`/project/List?windpowerstationid=${data.windpowerstationid}&name=${data.name}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
      method:"get"
  })
}
const addProject =(pairs)=>{
  return request({
      url:`/project/add`,
      method:"post",
      data: pairs
  })
}
const deleteProject =(data)=>{
  return request({
      url:`/project/${data.id}`,
      method:"delete",
  })
}
const addLine =(pairs)=>{
  return request({
      url:`/line/add-Line`,
      method:"post",
      data: pairs
  })
}
const deleteLine =(data)=>{
  return request({
      url:`/line/remove-lines/${data.id}`,
      method:"delete",
  })
}

const windturbine =(data)=>{
  return request({
      url:`/windturbine/companys?windpowerstationid=${data.windpowerstationid}&name=${data.name}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
      method:"get"
  })
}
const addWindturbine =(pairs)=>{
  return request({
      url:`/windturbine/add`,
      method:"post",
      data: pairs
  })
}
const deleteWindturbine =(data)=>{
  return request({
      url:`/windturbine/${data.id}`,
      method:"delete",
  })
}
export default {
  companys,
  addCompanys,
  deleteCompanys,
  lines,
  regionList,
  addRegion,
  deleteRegion,
  windpowerstationList,
  addWindpowerstation,
  deleteWindpowerstation,
  projectList,
  addProject,
  deleteProject,
  addLine,
  deleteLine,
  windturbine,
  addWindturbine,
  deleteWindturbine,
};
