import { callUIInteraction } from "@/webRtcVideo";

function callUIInteractionFormat(action) {
  if(action['Parameters']) {
    action['Parameters'] = JSON.stringify(action['Parameters'])
  }
  console.log('发送信息-->',action)
  callUIInteraction(action)
}

export function ueCallfullExtent() {
  callUIInteractionFormat({
    "ActionName": "full_extent"
  })
}

export function ueCallFlyToHsx() {
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x":-4366605,"y":3078090,"z":3848,"roll_x":0,"roll_y":-34,"roll_z":142 }
  })
}

export function ueCallPositionByType(position_type, position_name) {
  callUIInteractionFormat({
    "ActionName":"position_by_type",
    "Parameters": {
      position_type, position_name
    }
  })
}

export function ueCallShowLine() {
  callUIInteractionFormat({
    "ActionName":"show_line"
  })
}

export function ueCallCloseLine() {
  callUIInteractionFormat({
    "ActionName":"close_line"
  })
}

export function ueCallShowMt() {
  callUIInteractionFormat({
    "ActionName":"show_mt"
  })
}

export function ueCallCloseMt() {
  callUIInteractionFormat({
    "ActionName":"close_mt"
  })
}

export function ueCallShowLymt() {
  callUIInteractionFormat({
    "ActionName":"show_lymt"
  })
}

export function ueCallCloseLymt() {
  callUIInteractionFormat({
    "ActionName":"close_lymt"
  })
}

export function ueCallClickBoat(mmsi) {   //船舶跟随
  callUIInteractionFormat({
    'ActionName': 'click_boat',
    'Parameters': { mmsi }
  })
}

export function ueCallCloseBoat() {   //停止船舶跟随
  callUIInteractionFormat({
    'ActionName': 'close_boat'
  })
}

export function ueCallBoatGuiji(startTime, endTime) {   //显示轨迹回放航线
  callUIInteractionFormat({
    'ActionName': 'boat_guiji',
    'Parameters': {
      startTime, endTime
    }
  })
}

export function ueCallSetBoatDriveSpeed(speed) {    //设置轨迹回放速度
  callUIInteractionFormat({
    'ActionName': 'set_boat_drive_speed',
    'Parameters': {
      speed
    }
  })
}

export function ueCallBoatDrive() {    // 轨迹回放开始
  callUIInteractionFormat({
    ActionName: 'boat_drive',
  })
}

export function ueCallBoatCloseDrive() {    // 结束轨迹回放
  callUIInteractionFormat({
    'ActionName': 'boat_close_drive',
  })
}

export function ueCallBoatStop() {    // 暂停轨迹回放
  callUIInteractionFormat({
    'ActionName': 'boat_stop',
  })
}

export function ueCallBoatContinue() {    // 恢复轨迹回放
  callUIInteractionFormat({
    'ActionName': 'boat_continue',
  })
}

export function ueCallCloseUnitWiget() {    //关闭企业撒点
  callUIInteractionFormat({
    "ActionName":"close_unit_wiget"
  })
}

export function ueCallOpenUnitVideo(code) {    //打开企业视频
  callUIInteractionFormat({
    "ActionName":"open_unit_video",
    "Parameters":{
      code
    }
  })
}

export function ueCallCloseUnitVedio() {    //关闭企业视频
  callUIInteractionFormat({
    "ActionName":"close_unit_vedio"
  })
}

export function ueCallClickUnitWiget(objectId) {    //点击企业名称
  callUIInteractionFormat({
    "ActionName":"click_unit_wiget",
    "Parameters": {
      objectId
    }
  })
}

export function ueCallOpenUnitWiget() {    //企业撒点
  callUIInteractionFormat({
    "ActionName":"open_unit_wiget"
  })
}

export function ueCallBreathGetPoint() {    //预警企业撒点
  callUIInteractionFormat({
    "ActionName":"breath_get_point"
  })
}

export function ueCallClickBreth(objectId) {    //预警企业定位
  callUIInteractionFormat({
    "ActionName":"click_breth",
    "Parameters": {
      objectId
    }
  })
}

export function ueCallClearAllBreth() {    //清除预警企业撒点
  callUIInteractionFormat({
    "ActionName":"clear_all_breth"
  })
}

export function ueCallInitAll() {    //浦江游览上下船初始化
  callUIInteractionFormat({
    "ActionName":"init_all"
  })
}

export function ueCallClearAllAi() {    //浦江游览清除
  callUIInteractionFormat({
    "ActionName":"clearAllAi"
  })
}
export function ueCallFindJinghua() {    //浦江游览定位到精华航线
  callUIInteractionFormat({
    "ActionName":"find_jinghua"
  })
}

export function ueCallRunJinghua() {    //浦江游览精华航线开始模拟
  callUIInteractionFormat({
    "ActionName":"run_jinghua"
  })
}

export function ueCallRunOpJinghua() {    //浦江游览精华航线模拟暂停或继续
  callUIInteractionFormat({
    "ActionName":"run_op_jinghua"
  })
}

