package com.lanyuanxiaoyao.service.configuration.entity.pulsar;

import java.util.List;
import java.util.Map;

/**
 * Pulsar Topic
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-28
 */
public class PulsarTopic {
    private String name;
    private State state;
    private String lastMessageId;
    private List<String> subscriptions;

    public PulsarTopic() {
    }

    public PulsarTopic(String name, State state, String lastMessageId, List<String> subscriptions) {
        this.name = name;
        this.state = state;
        this.lastMessageId = lastMessageId;
        this.subscriptions = subscriptions;
    }

    public String getName() {
        return name;
    }

    public State getState() {
        return state;
    }

    public String getLastMessageId() {
        return lastMessageId;
    }

    public List<String> getSubscriptions() {
        return subscriptions;
    }

    @Override
    public String toString() {
        return "PulsarTopic{" +
                "name='" + name + '\'' +
                ", state=" + state +
                ", lastMessageId='" + lastMessageId + '\'' +
                ", subscriptions=" + subscriptions +
                '}';
    }

    public static final class State {
        private Double messageRateIn;
        private Double messageRateOut;
        private Double messageThroughputIn;
        private Double messageThroughputOut;
        private Long byteInCounter;
        private Long byteOutCounter;
        private Long messageInCounter;
        private Long messageOutCounter;
        private Double averageMessageSize;
        private Boolean messageChunkPublished;
        private Long storageSize;
        private Long backlogSize;
        private Long offloadedStorageSize;
        private List<PublisherState> publishers;
        private Integer waitingPublishers;
        private Map<String, SubscriptionState> subscriptions;
        private Map<String, ReplicateState> replications;
        private String deduplicationStatus;
        private Long topicEpoch;

        public State() {
        }

        public State(Double messageRateIn, Double messageRateOut, Double messageThroughputIn, Double messageThroughputOut, Long byteInCounter, Long byteOutCounter, Long messageInCounter, Long messageOutCounter, Double averageMessageSize, Boolean messageChunkPublished, Long storageSize, Long backlogSize, Long offloadedStorageSize, List<PublisherState> publishers, Integer waitingPublishers, Map<String, SubscriptionState> subscriptions, Map<String, ReplicateState> replications, String deduplicationStatus, Long topicEpoch) {
            this.messageRateIn = messageRateIn;
            this.messageRateOut = messageRateOut;
            this.messageThroughputIn = messageThroughputIn;
            this.messageThroughputOut = messageThroughputOut;
            this.byteInCounter = byteInCounter;
            this.byteOutCounter = byteOutCounter;
            this.messageInCounter = messageInCounter;
            this.messageOutCounter = messageOutCounter;
            this.averageMessageSize = averageMessageSize;
            this.messageChunkPublished = messageChunkPublished;
            this.storageSize = storageSize;
            this.backlogSize = backlogSize;
            this.offloadedStorageSize = offloadedStorageSize;
            this.publishers = publishers;
            this.waitingPublishers = waitingPublishers;
            this.subscriptions = subscriptions;
            this.replications = replications;
            this.deduplicationStatus = deduplicationStatus;
            this.topicEpoch = topicEpoch;
        }

        public Double getMessageRateIn() {
            return messageRateIn;
        }

        public Double getMessageRateOut() {
            return messageRateOut;
        }

        public Double getMessageThroughputIn() {
            return messageThroughputIn;
        }

        public Double getMessageThroughputOut() {
            return messageThroughputOut;
        }

        public Long getByteInCounter() {
            return byteInCounter;
        }

        public Long getByteOutCounter() {
            return byteOutCounter;
        }

        public Long getMessageInCounter() {
            return messageInCounter;
        }

        public Long getMessageOutCounter() {
            return messageOutCounter;
        }

        public Double getAverageMessageSize() {
            return averageMessageSize;
        }

        public Boolean isMessageChunkPublished() {
            return messageChunkPublished;
        }

