package org.ssssssss.magicapi.rocketmq.model;


import org.ssssssss.magicapi.core.model.MagicEntity;
import org.ssssssss.magicapi.core.model.PathMagicEntity;

import java.util.Objects;

/**
 * @author zzy
 */
public class RocketMqInfo extends PathMagicEntity {

    /**
     * 主题
     */
    private String topic;

    /**
     * 标签
     */
    private String tag;


    /**
     * 是否启用
     */
    private boolean enabled;


    /**
     * 消息队列描述
     */
    private String description;


    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public RocketMqInfo copy() {
        RocketMqInfo info = new RocketMqInfo();
        super.copyTo(info);
        info.setTopic(this.topic);
        info.setTag(this.tag);
        info.setEnabled(this.enabled);
        info.setDescription(this.description);
        return info;
    }

    @Override
    public MagicEntity simple() {
        RocketMqInfo info = new RocketMqInfo();
        super.simple(info);
        return info;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        RocketMqInfo rocketMqInfo = (RocketMqInfo) o;
        return Objects.equals(id, rocketMqInfo.id) &&
                Objects.equals(path, rocketMqInfo.path) &&
                Objects.equals(script, rocketMqInfo.script) &&
                Objects.equals(name, rocketMqInfo.name) &&
                Objects.equals(topic, rocketMqInfo.topic) &&
                Objects.equals(tag, rocketMqInfo.tag) &&
                Objects.equals(description, rocketMqInfo.description) &&
                Objects.equals(enabled, rocketMqInfo.enabled);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, path, script, name, groupId, topic, tag, enabled, description);
    }
}
