package com.sckw.core.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.EnumSet;

/**
 * @author lfdc
 * @desc 车辆往来运单状态枚举
 * @date 2023-07-14 14:07:23
 */
@Getter
@AllArgsConstructor
public enum GatekeeperStatusEnum {

    /**
     * 待进场
     */
    PENDING_ENTRY(1,  "待进场",  "卸货待进场"),

    /**
     * 已进场
     */
    IN_YARD(5,  "已进场",  "卸货已进场"),

    /**
     * 待放行
     */
    PENDING_RELEASE(10, "待放行", "卸货待放行"),

    /**
     * 已放行
     */
    READY_RELEASE(15, "已放行", "卸货已放行"),

    /**
     * 已离场
     */
    EXITED(20, "已离场", "卸货已离场"),

    /**
     * 空载离场
     */
    EMPTY_EXITED(25, "空载离场", "空载离场"),


    /**
     * 取消
     */
    CANCEL(99, "取消","取消"),

    ;

    private final Integer code;

    private final String destination;

    private final String description;


    public static String getDesc(Integer status) {
        if (status == null) {
            return null;
        }
        for (GatekeeperStatusEnum forkliftStatusEnum : EnumSet.allOf(GatekeeperStatusEnum.class)) {
            if (forkliftStatusEnum.code.equals(status)) {
                return forkliftStatusEnum.destination;
            }
        }
        return null;
    }

    public static String getDescription(Integer status) {
        if (status == null) {
            return null;
        }
        for (GatekeeperStatusEnum forkliftStatusEnum : EnumSet.allOf(GatekeeperStatusEnum.class)) {
            if (forkliftStatusEnum.code.equals(status)) {
                return forkliftStatusEnum.description;
            }
        }
        return null;
    }

}
