package ru.soune.nocopy.dto.file;

import lombok.Getter;

@Getter
public enum SortOrder {
    ASC("asc"),
    DESC("desc");

    private final String value;

    SortOrder(String value) {
        this.value = value;
    }

    public static SortOrder fromString(String value) {
        if (value == null) return ASC;
        for (SortOrder order : SortOrder.values()) {
            if (order.value.equalsIgnoreCase(value)) {
                return order;
            }
        }
        return ASC;
    }
}
