package com.ywt.mg.domain.models.enums;


/**
 * 检查单订单状态枚举
 */
public enum CheckListOrderStatusEnum {
//    状态，0-待支付、1-已支付、2-已领取、4-已回收、8-退款申请中、16-已退款、32-已过期

    Pending_Payment("待支付", 0),
    Already_Paid("已支付", 1),
    Has_Get("已领取", 2),
    Has_Recycle("已回收", 4),
    Pending_Refund("退款申请中", 8),
    Refund("已退款", 16),
    HaveExpired("已过期", 32);
    private final String displayName;

    private final int value;

    CheckListOrderStatusEnum(String displayName, int value) {
        this.displayName = displayName;
        this.value = value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public int getValue() {
        return value;
    }


    public static CheckListOrderStatusEnum valueOf(int value) {
        if ((HaveExpired.value & value) == HaveExpired.value) {
            return HaveExpired;
        }
        if ((Refund.value & value) == Refund.value) {
            return Refund;
        }
        if ((Pending_Refund.value & value) == Pending_Refund.value) {
            return Pending_Refund;
        }
        if ((Has_Recycle.value & value) == Has_Recycle.value) {
            return Has_Recycle;
        }
        if ((Has_Get.value & value) == Has_Get.value) {
            return Has_Get;
        }
        if ((Already_Paid.value & value) == Already_Paid.value) {
            return Already_Paid;
        }
        return Pending_Payment;
    }

}
