package com.unibuy.smartdevice.exception;

public enum ErrorCode {
    RE_OK(200, "ok"),
    RE_ERROR(201, "error"),
    MACHINE_DATA_EMPTY(301, "Machine data empty"),
    DATA_NOT_FOUND(404, "Data not found"),
    ENCODING_AND_DECODING_ERROR(405, "Encoding and decoding error"),
    INVALID_URL_FORMAT(400, "Invalid URL format"),
    JSON_FORMAT_ERROR(422, "Json format error"),
    BAD_GATEWAY(502, "bad gateway"),
    NETWORK_CONNECTION_ERROR(503, "Network connection error"),
    DEV_ERROR(898, "device error"),
    TIMEOUT(899, "Timeout"),
    RESPONSE_CODE_ERROR(998, "response code error"),
    NETWORK_UNKNOWN_ERROR(998, "Network unknown error"),
    UNKNOWN_ERROR(999, "Unknown error"),
    ;

    private final int code;
    private final String message;

    // Enum 的構造函數
    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    // 獲取錯誤代碼
    public int getCode() {
        return code;
    }

    // 獲取錯誤訊息
    public String getMessage() {
        return message;
    }
}
