package com.cf.imes.module.system.enums.advertisement;

import com.cf.imes.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 延迟消息状态单位态枚举
 *
 * @author 晨丰科技
 */
@Getter
@AllArgsConstructor
public enum MessageStatusEnum implements IntArrayValuable {

    PENDING(0, "待处理"),
    PROCESSED(1, "已处理"),
    CANCELLED(2, "已取消");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(MessageStatusEnum::getStatus).toArray();

    /**
     * 状态值
     */
    private final Integer status;
    /**
     * 状态名
     */
    private final String name;

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

    public static boolean isPending(String name) {
        return Objects.equals(PENDING.name, name);
    }

    public static boolean isProcessed(String name) {
        return Objects.equals(PROCESSED.name, name);
    }

    public static boolean isCancelled(String name) {
        return Objects.equals(CANCELLED.name, name);
    }


}
