package com.ruoyi.bst.device.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author wjh
 * 2024/7/17
 */
@Getter
@AllArgsConstructor
public enum DeviceTimeUnit {

    DAY("1", 86400L),
    HOUR("2", 3600L),
    MINUTE("3", 60L),
    SECOND("4", 1L);

    private final String value;
    private final Long conversion;

    public static DeviceTimeUnit getByValue(String value) {
        for (DeviceTimeUnit device : DeviceTimeUnit.values()) {
            if (Objects.equals(device.getValue(), value)) {
                return device;
            }
        }
        return null;
    }

}
