import { StationAccModel, StationAccQueryParam, StationAccUpdataModel } from '@/types'
import request from '@/until/request'

/**
 * 获取遥测站列表
 * @param data StationAccQueryParam
 */
const QueryStationAccList = (data: StationAccQueryParam) =>
    request({
        url: '/StationAccAction/findByCondition',
        method: 'post',
        data: data
    })
/**
* 新增遥测站
* @param data StationAcc
*/
const AddStationAcc = (data: StationAccModel) =>
    request({
        url: '/StationAccAction/saveStationAcc',
        method: 'post',
        data: data
    })

/**
* 编辑遥测站
* @param data StationAcc
*/
const EditStationAcc = (data: StationAccModel) =>
    request({
        url: '/StationAccAction/updateStationAcc',
        method: 'post',
        data: data
    })

/**
* 删除遥测站
* @param  id number
*/
const DeleteStationAcc = (id: number) =>
    request({
        url: '/StationAccAction/deleteStationAcc/' + id,
        method: 'get',
    })

/**
 * 根据CustomerId查询站点树
 * @param customerId 
 * @returns 
 */
const QueryStationTree = (userId: string) =>
    request({
        url: '/StationAccAction/findStationTreeByUserId/'+userId,
        method: 'get',
    })

/**
 * 根据unitCode查询站点树
 * @param unitCode 
 * @returns 
 */
 const QueryStationTreeByUnitCode = (unitCode: string) =>
 request({
     url: '/StationAccAction/findStationTreeByUnitCode/'+unitCode,
     method: 'get',
 })

 /**
  * 
  * @returns 查询全部遥测站树(内部用户使用)
  */
 const QueryAllStationTree = () =>
 request({
     url: '/StationAccAction/findAllStationTree',
     method: 'get',
 })

 /**
* 批量更新VisUnitCodes
* @param data StationAccUpdataModel
*/
const UpdateVisUnitCodes = (data: StationAccUpdataModel) =>
request({
    url: '/StationAccAction/updateVisUnitCodes',
    method: 'post',
    data: data
})

 /**
* 批量更新VisUnitCodes
* @param data StationAccUpdataModel
*/
const CheckSameVisUnitCodes = (data: StationAccUpdataModel) =>
request({
    url: '/StationAccAction/checkSameVisUnitCodes',
    method: 'post',
    data: data
})

export default {
    QueryStationAccList,
    AddStationAcc,
    EditStationAcc,
    DeleteStationAcc,
    QueryStationTree,
    QueryStationTreeByUnitCode,
    QueryAllStationTree,
    UpdateVisUnitCodes,
    CheckSameVisUnitCodes,
}