package com.lutao.cloud.iot.mqtt.core.server.model.model;

import java.io.Serializable;
import java.util.Objects;

/**
 * 订阅模型，用于存储
 *

 */
public class Subscribe implements Serializable {
	private String topicFilter;
	private String clientId;
	private int mqttQoS;

	public Subscribe() {
	}

	public Subscribe(String clientId, int mqttQoS) {
		this.clientId = clientId;
		this.mqttQoS = mqttQoS;
	}

	public Subscribe(String topicFilter, String clientId, int mqttQoS) {
		this.topicFilter = topicFilter;
		this.clientId = clientId;
		this.mqttQoS = mqttQoS;
	}

	public String getTopicFilter() {
		return topicFilter;
	}

	public void setTopicFilter(String topicFilter) {
		this.topicFilter = topicFilter;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public int getMqttQoS() {
		return mqttQoS;
	}

	public void setMqttQoS(int mqttQoS) {
		this.mqttQoS = mqttQoS;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Subscribe)) {
			return false;
		}
		Subscribe subscribe = (Subscribe) o;
		return Objects.equals(topicFilter, subscribe.topicFilter) &&
			Objects.equals(clientId, subscribe.clientId);
	}

	@Override
	public int hashCode() {
		return Objects.hash(topicFilter, clientId);
	}

	@Override
	public String toString() {
		return "Subscribe{" +
			"topicFilter='" + topicFilter + '\'' +
			", clientId='" + clientId + '\'' +
			", mqttQoS=" + mqttQoS +
			'}';
	}
}
