package com.usky.rule.enums;

import java.util.Objects;

public enum ConstraintTypeEnum {
    CRON("cron"),
    DEVICE("device");

    private final String type;

    private ConstraintTypeEnum(String type) {
        this.type = type;
    }

    public static ConstraintTypeEnum getTypeEnum(String type) {
        for(ConstraintTypeEnum typeEnum : values()) {
            if (Objects.equals(typeEnum.getType(), type)) {
                return typeEnum;
            }
        }

        return null;
    }

    public String getType() {
        return this.type;
    }
}