package com.yunfeiyun.agmp.common.enums;

/**
 * 任务状态
 * @author liuyaowen
 * */
public enum CommonEnums {

    TASKREQTYPE_NORMAL("0", "常规农事任务"),
    TASKREQTYPE_PICK("1", "采收农事任务"),
    TASKREQTYPE_PATROL("2", "巡田农事任务"),
    TASKREQTYPE_WARN("3", "预警农事任务"),

    PREVIEW_LAND("landPreview", "基地预览图"),
    PREVIEW_BLOCK("blockPreview", "地块预览图"),
    PREVIEW_CROP("cropPreview", "作物图片"),
    PREVIEW_TASK("taskPreview", "农事任务图片"),
    PREVIEW_SUPPLY("supplyPreview", "供应商资质图片预览图"),

    RES_MEDIA_TYPE_PIC("1", "图片"),

    TASK_AUDIT_TYPE_DOWN("D", "下发农事任务"),
    TASK_AUDIT_TYPE_UP("S", "上报农事任务"),
    TASK_AUDIT_TYPE_LOG("R", "农事记录"),

    TASK_CREATE_TYPE_MOVE("M", "手动创建"),
    TASK_CREATE_TYPE_AUTO("A", "自动穿件"),

    PLAN_STATUS_NOT_START("0", "未开始"),
    PLAN_STATUS_START("1", "种植中"),
    PLAN_STATUS_END("2", "已结束"),

    PLAN_UPDATE_TYPE_START("0", "定时任务查询开始时间小于等于当前时间"),
    PLAN_UPDATE_TYPE_END("1", "定时任务查询结束时间小于等于当前时间"),

    PATTERN_DATETIME("yyyy-MM-dd HH:mm:ss", "时间"),
    PATTERN_DATE("yyyy-MM-dd", "日期"),

    SERIAL_PLAN("fmsPlanSerial", "种植规划"),
    SERIAL_TASK("fmsTaskSerial", "农事任务"),
    SERIAL_TASK_PICK("fmsTaskPickSerial", "农事采收任务"),

    SERIAL_PREFIX_PLAN("plan_no", "种植规划"),
    SERIAL_PREFIX_TASK("task_no", "农事任务"),
    SERIAL_PREFIX_TASK_PICK("pick_no", "农事采收任务"),

    DICT_STATUS_NORMAL("0", "正常"),
    DICT_STATUS_PAUSE("1", "暂停"),
    TASKRCD_AUDIT_CONTENT("", "登记任务，自动审核通过。"),
    GOOD_UNIT_KG("KG", "货物单位KG"),
    SOURCE_PERIOD_TYPE_PERIOD("0", "周期"),
    SOURCE_PERIOD_TYPE_RECORD("1", "农事记录"),
    FINISH_GOODS_TYPE_PICK("0", "采收产品"),
    FINISH_GOODS_TYPE_PROCESS("1", "加工产品"),
    FINISH_GOODS_TYPE_PACKAGE("2", "包装产品"),
    TASK_TYPE_PROCESS("1", "加工"),
    TASK_TYPE_PACKAGE("2", "包装"),
    SOURCE_INFO_TYPE_DEFAULT("0", "默认"),
    SOURCE_INFO_TYPE_CUSTOM("1", "自定义"),
    PICK_CHANGE_STATUS_NO("0", "否"),
    PICK_CHANGE_STATUS_YES("1", "是"),
    ;
    private final String code;
    private final String message;

    CommonEnums(String code, String message)
    {
        this.code = code;
        this.message = message;
    }

    public String getCode()
    {
        return code;
    }

    public String getMessage()
    {
        return message;
    }

    public boolean equal(String code){
        return this.code.equals(code);
    }

    public static String valueOfCode(String code){
        for(CommonEnums commonEnums: CommonEnums.values()) {
            if(commonEnums.equal(code)){
                return commonEnums.getMessage();
            }
        }
        return "";
    }
}
