package com.jld.vod.model.bean

/**
 * Create by zhaofuxin on 2020/7/12
 */

data class BaseBean<T>(val code: Int, val data: T?, val message: String) {

    companion object {
        const val SUCCESS = 20000
        const val ERROR = 1
        const val EXCEPTION = 2
        const val LOADING = 3

        fun <T> success(data: T?) = BaseBean(SUCCESS, data, "success")

        fun <T> error(msg: String, data: T?) = BaseBean(ERROR, data, msg)

        fun <T> exception(msg: String, data: T?) = BaseBean(ERROR, data, msg)

        fun <T> loading(data: T?) = BaseBean(LOADING, data, "loading")
    }

}