import {get, post, put, del} from '../http'

const MODULE_NAME = 'siteManagement'

const site = {
  getAllSiteList: (params) => {
    return get('siteManagement/getAllSiteList', params)
  },
  getRateTypeList: () => {
    return get(`${MODULE_NAME}/getRateTypeList`)
  },
  getTypeList: () => {
    return get(`${MODULE_NAME}/getChargeTypes`)
  },
  getChargeTypeList: () => {
    return get(`${MODULE_NAME}/getChargeTypeList`)
  },
  getSiteTypeList: () => {
    return get(`${MODULE_NAME}/getSiteTypeList`)
  },
  getSiteTypeListV2: () => {
    return get("v2/site/types")
  },
  addSite: (data) => {
    return post(`${MODULE_NAME}/addSite`, data)
  },
  getSiteList: (data) => {
    return post(`${MODULE_NAME}/getSitePages`, data)
  },
  updateSite: (data) => {
    return post(`${MODULE_NAME}/updateSite`, data)
  },
  getSiteInfo: (data) => {
    return get(`${MODULE_NAME}/getSiteInfo`, data)
  },
  deleteChargeRate: (params) => {
    return get(`${MODULE_NAME}/delChargeRate`, params)
  },
  deleteWhitelistUser: (params) => {
    return get(`${MODULE_NAME}/delWhitelistUser`, params)
  },
  deleteWhitelistFleet: (params) => {
    return get(`${MODULE_NAME}/delGroupWhitelist`, params)
  },
  getCountryList: () => {
    return get(`${MODULE_NAME}/getCountryList`)
  },
  deleteSite: (params) => {
    return get(`${MODULE_NAME}/delSite`, params)
  },
  getChargingProfiles() {
    return get(MODULE_NAME+ '/getChargingProfiles')
  },
  getBalancingChargingProfiles(params) {
    return get(MODULE_NAME+ '/getLoadBalancingChargingProfiles', params)
  },
  getBalancingOptions() {
    return get(MODULE_NAME+ '/getLoadBalancingList')
  },
  deleteChargingProfile(id) {
    return get(MODULE_NAME+ '/delSiteChargingProfile', {siteChargingProfileId: id})
  },
  getPlugTypes() {
    return get('/chargeType/plug-types')
  },
  getHistoryRates(params) {
    return get(MODULE_NAME + '/site-rates', params)
  },
  getLabelPages(params) {
    return post("label/label-pages", params)
  },
  addSiteLabel(params) {
    return post("label/labels", params)
  },
  updateSiteLabel(params) {
    return put("label/labels", params)
  },
  viewSiteLabel(siteLabelId) {
    return get("label/labels/" + siteLabelId)
  },
  deleteSiteLabel(siteLabelId) {
    return del("label/labels/" + siteLabelId)
  },
  /**
   * 分配站点标签
   */
  getLabelAssignPages(params) {
    return post("label/assign-site-pages", params)
  },
  getAssignStatusOptions() {
    return get("label/assignment-statuses")
  },
  assignSiteLabel(params) {
    return post("label/assign-sites", params)
  },
  unassignSiteLabel(params) {
    return post("label/un-assign-sites", params)
  },
  /**
   * 分配站点白名单用户
   */
  getPrivateUserAssignPages(params) {
    return post("v2/site/assign-user-pages", params)
  },
  assignPrivateUser(params) {
    return post("v2/site/assign-site-users", params)
  },
  unassignPrivateUser(params) {
    return post("v2/site/unassign-site-users", params)
  },
  /**
   * 分配站点白名单组织
   */
  getPrivateGroupAssignPages(params) {
    return post("v2/site/assign-group-pages", params)
  },
  assignPrivateGroup(params) {
    return post("v2/site/assign-site-groups", params)
  },
  unassignPrivateGroup(params) {
    return post("v2/site/unassign-site-groups", params)
  }
}

export default site;