import request from '@/config/axios'

// netty客户端连接 VO
export interface TcpClientVO {
  id: number // id
  name: string // 连接名称
  port: number // 端口
  ip: string // ip
  type: string // 处理器类型
  reconnectNum: number // 重试个数
  reconnectInterval: number // 重试间隔时间
}

// netty客户端连接 API
export const TcpClientApi = {
  // 查询netty客户端连接分页
  getTcpClientPage: async (params: any) => {
    return await request.get({ url: `/logistics/tcp-client/page`, params })
  },

  // 查询netty客户端连接详情
  getTcpClient: async (id: number) => {
    return await request.get({ url: `/logistics/tcp-client/get?id=` + id })
  },

  // 新增netty客户端连接
  createTcpClient: async (data: TcpClientVO) => {
    return await request.post({ url: `/logistics/tcp-client/create`, data })
  },

  // 修改netty客户端连接
  updateTcpClient: async (data: TcpClientVO) => {
    return await request.put({ url: `/logistics/tcp-client/update`, data })
  },

  // 删除netty客户端连接
  deleteTcpClient: async (id: number) => {
    return await request.delete({ url: `/logistics/tcp-client/delete?id=` + id })
  },

  // 导出netty客户端连接 Excel
  exportTcpClient: async (params) => {
    return await request.download({ url: `/logistics/tcp-client/export-excel`, params })
  },
 // 手动连接 
 ConnecTcpClient: async (id: number) => {
  return await request.put({ url: `/logistics/tcp-client/conn?id=` + id })
},
 // 手动断开
 BreakcpClient: async (id: number) => {
  return await request.delete({ url: `/logistics/tcp-client/disconn?id=` + id })
},
}
