package com.bonus.common.houqin.mq.rocket;

import org.apache.rocketmq.spring.autoconfigure.RocketMQProperties;
import org.redisson.api.RedissonClient;
import org.springframework.boot.autoconfigure.condition.AllNestedConditions;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

public class RocketProperties extends RocketMQProperties {
   private String accessKey;
   private String secretKey;
   private String topicTemplate = "DefaultCluster";
   private boolean mqttEnabled = true;

   public String getAccessKey() {
      return this.accessKey;
   }

   public String getSecretKey() {
      return this.secretKey;
   }

   public String getTopicTemplate() {
      return this.topicTemplate;
   }

   public boolean isMqttEnabled() {
      return this.mqttEnabled;
   }

   public void setAccessKey(final String accessKey) {
      this.accessKey = accessKey;
   }

   public void setSecretKey(final String secretKey) {
      this.secretKey = secretKey;
   }

   public void setTopicTemplate(final String topicTemplate) {
      this.topicTemplate = topicTemplate;
   }

   public void setMqttEnabled(final boolean mqttEnabled) {
      this.mqttEnabled = mqttEnabled;
   }

   public String toString() {
      String var10000 = this.getAccessKey();
      return "RocketProperties(accessKey=" + var10000 + ", secretKey=" + this.getSecretKey() + ", topicTemplate=" + this.getTopicTemplate() + ", mqttEnabled=" + this.isMqttEnabled() + ")";
   }

   public static class MqttEnabled extends AllNestedConditions {
      public MqttEnabled() {
         super(ConfigurationPhase.REGISTER_BEAN);
      }

      @ConditionalOnProperty(
         prefix = "spring.mq.rocketmq",
         value = {"mqtt-enabled"},
         havingValue = "true",
         matchIfMissing = true
      )
      @ConditionalOnClass({RedissonClient.class})
      static class FoundRocketEnabledProperty {
      }
   }
}