        public Long getStorageSize() {
            return storageSize;
        }

        public Long getBacklogSize() {
            return backlogSize;
        }

        public Long getOffloadedStorageSize() {
            return offloadedStorageSize;
        }

        public List<PublisherState> getPublishers() {
            return publishers;
        }

        public Integer getWaitingPublishers() {
            return waitingPublishers;
        }

        public Map<String, SubscriptionState> getSubscriptions() {
            return subscriptions;
        }

        public Map<String, ReplicateState> getReplications() {
            return replications;
        }

        public String getDeduplicationStatus() {
            return deduplicationStatus;
        }

        public Long getTopicEpoch() {
            return topicEpoch;
        }

        @Override
        public String toString() {
            return "State{" +
                    "messageRateIn=" + messageRateIn +
                    ", messageRateOut=" + messageRateOut +
                    ", messageThroughputIn=" + messageThroughputIn +
                    ", messageThroughputOut=" + messageThroughputOut +
                    ", byteInCounter=" + byteInCounter +
                    ", byteOutCounter=" + byteOutCounter +
                    ", messageInCounter=" + messageInCounter +
                    ", messageOutCounter=" + messageOutCounter +
                    ", averageMessageSize=" + averageMessageSize +
                    ", messageChunkPublished=" + messageChunkPublished +
                    ", storageSize=" + storageSize +
                    ", backlogSize=" + backlogSize +
                    ", offloadedStorageSize=" + offloadedStorageSize +
                    ", publishers=" + publishers +
                    ", waitingPublishers=" + waitingPublishers +
                    ", subscriptions=" + subscriptions +
                    ", replications=" + replications +
                    ", deduplicationStatus='" + deduplicationStatus + '\'' +
                    ", topicEpoch=" + topicEpoch +
                    '}';
        }

        public static final class PublisherState {
            private String accessMode;
            private Double messageRateIn;
            private Double messageThroughputIn;
            private Double averageMessageSize;
            private Double chunkedMessageRate;
            private Long producerId;
            private String producerName;
            private String address;
            private String connectedSince;
            private String clientVersion;
            private Map<String, String> metadata;

            public PublisherState() {
            }

            public PublisherState(String accessMode, Double messageRateIn, Double messageThroughputIn, Double averageMessageSize, Double chunkedMessageRate, Long producerId, String producerName, String address, String connectedSince, String clientVersion, Map<String, String> metadata) {
                this.accessMode = accessMode;
                this.messageRateIn = messageRateIn;
                this.messageThroughputIn = messageThroughputIn;
                this.averageMessageSize = averageMessageSize;
                this.chunkedMessageRate = chunkedMessageRate;
                this.producerId = producerId;
                this.producerName = producerName;
                this.address = address;
                this.connectedSince = connectedSince;
                this.clientVersion = clientVersion;
                this.metadata = metadata;
            }

            public String getAccessMode() {
                return accessMode;
            }

            public Double getMessageRateIn() {
                return messageRateIn;
            }

            public Double getMessageThroughputIn() {
                return messageThroughputIn;
            }

            public Double getAverageMessageSize() {
                return averageMessageSize;
            }

            public Double getChunkedMessageRate() {
                return chunkedMessageRate;
            }

            public Long getProducerId() {
                return producerId;
            }

            public String getProducerName() {
                return producerName;
            }

            public String getAddress() {
                return address;
            }

            public String getConnectedSince() {
                return connectedSince;
            }

            public String getClientVersion() {
                return clientVersion;
            }

            public Map<String, String> getMetadata() {
                return metadata;
            }

