import { axios } from '@/utils/request'
import qs from 'qs'
import { UPCLOUD_RDC_TMS_MAINDATA_SERVICE } from '@/config/serviceSettings.js'
const serviceName = UPCLOUD_RDC_TMS_MAINDATA_SERVICE

// 主表地址
export const listRemoteUrl = {
  url: serviceName + '/tmsBaseBranch/queryBranch',
  method: 'post',
}

export const parkingListRemoteUrl = {
  url: serviceName + '/tmsBaseBranch/queryCarport_list',
  method: 'post',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  transformRequest: [data => qs.stringify(data)]
}

// 启用
export const activeBranch = data => {
  return axios.post(serviceName + "/tmsBaseBranch/activeBranch", data);
};

// 停用
export const deleteBranch = data => {
  return axios.post(serviceName + "/tmsBaseBranch/deleteBranch", data);
};

// 删除
export const batch_delete = data => {
  return axios.post(serviceName + "/tmsBaseBranch/batch_delete", data);
};

// 查看
export const viewBranch = data => {
  return axios.post(serviceName + "/tmsBaseBranch/viewBranch", qs.stringify(data), {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
};

// 新增
export const saveBranch = data => {
  return axios.post(serviceName + "/tmsBaseBranch/saveBranch", data);
};

// 修改
export const updateBranch = data => {
  return axios.post(serviceName + "/tmsBaseBranch/updateBranch", data);
};

// 车站启用
export const activeCarport = data => {
  return axios.post(serviceName + "/tmsBaseBranch/activeCarport", data);
};

// 车站停用
export const deleteCarport = data => {
  return axios.post(serviceName + "/tmsBaseBranch/deleteCarport", data);
};

// 车站删除
export const batch_delete_carport = data => {
  return axios.post(serviceName + "/tmsBaseBranch/batch_delete_carport", data);
};

// 车站查看
export const viewCarport = data => {
  return axios.post(serviceName + "/tmsBaseBranch/viewCarport", qs.stringify(data), {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
};

// 车站新增
export const saveCarport = data => {
  return axios.post(serviceName + "/tmsBaseBranch/saveCarport", data);
};

// 车站修改
export const updateCarport = data => {
  return axios.post(serviceName + "/tmsBaseBranch/updateCarport", data);
};

//导入url
export const importUrl = serviceName + '/tmsBaseBranch/import'
export const downUrl = serviceName + '/tmsBaseBranch/branch_download_template'
export const parkingImportUrl = serviceName + '/tmsBaseBranch/parking_space_import'
export const parkingDownUrl = serviceName + '/tmsBaseBranch/carport_download_template'

// 通过省市区获取站点
export const query_by_administrative = data => {
  return axios.post(serviceName + "/station/query_by_administrative", data);
};