package com.yc.ship.module.resource.enums;

import cn.hutool.core.util.ObjUtil;
import com.yc.ship.framework.common.core.IntArrayValuable;

import java.util.Arrays;

public enum CarStatusEnum implements IntArrayValuable {

    //车辆状态（0:正常、1:维修中、2:年检、3:停运）
    ENABLE(0, "正常"),
    IN_MAINTENANCE(1, "维修中"),
    ANNUAL_INSPECTION(2, "年检"),
    OFF_LINE(3, "停运");


    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CarStatusEnum::getStatus).toArray();
    private final Integer status;
    private final String name;

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

    public static boolean isEnable(Integer status) {
        return ObjUtil.equal(ENABLE.status, status);
    }

    public Integer getStatus() {
        return this.status;
    }

    public String getName() {
        return this.name;
    }

    private CarStatusEnum(Integer status, String name) {
        this.status = status;
        this.name = name;
    }
}
