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.extra.strategy.HostLabelExtraStrategy;
import cd.casic.module.terminal.host.extra.strategy.HostSpecExtraStrategy;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * 主机额外配置项枚举
 *
 * @author Jiahang Li
 * @version 1.0.0
 * @since 2023/12/20 22:48
 */
@Getter
@AllArgsConstructor
public enum HostExtraItemEnum implements GenericsStrategyDefinition {

    /**
     * SSH 额外配置
     */
//    SSH(HostSshExtraStrategy.class, true),

    /**
     * 标签额外配置
     */
    LABEL(HostLabelExtraStrategy.class, true),

    /**
     * 规格信息配置
     */
    SPEC(HostSpecExtraStrategy.class, false),

    ;

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

    private final boolean userExtra;

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

}
