package com.njcn.msgpush.module.push.enums;

import cn.hutool.core.util.ArrayUtil;
import com.njcn.msgpush.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author caozehui
 * @data 2026-03-12
 */
@Getter
@AllArgsConstructor
public enum BlacklistSourceEnum implements ArrayValuable<String> {
    MANUAL("manual", "手动"),
    AUTO("auto", "自动"),
    IMPORT("import", "导入");

    public static final String[] ARRAYS = Arrays.stream(values()).map(BlacklistSourceEnum::getCode).toArray(String[]::new);


    private String code;
    private String msg;

    @Override
    public String[] array() {
        return ARRAYS;
    }

    public static BlacklistSourceEnum getByCode(String code) {
        return ArrayUtil.firstMatch(blacklistSourceEnum -> blacklistSourceEnum.getCode().equals(code), values());
    }
}