export function ueCallFindZhuanhang() {    //浦江游览定位到专航航线
  callUIInteractionFormat({
    "ActionName":"find_zhuanhang"
  })
}

export function ueCallRunZhuanhang() {    //浦江游览专航航线开始模拟
  callUIInteractionFormat({
    "ActionName":"run_zhuanhang"
  })
}

export function ueCallRunOpZhuanhang() {    //浦江游览专航航线模拟暂停或继续
  callUIInteractionFormat({
    "ActionName":"run_op_zhuanhang"
  })
}

export function ueCallQueryWater(startTime, endTime) {    // 查询水位数据
  callUIInteractionFormat({
    'ActionName':'query_water',
    'Parameters':{
      startTime, endTime
    }
  })
}

export function ueCallPlayWater() {    // 开始水位动画
  callUIInteractionFormat({
    "ActionName":"play_water"
  })
}

export function ueCallStopWater() {    // 停止水位动画
  callUIInteractionFormat({
    "ActionName":"stop_water"
  })
}

export function ueCallContinueWater() {    // 继续水位动画
  callUIInteractionFormat({
    "ActionName":"continue_water"
  })
}

export function ueCallResetWater() {    // 重置水位
  callUIInteractionFormat({
    "ActionName":"reset_water"
  })
}

export function ueCallSetWaterSpeed(speed) {    // 水位播放速度
  callUIInteractionFormat({
    "ActionName":"set_water_speed",
    'Parameters':{
      speed
    }
  })
}

export function ueCallCloseWater() {    // 关闭水面
  callUIInteractionFormat({
    "ActionName":"close_water"
  })
}

export function ueCallOpenWater() {    // 打开水面
  callUIInteractionFormat({
    "ActionName":"open_water"
  })
}

export function ueCallChangeShuishen(shuishen_index, type='') {    // 水下地形切换
  callUIInteractionFormat({
    "ActionName":"change_shuishen",
    "Parameters": {
      shuishen_index, type
    }
  })
}

export function ueCallOpenVideoFusion() {    // 视频融合开启
  callUIInteractionFormat({
    "ActionName":"open_video_fusion"
  })
}

export function ueCallCloseVideoFusion() {    // 视频融合关闭
  callUIInteractionFormat({
    "ActionName":"close_video_fusion"
  })
}

export function ueCallBoatRealtime() {    // 实施船舶开启
  callUIInteractionFormat({
    "ActionName":"boat_realtime"
  })
}

export function ueCallClearBoatTime() {    // 实施船舶关闭
  callUIInteractionFormat({
    "ActionName":"clear_boat_time"
  })
}

export function ueCallShowSuperLevelBoat() {    // 显示超等级船舶
  callUIInteractionFormat({
    "ActionName":"show_superlevel_boat"
  })
}

export function ueCallCloseSuperLevelBoat() {    // 关闭超等级船舶
  callUIInteractionFormat({
    "ActionName":"close_superlevel_boat"
  })
}

export function ueCallShowHangdaoLine() {    // 开启航道中心线
  callUIInteractionFormat({
    "ActionName":"show_hangdao_line"
  })
}

export function ueCallCloseHangdaoLine() {    // 关闭航道中心线
  callUIInteractionFormat({
    "ActionName":"close_hangdao_line"
  })
}

export function ueCallPositionForHsx(eventcode, position_name) {    // 杭申线船舶定位
  callUIInteractionFormat({
    "ActionName":"position_for_hsx",
    "Parameters": {
      eventcode, position_name
    }
  })
}

export function ueCallChangeTime(hour) {    // 改变场景时间
  callUIInteractionFormat({
    "ActionName":"change_time",
    "Parameters":{
      "hour":hour,"minutes":0,"seconds":0
    }
  })
}

export function ueCallChangeWeather(type) {    // 改变场景天气
  callUIInteractionFormat({
    "ActionName":"change_weather",
    "Parameters":{
      "weather_type":type,
    }
  })
}

export function ueCallOpenRlt() {    // 开启轮渡客流
  callUIInteractionFormat({
    "ActionName":"open_rlt",
  })
}

export function ueCallCloseRlt() {    // 关闭轮渡客流
  callUIInteractionFormat({
    "ActionName":"close_rlt",
  })
}



export function ueCallChangeMi (consmi) {    //更改米深
  callUIInteractionFormat({
    "ActionName":"change_mi",
    "Parameters":{"mi":consmi}

  })
}



export function ueCallFlyToHD() {    // 定位到航道视角
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x":214537,"y":-105865,"z":65661,"roll_x":0,"roll_y":-72,"roll_z":51 }
  })
}

export function ueCallFlyToSW() {    // 定位到水位视角
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x":258684.06,"y":58084.09,"z":30.736284,"roll_x":-0.000001,"roll_y":-20.76 ,"roll_z":95.40 }
  })
}

export function ueCallFlyToSXDXNew() {    // 定位到水下地形视角
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x":211334.953125,"y":-85456.367188,"z":-4260.189453,"roll_x":0,"roll_y":-10.781706,"roll_z":-75.283707}
  })
}