            @Override
            public String toString() {
                return "PublisherState{" +
                        "accessMode='" + accessMode + '\'' +
                        ", messageRateIn=" + messageRateIn +
                        ", messageThroughputIn=" + messageThroughputIn +
                        ", averageMessageSize=" + averageMessageSize +
                        ", chunkedMessageRate=" + chunkedMessageRate +
                        ", producerId=" + producerId +
                        ", producerName='" + producerName + '\'' +
                        ", address='" + address + '\'' +
                        ", connectedSince='" + connectedSince + '\'' +
                        ", clientVersion='" + clientVersion + '\'' +
                        ", metadata=" + metadata +
                        '}';
            }
        }

        public static final class SubscriptionState {
            Double messageRateOut;
            Double messageThroughputOut;
            Long bytesOutCounter;
            Long messageOutCounter;
            Double messageRateRedeliver;
            Integer chunkedMessageRate;
            Long messageBacklog;
            Long backlogSize;
            Long messageBacklogNoDelayed;
            Boolean blockedSubscriptionOnUnackedMessages;
            Long messageDelayed;
            Long unackedMessages;
            String type;
            String activeConsumerName;
            Double messageRateExpired;
            Long totalMessageExpired;
            Long lastExpireTimestamp;
            Long lastConsumedFlowTimestamp;
            Long lastConsumedTimestamp;
            Long lastAckedTimestamp;
            Long lastMarkDeleteAdvancedTimestamp;
            List<ConsumerState> consumers;
            Boolean durable;
            Boolean replicated;
            Map<String, String> consumersAfterMarkDeletePosition;

            public SubscriptionState() {
            }

            public SubscriptionState(Double messageRateOut, Double messageThroughputOut, Long bytesOutCounter, Long messageOutCounter, Double messageRateRedeliver, Integer chunkedMessageRate, Long messageBacklog, Long backlogSize, Long messageBacklogNoDelayed, Boolean blockedSubscriptionOnUnackedMessages, Long messageDelayed, Long unackedMessages, String type, String activeConsumerName, Double messageRateExpired, Long totalMessageExpired, Long lastExpireTimestamp, Long lastConsumedFlowTimestamp, Long lastConsumedTimestamp, Long lastAckedTimestamp, Long lastMarkDeleteAdvancedTimestamp, List<ConsumerState> consumers, Boolean durable, Boolean replicated, Map<String, String> consumersAfterMarkDeletePosition) {
                this.messageRateOut = messageRateOut;
                this.messageThroughputOut = messageThroughputOut;
                this.bytesOutCounter = bytesOutCounter;
                this.messageOutCounter = messageOutCounter;
                this.messageRateRedeliver = messageRateRedeliver;
                this.chunkedMessageRate = chunkedMessageRate;
                this.messageBacklog = messageBacklog;
                this.backlogSize = backlogSize;
                this.messageBacklogNoDelayed = messageBacklogNoDelayed;
                this.blockedSubscriptionOnUnackedMessages = blockedSubscriptionOnUnackedMessages;
                this.messageDelayed = messageDelayed;
                this.unackedMessages = unackedMessages;
                this.type = type;
                this.activeConsumerName = activeConsumerName;
                this.messageRateExpired = messageRateExpired;
                this.totalMessageExpired = totalMessageExpired;
                this.lastExpireTimestamp = lastExpireTimestamp;
                this.lastConsumedFlowTimestamp = lastConsumedFlowTimestamp;
                this.lastConsumedTimestamp = lastConsumedTimestamp;
                this.lastAckedTimestamp = lastAckedTimestamp;
                this.lastMarkDeleteAdvancedTimestamp = lastMarkDeleteAdvancedTimestamp;
                this.consumers = consumers;
                this.durable = durable;
                this.replicated = replicated;
                this.consumersAfterMarkDeletePosition = consumersAfterMarkDeletePosition;
            }

            public Double getMessageRateOut() {
                return messageRateOut;
            }

            public Double getMessageThroughputOut() {
                return messageThroughputOut;
            }

            public Long getBytesOutCounter() {
                return bytesOutCounter;
            }

            public Long getMessageOutCounter() {
                return messageOutCounter;
            }

            public Double getMessageRateRedeliver() {
                return messageRateRedeliver;
            }

