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

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 ProductStatusEnum implements IntArrayValuable {


    PRODUCT_WAITING_UPDATES(0, "待上架"),
    PRODUCT_UPDATES(1, "已上架"),
    PRODUCT_DELIS(2, "已下架");

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

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

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

    public static boolean isProductWaitingUpdates(Integer status) {
        return Objects.equals(PRODUCT_WAITING_UPDATES.status, status);
    }

    public static boolean isProductUpdates(Integer status) {
        return Objects.equals(PRODUCT_UPDATES.status, status);
    }

    public static boolean isProductDelis(Integer status) {
        return Objects.equals(PRODUCT_DELIS.status, status);
    }
}
