package com.lanyuanxiaoyao.service.cli.runner;

import com.lanyuanxiaoyao.service.cli.core.HostInfo;
import com.lanyuanxiaoyao.service.cli.core.RuntimeInfo;
import com.lanyuanxiaoyao.service.cli.core.ServiceInfo;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 配置
 *
 * @author lanyuanxiaoyao
 * @date 2023-05-17
 */
@Configuration
@ConfigurationProperties("deploy")
public class DeployInformationProperties {
    private Generate generate = new Generate();
    private Boolean shuffler = false;
    private RuntimeInfo runtime;
    private Map<String, HostInfo> hosts;
    private Map<String, ServiceInfo> services;

    public Generate getGenerate() {
        return generate;
    }

    public void setGenerate(Generate generate) {
        this.generate = generate;
    }

    public Boolean getShuffler() {
        return shuffler;
    }

    public void setShuffler(Boolean shuffler) {
        this.shuffler = shuffler;
    }

    public RuntimeInfo getRuntime() {
        return runtime;
    }

    public void setRuntime(RuntimeInfo runtime) {
        this.runtime = runtime;
    }

    public Map<String, HostInfo> getHosts() {
        return hosts;
    }

    public void setHosts(Map<String, HostInfo> hosts) {
        this.hosts = hosts;
    }

    public Map<String, ServiceInfo> getServices() {
        return services;
    }

    public void setServices(Map<String, ServiceInfo> services) {
        this.services = services;
    }

    @Override
    public String toString() {
        return "DeployInformationProperties{" +
               "generate=" + generate +
               ", shuffler=" + shuffler +
               ", runtime=" + runtime +
               ", hosts=" + hosts +
               ", services=" + services +
               '}';
    }

    public static final class Generate {
        private Boolean cloud = true;
        private Boolean command = true;

        public Boolean getCloud() {
            return cloud;
        }

        public void setCloud(Boolean cloud) {
            this.cloud = cloud;
        }

        public Boolean getCommand() {
            return command;
        }

        public void setCommand(Boolean command) {
            this.command = command;
        }

        @Override
        public String toString() {
            return "Generate{" +
                   "cloud=" + cloud +
                   ", command=" + command +
                   '}';
        }
    }
}
