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

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

import java.util.Arrays;

/**
 * @author caozehui
 * @data 2026-03-12
 */
@Getter
@AllArgsConstructor
public enum ChannelTypeEnum implements ArrayValuable<String> {
    SMS("sms", "短信"),
    EMAIL("email", "邮箱"),
    APP("app", "APP 推送"),;

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

    private final String code;
    private final String msg;



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

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