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

    DURATION(0, "时长"),
    OUTPUT(1, "产量");

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

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

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

    public static boolean isDURATION(Integer status) {
        return Objects.equals(DURATION.status, status);
    }

    public static boolean isOUTPUT(Integer status) {
        return Objects.equals(OUTPUT.status, status);
    }
}

