package com.adealink.weparty.webview.jsbridge.data

import com.google.gson.annotations.SerializedName

data class JSResponse<T>(
    @SerializedName("code")
    var code: Int = JSError.SUCCESS.code,
    @SerializedName("message")
    var message: String = JSError.SUCCESS.message,
    @SerializedName("callback_id")
    var callbackId: String = "",
    @SerializedName("data")
    var data: T? = null,
) {

    enum class JSError(val code: Int, val message: String) {
        SUCCESS(0, "success"),
        REQUEST_METHOD_NAME_NULL(1, "request method name is null"),
        CLIENT_NO_REGISTER_HANDLE_METHOD(2, "client no register handle method"),
        CLIENT_DENIED(3, "client denied"),
        CLIENT_HANDLE_REQUEST_DATA_TYPE_ERROR(4, "client handle request data type error"),
        CLIENT_HANDLE_REQUEST_DATA_PARSE_ERROR(5, "client handle request data parse error"),
        UNKNOWN_REQUEST_TYPE(6, "unknown request type"),
        CLIENT_UN_LOGIN(7, "client un login"),
        CLIENT_ERROR(8, "client error")
    }

}