package gaf3.core.data

import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonPropertyOrder

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder("errcode", "errmsg", "details", "data")
open class JsonResult<T> (@JsonInclude(JsonInclude.Include.ALWAYS)
                          var data: T? = null){
    var errcode: Int = 0
    var errmsg: String? = null
    var details: String? = null

    constructor(value: T?, total: Int) : this(value) {
        this.errcode = total
    }

    constructor(errcode: Int, errmsg: String) : this() {
        this.errcode = errcode
        this.errmsg = errmsg
    }

    constructor(errcode: Int) : this() {
        this.errcode = errcode
    }

}
