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

import com.fasterxml.jackson.annotation.JsonAlias;

/**
 * Flink job config
 *
 * @author lanyuanxiaoyao
 * @date 2023-05-04
 */
public final class FlinkVertexConfig {
    private String jid;
    private String name;
    @JsonAlias("execution-config")
    private ExecutionConfig executionConfig;

    public String getJid() {
        return jid;
    }

    public String getName() {
        return name;
    }

    public ExecutionConfig getExecutionConfig() {
        return executionConfig;
    }

    @Override
    public String toString() {
        return "FlinkVertexConfig{" +
                "jid='" + jid + '\'' +
                ", name='" + name + '\'' +
                ", executionConfig=" + executionConfig +
                '}';
    }

    public static final class ExecutionConfig {
        @JsonAlias("execution-mode")
        private String executionMode;
        @JsonAlias("restart-strategy")
        private String restartStrategy;
        @JsonAlias("job-parallelism")
        private Integer jobParallelism;

        public String getExecutionMode() {
            return executionMode;
        }

        public String getRestartStrategy() {
            return restartStrategy;
        }

        public Integer getJobParallelism() {
            return jobParallelism;
        }

        @Override
        public String toString() {
            return "ExecutionConfig{" +
                    "executionMode='" + executionMode + '\'' +
                    ", restartStrategy='" + restartStrategy + '\'' +
                    ", jobParallelism=" + jobParallelism +
                    '}';
        }
    }
}