            public Integer getChunkedMessageRate() {
                return chunkedMessageRate;
            }

            public Long getMessageBacklog() {
                return messageBacklog;
            }

            public Long getBacklogSize() {
                return backlogSize;
            }

            public Long getMessageBacklogNoDelayed() {
                return messageBacklogNoDelayed;
            }

            public Boolean isBlockedSubscriptionOnUnackedMessages() {
                return blockedSubscriptionOnUnackedMessages;
            }

            public Long getMessageDelayed() {
                return messageDelayed;
            }

            public Long getUnackedMessages() {
                return unackedMessages;
            }

            public String getType() {
                return type;
            }

            public String getActiveConsumerName() {
                return activeConsumerName;
            }

            public Double getMessageRateExpired() {
                return messageRateExpired;
            }

            public Long getTotalMessageExpired() {
                return totalMessageExpired;
            }

            public Long getLastExpireTimestamp() {
                return lastExpireTimestamp;
            }

            public Long getLastConsumedFlowTimestamp() {
                return lastConsumedFlowTimestamp;
            }

            public Long getLastConsumedTimestamp() {
                return lastConsumedTimestamp;
            }

            public Long getLastAckedTimestamp() {
                return lastAckedTimestamp;
            }

            public Long getLastMarkDeleteAdvancedTimestamp() {
                return lastMarkDeleteAdvancedTimestamp;
            }

            public List<ConsumerState> getConsumers() {
                return consumers;
            }

            public Boolean isDurable() {
                return durable;
            }

            public Boolean isReplicated() {
                return replicated;
            }

            public Map<String, String> getConsumersAfterMarkDeletePosition() {
                return consumersAfterMarkDeletePosition;
            }

            @Override
            public String toString() {
                return "SubscriptionState{" +
                        "messageRateOut=" + messageRateOut +
                        ", messageThroughputOut=" + messageThroughputOut +
                        ", bytesOutCounter=" + bytesOutCounter +
                        ", messageOutCounter=" + messageOutCounter +
                        ", messageRateRedeliver=" + messageRateRedeliver +
                        ", chunkedMessageRate=" + chunkedMessageRate +
                        ", messageBacklog=" + messageBacklog +
                        ", backlogSize=" + backlogSize +
                        ", messageBacklogNoDelayed=" + messageBacklogNoDelayed +
                        ", blockedSubscriptionOnUnackedMessages=" + blockedSubscriptionOnUnackedMessages +
                        ", messageDelayed=" + messageDelayed +
                        ", unackedMessages=" + unackedMessages +
                        ", type='" + type + '\'' +
                        ", activeConsumerName='" + activeConsumerName + '\'' +
                        ", messageRateExpired=" + messageRateExpired +
                        ", totalMessageExpired=" + totalMessageExpired +
                        ", lastExpireTimestamp=" + lastExpireTimestamp +
                        ", lastConsumedFlowTimestamp=" + lastConsumedFlowTimestamp +
                        ", lastConsumedTimestamp=" + lastConsumedTimestamp +
                        ", lastAckedTimestamp=" + lastAckedTimestamp +
                        ", lastMarkDeleteAdvancedTimestamp=" + lastMarkDeleteAdvancedTimestamp +
                        ", consumers=" + consumers +
                        ", durable=" + durable +
                        ", replicated=" + replicated +
                        ", consumersAfterMarkDeletePosition=" + consumersAfterMarkDeletePosition +
                        '}';
            }
        }

        public static final class ConsumerState {
            Double messageRateOut;
            Double messageThroughputOut;
            Long bytesOutCounter;
            Long messageOutCounter;
            Double messageRateRedeliver;
            Double chunkedMessageRate;
            String consumerName;
            Integer availablePermits;
            Integer unackedMessages;
            Integer averageMessagesPerEntry;
            Boolean blockedConsumerOnUnackedMessages;
            String readPositionWhenJoining;
            String address;
            String connectedSince;
            String clientVersion;
            Long lastAckedTimestamp;
            Long lastConsumedTimestamp;
            List<String> keyHashRanges;
            Map<String, String> metadata;

