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 ProviderTypeEnum implements ArrayValuable<String> {

    ALIYUN("aliyun", "阿里云"),
    TELECOM("telecom", "电信"),
    UNIPUSH("uniPush", "uniPush");

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


    private String code;
    private String msg;

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

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