package com.keystar.plane.inspection.enums;

import lombok.Getter;

public enum NestStatusEnum {

    INIT("INIT", "初始化"),

    SELF_TEST("SELF_TEST", "自检中"),

    WAIT_RESET("WAIT_RESET", "等待重置"),

    RESETTING("RESETTING", "重置中"),

    STANDBY("STANDBY", "待机"),

    PREPARING("PREPARING", "启动中"),

    READY_TO_GO("READY_TO_GO", "准备起飞"),

    TAKE_OFF("TAKE_OFF","起飞中"),

    EXECUTING("EXECUTING", "任务执行中"),

    GOING_HOME("GOING_HOME", "返航"),

    LANDING("LANDING", "着陆中"),

    RECOVERING("RECOVERING", "回收中"),

    BATTERY_LOADING("BATTERY_LOADING", "电池装载中"),

    BATTERY_UNLOADING("BATTERY_UNLOADING", "电池卸载中"),

    BATTERY_LOADED("BATTERY_LOADED", "电池已装载"),

    BATTERY_REPLACING("BATTERY_REPLACING", "电池替换中"),

    OPERATING("OPERATING", "操作中"),

    OPEN_WITHOUT_BATTERY("OPEN_WITHOUT_BATTERY", "未装载开启模式"),

    SYS_SUSPEND("SYS_SUSPEND", "系统挂起"),

    ERROR("ERROR", "状态错误"),

    DEBUG("DEBUG", "调试模式"),

    DRONE_POWER_ON_DOING("DRONE_POWER_ON_DOING", "无人机开关机进行中"),

    DRONE_PAIRING_DOING("DRONE_PAIRING_DOING", "无人机对频进行中"),

    BOOTLOADER_IDLE("BOOTLOADER_IDLE", "MPS固件更新初始化"),

    BOOTLOADER_WAITING_FOR_UPGRADE_CMD("BOOTLOADER_WAITING_FOR_UPGRADE_CMD", "MPS等待固件更新指令"),

    BOOTLOADER_PREPARE_TO_RECEIVE_FW("BOOTLOADER_PREPARE_TO_RECEIVE_FW", "MPS准备接收固件数据"),

    BOOTLOADER_RECEIVING_FM("BOOTLOADER_RECEIVING_FM", "MPS正在接收固件数据"),

    BOOTLOADER_FINISH_RECEIVE_FW("BOOTLOADER_FINISH_RECEIVE_FW", "MPS固件数据接收完成"),

    BOOTLOADER_UPGRADING("BOOTLOADER_UPGRADING", "MPS正在更新固件"),

    BOOTLOADER_UPGRADED("BOOTLOADER_UPGRADED", "MPS固件更新完成"),

    BOOTLOADER_MAIN_PROGRAM_LAUNCHING("BOOTLOADER_MAIN_PROGRAM_LAUNCHING", "MPS正在启动"),

    BOOTLOADER_ENTERING_MPS_FW_UPGRADE_MODE("BOOTLOADER_ENTERING_MPS_FW_UPGRADE_MODE", "MPS正在进入固件更新模式"),

    BOOTLOADER_UPGRADE_ERR("BOOTLOADER_UPGRADE_ERR", "MPS固件更新异常"),

    CONNECTING("CONNECTING", "MPS连接中"),

    DISCONNECTED("DISCONNECTED", "MPS未连接"),

    /**
     *  文档上没有的状态
     **/
    DRONE_STARTED("DRONE_STARTED", "无人机已准备");


    @Getter
    private final String code;

    @Getter
    private final String name;

    NestStatusEnum(String code, String name){
        this.code=code;
        this.name=name;
    }


    /**
     *  根据code获取机巢的状态
     **/
    public static NestStatusEnum getNameByCode(String code){
        for (NestStatusEnum statusEnum : NestStatusEnum.values()){
            if (statusEnum.getCode().equals(code)){
                return statusEnum;
            }
        }
        return null;
    }

}
