package com.czg.account.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.List;

/**
 * 分店数据同步方式枚举
 *
 * @author tankaikai
 * @since 2025-04-03 16:53
 */
@Getter
@RequiredArgsConstructor
public enum BranchDataSyncMethodEnum {
    /**
     * 实时自动同步
     */
    AUTO("auto", "实时自动同步"),
    /**
     * 手动同步
     */
    MANUAL("manual", "手动同步");

    private final String value;
    private final String text;


    public static List<String> getValues() {
        return Arrays.stream(values()).map(BranchDataSyncMethodEnum::getValue).toList();
    }

    public static String getText(String value) {
        BranchDataSyncMethodEnum item = Arrays.stream(values()).filter(obj -> value.equals(obj.getValue())).findFirst().orElse(null);
        if (item != null) {
            return item.getText();
        }
        return null;
    }

    public static boolean checkValue(String value) {
        return getValues().contains(value);
    }

}
