namespace LY.App.Device.Command
{
    public static class GraphCommand
    {
        /// 
        /// 获取打击状态
        /// 
        /// 
        public static string AttackStatus()
        {
            return @"{
             widebandJammer {
             band15
             band24
             band58
             }
            }";
        }
        /// 
        /// 获取无人机
        /// 
        /// 
        public static string GetFindTarget()
        {
            return @"{drone {
              attack_bands,
              attack_type,
              attacking,
              can_attack,
              can_takeover,
              created_time,
              deleted_time,
              description,
              direction,
              distance,
              has_duplicate,
              id,
              initial_location {
                lat
                lng
              },
              jamming_conflicts,
              lastseen,
              latitude,
              link_id,
              localization {
                lat
                lng
              },
              longitude,
              name,
              height,
              distance,
              seen_sensor {
                detected_freq_khz
                noise_dbm
                sensor_id
                signal_dbm
                snr_dB
              },
              state,
              whitelisted
            }}";
        }
        /// 
        /// 获取设备状态信息
        /// 
        public static string GetDeveceStatusInfo()
        {
            return @"{
                      devices{
                        id
                        config
                        gps_fixed
                        class
                      }
                    }";
        }
        public static string GetAdsb()
        {
            return @"{
  droneAdsB {
    support
    drone {
      id
      speed
      height
      latitude
      longitude
      yaw_angle
      confirmed
      registration
      typecode
      manufacturer
      model
      owner
    }
  }
}";
        }
        /// 
        /// 获取传感器状态
        /// 
        /// 
        public static string GetSensorStatus()
        {
            return @"{sensor {
              config,
              faults,
              id,
              mac,
              name,
              sensor_status {
                built_time
                component_type
                first_seen
                git_hash
                ip_address
                last_seen
                temperature
                version
              },
              state,
              ttl
            }}";
        }
        /// 
        /// 白名单
        /// 
        /// 
        public static string GetWhitelist()
        {
            return @"{whitelist{dronetype,id}}";
        }
        /// 
        /// 系统能力查询
        /// 
        /// 
        public static string GetSystemCapability()
        {
            return @"{sysCapability}";
        }
        /// 
        /// 获取宽带打击的频段
        /// 
        /// 
        public static string widebanJammer()
        {
            return @"{widebandJammer{
                                            band12
                                            band14
                                            band15
                                            band18
                                            band24
                                            band4
                                            band58
                                            band9}}";
        }
        /// 
        /// 添加白名单
        /// 
        /// 
        /// 
        /// 
        public static string AddWhitelist(string droneId, string droneType)
        {
            return "mutation{addWhitelist(id:\"" + droneId + "\"\ndronetype:\"" + droneType + "\"\ntimerange:\"permanent,permanent\")}";
        }
        /// 
        /// 删除白名单
        /// 
        /// 
        /// 
        /// 
        public static string DeleteWhitelist(string droneId)
        {
            return "mutation{deleteWhitelist(id:\"" + droneId + "\")}";
        }
        /// 
        /// 精确打击,flse开始,true停止
        /// 
        /// 
        /// 
        /// 
        public static string AccurateAttack(bool isAttack, string droneId)
        {
            string cmdstr = "mutation{ attack( cancel:true \n takeover:false \n id: \"" + droneId + "\"\n )}";
            if (isAttack)
            {
                cmdstr = "mutation{ attack( cancel:false \n takeover:false \n id: \"" + droneId + "\"\n )}";
            }
            else
            {
                cmdstr = "mutation{ attack( cancel:true \n takeover:false \n id: \"" + droneId + "\"\n )}";
            }
            return cmdstr;
        }
        /// 
        /// 自动打击
        /// 
        /// 
        /// 
        public static string AutoAttack(bool isAuto)
        {
            string cmdstr = "mutation{ autoAttack(   on: " + isAuto + " \n  wbEnabled: false ) }";
            if (isAuto)
            {
                cmdstr = "mutation{ autoAttack(   on:true \n   wbEnabled: false ) }";
            }
            else
            {
                cmdstr = "mutation{ autoAttack(   on:false \n   wbEnabled: false ) }";
            }
            return cmdstr.ToLower();
        }
        /// 
        /// 宽带打击
        /// 
        /// 15,24,58
        /// true,开启,false,关闭
        /// 
        public static string WidebandAttack(string band, bool status)
        {
            string cmdstr = "mutation{ wideband_attack( band: \"" + band + "\"\n wb_status:" + status + ")\n" +
        "{band15\nband24\nband58\nband9}}";
            return cmdstr.ToLower();
        }
    }
}