package com.sckw.core.common.enums.enums;

import lombok.Getter;

/**
 *Author: donglang
 *Time: 2025-10-09
 *Description: 平台异常编码枚举,统一管理系统中的错误码和描述
 *Version: 1.0
 */
@Getter
public enum ErrorCodeEnum {

    // ====================== 通用错误（10000~19999）======================
    SYSTEM_ERROR("100000", "系统内部错误"),
    PARAM_ERROR("100001", "参数校验失败"),
    RESOURCE_NOT_FOUND("100002", "资源不存在"),
    PERMISSION_DENIED("100003", "权限不足"),
    NETWORK_ERROR("100004", "网络连接异常"),
    DB_OPERATE_FAIL("100005", "数据库操作异常"),
    DATA_NOT_EXIST("100006", "数据查询结果不存在"),

    // ====================== 设备相关错误（20000~29999）======================
    DEVICE_OFFLINE("200000", "设备离线"),
    DEVICE_ALREADY_EXIST("200001", "设备已存在"),
    DEVICE_NOT_REGISTERED("200002", "设备未注册"),
    DEVICE_DATA_FORMAT_ERROR("200003", "设备数据格式错误"),
    DEVICE_COMMAND_TIMEOUT("200004", "设备指令发送超时"),

    // ====================== 接口相关错误（30000~39999）======================
    INTERFACE_CALL_FAIL("300000", "第三方接口调用失败"),
    INTERFACE_PARAM_MISMATCH("300001", "接口参数不匹配"),
    ILLEGAL_PARAM("300002", "非法参数"),
    TOKEN_EXPIRED("300003", "令牌已过期"),
    TOKEN_INVALID("300004", "令牌无效"),
    REPEAT_SUBMIT("300005", "重复提交"),

    // ====================== 数据存储错误（40000~49999）======================
    DATA_SAVE_FAIL("400000", "数据保存失败"),
    DATA_UPDATE_FAIL("400001", "数据更新失败"),
    DATA_DELETE_FAIL("400002", "数据删除失败"),
    DB_CONNECTION_ERROR("400003", "数据库连接异常"),

    // ====================== 数据导出/导入错误（50000~59999）======================
    DATA_IMPORT("500000", "数据导入失败"),
    DATA_EXPORT("500001", "数据导出失败"),


    // ====================== 交易订单（60000~69999）======================
    TRADE_ORDER_NOT_FOUND("600000", "交易订单数据不存在"),
    TRADE_ORDER_STATUS_ERROR("600001", "交易订单状态异常"),
    TRADE_ORDER_NOT_ENT("600002", "交易订单无关联企业信息"),
    TRADE_ORDER_AMOUNT_ERROR("70005", "交易订单的总运单量异常"),


    // ====================== 物流订单（70000~79999）======================
    LOGISTICS_ORDER_NOT_FOUND("700000", "物流订单数据不存在"),
    LOGISTICS_ORDER_STATUS_ERROR("700001", "物流订单当前状态不可以接单"),
    LOGISTICS_ORDER_NOT_GOODS("700002", "物流订单无商品信息"),
    LOGISTICS_ORDER_NOT_ENT("700003", "物流订单无关联企业信息"),
    LOGISTICS_ORDER_NOT_ADDRESS("700004", "物流订单无装卸货信息"),
    LOGISTICS_ORDER_AMOUNT_ERROR("70005", "物流订单的总运单量异常"),
    LOGISTICS_ORDER_NOT_DISPATCH_TRUCK("70006", "物流订单无当前派车数据"),
    LOGISTICS_CONTRACT_NOT_FOUND("70007", "物流订单无合同数据"),

    // ====================== 运单订单（80000~89999）======================
    WAYBILL_ORDER_NOT_FOUND("80000", "当前物流运单不存在"),
    WAYBILL_ORDER_NOT_UNFINISHED("80001", " 当前车辆有未完成的状态"),
    WAYBILL_ORDER_SUB_NOT_FOUND("80002", " 当前物流子运单不存在"),
    WAYBILL_ORDER_ADDRESS_NOT_FOUND("80003", " 当前物流运单地址不存在"),
    WAYBILL_ORDER_NOT_LOG_ORDER("80004", " 物流运单无关联物流订单数据"),
    WAYBILL_ORDER_STATUS_ERROR("80005", " 物流运单状态异常"),
    WAYBILL_ORDER_TICKET_NOT_FOUND("80006", " 当前物流运单装卸货信息不存在"),
    WAYBILL_ORDER_NOT_TRUCK("80007", " 物流运单无关联车辆数据"),
    WAYBILL_ORDER_NOT_TICKET("80008", " 物流运单无关联装卸货数据"),
    WAYBILL_NODE_NOT_EXIST("80009", " 物流运单无节点数据"),



    // ====================== 司机/车辆（90000~99999）======================
    DRIVER_NOT_FOUND("600000", "司机信息不存在"),
    DRIVER_STATUS_ERROR("600001", "司机信息状态异常"),
    TRUCK_NOT_FOUND("600002", "车辆信息不存在"),
    TRUCK_STATUS_ERROR("600003", "车辆信息状态异常"),
    ASSOCIATED_TRUCK_NOT_FOUND("600004", "司机关联车辆信息不存在"),
    ASSOCIATED_TRUCK_EXIST("600005", "司机关联车辆已存在"),
    TRUCK_EXIST("600006", "车辆已存在"),
    TRUCK_REVIEW_ERROR("600007", "车辆审核异常"),


    // ====================== 铲车订单（100000~110000）======================
    FORKLIFT_ORDER_NOT_FOUND("100000", "当前铲车订单不存在"),
    FORKLIFT_ORDER_STATUS_ERROR("100001", "当前铲车订单状态异常"),
    FORKLIFT_QUERY_PARAM_ERROR("100002", "当前铲车查询条件异常"),

    // ====================== 门卫订单（110000~120000）======================
    GATEKEEPER_ORDER_NOT_FOUND("110000", "当前门卫订单不存在"),
    GATEKEEPER_ORDER_STATUS_ERROR("110001", "当前门卫订单状态异常"),
    GATEKEEPER_QUERY_PARAM_ERROR("110002", "当前门卫查询条件异常"),





    ;


    /** 错误编码 */
    private final String code;

    /** 错误描述 */
    private final String desc;


    // 构造方法（枚举的构造方法默认私有）
    ErrorCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    // Getter 方法（供外部获取 code 和 desc）
    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

}
