package cn.muchinfo.rma.view.autoWidget

import com.google.gson.annotations.SerializedName
import mtp.polymer.com.automodel.PageInfo

data class CommonList<out Data>(
        @SerializedName("list") val list: List<Data>,
        @SerializedName("pageInfo") val pageInfo: PageInfo = PageInfo(totalRow = list.size, pageSize = list.size)
)

fun <FROM, TO> CommonList<FROM>.map(func: ((FROM) -> TO)): CommonList<TO> {
    return CommonList(pageInfo = pageInfo, list = list.map(func))
}