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

import com.fasterxml.jackson.annotation.JsonAlias;
import org.eclipse.collections.api.map.ImmutableMap;

/**
 * Flink checkpoint
 *
 * @author lanyuanxiaoyao
 * @date 2023-05-04
 */
public final class FlinkCheckpoint {
    private Long id;
    private String status;
    @JsonAlias("is_savepoint")
    private boolean savePoint;
    @JsonAlias("trigger_timestamp")
    private Long triggerTimestamp;
    @JsonAlias("latest_ack_timestamp")
    private Long latestAckTimestamp;
    @JsonAlias("state_size")
    private Long stateSize;
    @JsonAlias("end_to_end_duration")
    private Long endToEndDuration;
    @JsonAlias("alignment_buffered")
    private Long alignmentBuffered;
    @JsonAlias("processed_data")
    private Long processedData;
    @JsonAlias("persisted_data")
    private Long persistedData;
    @JsonAlias("num_subtasks")
    private Long numSubtasks;
    @JsonAlias("num_acknowledged_subtasks")
    private Long numAcknowledgedSubtasks;
    @JsonAlias("checkpoint_type")
    private String checkpointType;
    private ImmutableMap<String, FlinkCheckpoint> tasks;
    @JsonAlias("external_path")
    private String externalPath;
    private boolean discarded;

    public Long getId() {
        return id;
    }

    public String getStatus() {
        return status;
    }

    public boolean isSavePoint() {
        return savePoint;
    }

    public Long getTriggerTimestamp() {
        return triggerTimestamp;
    }

    public Long getLatestAckTimestamp() {
        return latestAckTimestamp;
    }

    public Long getStateSize() {
        return stateSize;
    }

    public Long getEndToEndDuration() {
        return endToEndDuration;
    }

    public Long getAlignmentBuffered() {
        return alignmentBuffered;
    }

    public Long getProcessedData() {
        return processedData;
    }

    public Long getPersistedData() {
        return persistedData;
    }

    public Long getNumSubtasks() {
        return numSubtasks;
    }

    public Long getNumAcknowledgedSubtasks() {
        return numAcknowledgedSubtasks;
    }

    public String getCheckpointType() {
        return checkpointType;
    }

    public ImmutableMap<String, FlinkCheckpoint> getTasks() {
        return tasks;
    }

    public String getExternalPath() {
        return externalPath;
    }

    public boolean isDiscarded() {
        return discarded;
    }

    @Override
    public String toString() {
        return "FlinkCheckpoint{" +
                "id=" + id +
                ", status='" + status + '\'' +
                ", savePoint=" + savePoint +
                ", triggerTimestamp=" + triggerTimestamp +
                ", latestAckTimestamp=" + latestAckTimestamp +
                ", stateSize=" + stateSize +
                ", endToEndDuration=" + endToEndDuration +
                ", alignmentBuffered=" + alignmentBuffered +
                ", processedData=" + processedData +
                ", persistedData=" + persistedData +
                ", numSubtasks=" + numSubtasks +
                ", numAcknowledgedSubtasks=" + numAcknowledgedSubtasks +
                ", checkpointType='" + checkpointType + '\'' +
                ", tasks=" + tasks +
                ", externalPath='" + externalPath + '\'' +
                ", discarded=" + discarded +
                '}';
    }
}