            public ConsumerState() {
            }

            public ConsumerState(Double messageRateOut, Double messageThroughputOut, Long bytesOutCounter, Long messageOutCounter, Double messageRateRedeliver, Double chunkedMessageRate, String consumerName, Integer availablePermits, Integer unackedMessages, Integer averageMessagesPerEntry, Boolean blockedConsumerOnUnackedMessages, String readPositionWhenJoining, String address, String connectedSince, String clientVersion, Long lastAckedTimestamp, Long lastConsumedTimestamp, List<String> keyHashRanges, Map<String, String> metadata) {
                this.messageRateOut = messageRateOut;
                this.messageThroughputOut = messageThroughputOut;
                this.bytesOutCounter = bytesOutCounter;
                this.messageOutCounter = messageOutCounter;
                this.messageRateRedeliver = messageRateRedeliver;
                this.chunkedMessageRate = chunkedMessageRate;
                this.consumerName = consumerName;
                this.availablePermits = availablePermits;
                this.unackedMessages = unackedMessages;
                this.averageMessagesPerEntry = averageMessagesPerEntry;
                this.blockedConsumerOnUnackedMessages = blockedConsumerOnUnackedMessages;
                this.readPositionWhenJoining = readPositionWhenJoining;
                this.address = address;
                this.connectedSince = connectedSince;
                this.clientVersion = clientVersion;
                this.lastAckedTimestamp = lastAckedTimestamp;
                this.lastConsumedTimestamp = lastConsumedTimestamp;
                this.keyHashRanges = keyHashRanges;
                this.metadata = metadata;
            }

            public Double getMessageRateOut() {
                return messageRateOut;
            }

            public Double getMessageThroughputOut() {
                return messageThroughputOut;
            }

            public Long getBytesOutCounter() {
                return bytesOutCounter;
            }

            public Long getMessageOutCounter() {
                return messageOutCounter;
            }

            public Double getMessageRateRedeliver() {
                return messageRateRedeliver;
            }

            public Double getChunkedMessageRate() {
                return chunkedMessageRate;
            }

            public String getConsumerName() {
                return consumerName;
            }

            public Integer getAvailablePermits() {
                return availablePermits;
            }

            public Integer getUnackedMessages() {
                return unackedMessages;
            }

            public Integer getAverageMessagesPerEntry() {
                return averageMessagesPerEntry;
            }

            public Boolean isBlockedConsumerOnUnackedMessages() {
                return blockedConsumerOnUnackedMessages;
            }

            public String getReadPositionWhenJoining() {
                return readPositionWhenJoining;
            }

            public String getAddress() {
                return address;
            }

            public String getConnectedSince() {
                return connectedSince;
            }

            public String getClientVersion() {
                return clientVersion;
            }

            public Long getLastAckedTimestamp() {
                return lastAckedTimestamp;
            }

            public Long getLastConsumedTimestamp() {
                return lastConsumedTimestamp;
            }

            public List<String> getKeyHashRanges() {
                return keyHashRanges;
            }

            public Map<String, String> getMetadata() {
                return metadata;
            }