export function ueCallFlyToSXDXStretch() {    // 定位到水下地形拉伸视角（todo
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x":205588.28125,"y":-75571.132812,"z":-2508.588867,"roll_x":0,"roll_y":-3.052398,"roll_z":-66.653122}
  })
}

export function ueCallFlyToSXDX() {    // 定位到水下地形水上视角新加
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x":190706.09375,"y":-62564.921875,"z":29829.849609,"roll_x":0,"roll_y":-35.457027,"roll_z":-48.256573 }
  })
}

export function ueCallFlyToSP() {    // 定位到视频视角
  callUIInteractionFormat({
    "ActionName":"fly",
    // "Parameters":{"x":251135.859375,"y":-82312.960938,"z":16717.919922,"roll_x":0.000003,"roll_y":-43.600452,"roll_z":-120.054901 }  之前旧视角
    // "Parameters":{"x":260363.53125,"y":-85049.40625,"z":29117.736328,"roll_x":0.000003,"roll_y":-49.960373,"roll_z":-119.297333 }
    // "Parameters":{"x":252294.0187,"y":-81416.5337,"z":10800,"roll_x":0.000003,"roll_y":-49.960373,"roll_z":-119.297333 }港务大厦
    // "Parameters":{"x":254878.484375,"y":80966.054688,"z":11625.779297,"roll_x":0.000004,"roll_y":-24.339344,"roll_z":-131.197723 }港务大厦调整
    "Parameters":{"x":254739.46875,"y":-88544.71875,"z":27800.070312,"roll_x":0.000003,"roll_y":-57,"roll_z":-119.227257 }
  })
}

export function ueCallChangeTrackType(track_type) {    // 更改船舶追踪类型
  callUIInteractionFormat({
    "ActionName":"change_track_type",
    "Parameters":{ track_type }
  })
}

export function ueCallShowOnlyLycb() {    // 只显示旅游船舶
  callUIInteractionFormat({
    "ActionName":"show_only_lycb"
  })
}

export function ueCallCloseOnlyLycb() {    // 取消只显示旅游船舶
  callUIInteractionFormat({
    "ActionName":"close_only_lycb"
  })
}

export function ueCallInitShujun() {    // 疏浚模拟初始化
  callUIInteractionFormat({
    "ActionName":"init_shujun"
  })
}

export function ueCallClickShujun() {    // 疏浚模拟点击
  callUIInteractionFormat({
    "ActionName":"click_shujun"
  })
}

export function ueCallRunShujun() {    // 疏浚模拟开始
  callUIInteractionFormat({
    "ActionName":"run_shujun"
  })
}

export function ueCallBackShujun() {    // 疏浚船舶回头
  callUIInteractionFormat({
    "ActionName":"back_shujun"
  })
}

export function ueCallClearShujun() {    // 结束疏浚模拟
  callUIInteractionFormat({
    "ActionName":"clear_shujun"
  })
}

export function ueCallBeforeShujun() {    // 疏浚前效果
  callUIInteractionFormat({
    "ActionName":"before_shujun"
  })
}

export function ueCallAfterShujun() {    // 疏浚后效果
  callUIInteractionFormat({
    "ActionName":"after_shujun"
  })
}

export function ueCallInitWaterShujun() {    // 清除疏浚效果
  callUIInteractionFormat({
    "ActionName":"init_water_shujun"
  })
}

export function ueCallHistoryRun(routTypeId, mmsi, startTime) {    // 模拟历史航班
  callUIInteractionFormat({
    "ActionName":"history_run",
    "Parameters":{
      routTypeId,
      mmsi,
      startTime
    }
  })
}

export function ueCallHistoryStop() {    // 模拟历史航班暂停
  callUIInteractionFormat({
    "ActionName":"history_stop"
  })
}

export function ueCallHistoryAgain() {    // 模拟历史航班继续
  callUIInteractionFormat({
    "ActionName":"history_again"
  })
}

export function ueCallHistoryClear() {    // 清除模拟历史航班
  callUIInteractionFormat({
    "ActionName":"history_clear"
  })
}

export function ueCallStartYjyj() {    // 开启淤积预警
  callUIInteractionFormat({
    "ActionName":"start_yjyj"
  })
}

export function ueCallCloseYjyj() {    // 关闭淤积预警
  callUIInteractionFormat({
    "ActionName":"close_yjyj"
  })
}

export function ueCallFlyToZrcb() {    // 定位到中燃船舶
  callUIInteractionFormat({
    "ActionName":"fly",
    "Parameters":{ "x": 666635,"y":-1152420,"z":5000,"roll_x":0,"roll_y":-24,"roll_z":-170.0 }
  })
}

export function ueCallGetNowTime() {    // 开启实时
  callUIInteractionFormat({
    "ActionName":"getNowTime"
  })
}

export function ueCallOpenMaintain(code) {    // 开启维护水深
  callUIInteractionFormat({
    "ActionName":"openMaintain",
    "Parameters": { 'type': '2', 'code': code }
  })
}

export function ueCallCloseMaintain() {    // 关闭维护水深
  callUIInteractionFormat({
    "ActionName":"closeMaintain"
  })
}