package cd.casic.module.terminal.enums;

import cd.casic.module.terminal.common.GenericsDataModel;
import cd.casic.module.terminal.common.GenericsDataStrategy;
import cd.casic.module.terminal.common.GenericsStrategyDefinition;
import cd.casic.module.terminal.host.config.strategy.HostSshConfigStrategy;
import cn.orionsec.kit.lang.constant.Const;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * 主机配置类型枚举
 *
 * @author Jiahang Li
 * @version 1.0.0
 * @since 2023/9/11 14:37
 */
@Getter
@AllArgsConstructor
public enum HostTypeEnum implements GenericsStrategyDefinition {

    /**
     * SSH
     */
    SSH(HostSshConfigStrategy.class),

    ;

    private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;

    public static HostTypeEnum of(String type) {
        if (type == null) {
            return null;
        }
        for (HostTypeEnum value : values()) {
            if (value.name().equals(type)) {
                return value;
            }
        }
        return null;
    }

}