            @Override
            public String toString() {
                return "ConsumerState{" +
                        "messageRateOut=" + messageRateOut +
                        ", messageThroughputOut=" + messageThroughputOut +
                        ", bytesOutCounter=" + bytesOutCounter +
                        ", messageOutCounter=" + messageOutCounter +
                        ", messageRateRedeliver=" + messageRateRedeliver +
                        ", chunkedMessageRate=" + chunkedMessageRate +
                        ", consumerName='" + consumerName + '\'' +
                        ", availablePermits=" + availablePermits +
                        ", unackedMessages=" + unackedMessages +
                        ", averageMessagesPerEntry=" + averageMessagesPerEntry +
                        ", blockedConsumerOnUnackedMessages=" + blockedConsumerOnUnackedMessages +
                        ", readPositionWhenJoining='" + readPositionWhenJoining + '\'' +
                        ", address='" + address + '\'' +
                        ", connectedSince='" + connectedSince + '\'' +
                        ", clientVersion='" + clientVersion + '\'' +
                        ", lastAckedTimestamp=" + lastAckedTimestamp +
                        ", lastConsumedTimestamp=" + lastConsumedTimestamp +
                        ", keyHashRanges=" + keyHashRanges +
                        ", metadata=" + metadata +
                        '}';
            }
        }

        public static final class ReplicateState {
            private Double messageRateIn;
            private Double messageRateOut;
            private Double messageThroughputIn;
            private Double messageThroughputOut;
            private Double messageExpiredRate;
            private Long replicationBacklog;
            private Boolean connected;
            private Long replicationDelayInSeconds;
            private String inboundConnection;
            private String inboundConnectedSince;
            private String outboundConnection;
            private String outboundConnectedSince;

            public ReplicateState() {
            }

            public ReplicateState(Double messageRateIn, Double messageRateOut, Double messageThroughputIn, Double messageThroughputOut, Double messageExpiredRate, Long replicationBacklog, Boolean connected, Long replicationDelayInSeconds, String inboundConnection, String inboundConnectedSince, String outboundConnection, String outboundConnectedSince) {
                this.messageRateIn = messageRateIn;
                this.messageRateOut = messageRateOut;
                this.messageThroughputIn = messageThroughputIn;
                this.messageThroughputOut = messageThroughputOut;
                this.messageExpiredRate = messageExpiredRate;
                this.replicationBacklog = replicationBacklog;
                this.connected = connected;
                this.replicationDelayInSeconds = replicationDelayInSeconds;
                this.inboundConnection = inboundConnection;
                this.inboundConnectedSince = inboundConnectedSince;
                this.outboundConnection = outboundConnection;
                this.outboundConnectedSince = outboundConnectedSince;
            }

            public Double getMessageRateIn() {
                return messageRateIn;
            }

            public Double getMessageRateOut() {
                return messageRateOut;
            }

            public Double getMessageThroughputIn() {
                return messageThroughputIn;
            }

            public Double getMessageThroughputOut() {
                return messageThroughputOut;
            }

            public Double getMessageExpiredRate() {
                return messageExpiredRate;
            }

            public Long getReplicationBacklog() {
                return replicationBacklog;
            }

            public Boolean isConnected() {
                return connected;
            }

            public Long getReplicationDelayInSeconds() {
                return replicationDelayInSeconds;
            }

            public String getInboundConnection() {
                return inboundConnection;
            }

            public String getInboundConnectedSince() {
                return inboundConnectedSince;
            }

            public String getOutboundConnection() {
                return outboundConnection;
            }

            public String getOutboundConnectedSince() {
                return outboundConnectedSince;
            }

            @Override
            public String toString() {
                return "ReplicateState{" +
                        "messageRateIn=" + messageRateIn +
                        ", messageRateOut=" + messageRateOut +
                        ", messageThroughputIn=" + messageThroughputIn +
                        ", messageThroughputOut=" + messageThroughputOut +
                        ", messageExpiredRate=" + messageExpiredRate +
                        ", replicationBacklog=" + replicationBacklog +
                        ", isConnected=" + connected +
                        ", replicationDelayInSeconds=" + replicationDelayInSeconds +
                        ", inboundConnection='" + inboundConnection + '\'' +
                        ", inboundConnectedSince='" + inboundConnectedSince + '\'' +
                        ", outboundConnection='" + outboundConnection + '\'' +
                        ", outboundConnectedSince='" + outboundConnectedSince + '\'' +
                        '}';
            }
        }
    }
}
