package com.duolebo.blyrobot.data

import com.duolebo.appbase.IModel
import com.duolebo.appbase.prj.XMLHelper
import org.json.JSONArray
import org.json.JSONObject

class AppInfoData : IModel {
    val apkInfos = ArrayList<ApkInfo>()

    override fun from(json: JSONObject): Boolean {
        val data = json.optJSONArray("data")
        if (data != null) {
            for (i in 0..data.length()) {
                val apkInfo = ApkInfo()
                apkInfo.from(data.getJSONObject(i))
                apkInfos.add(apkInfo)
            }
        }
        return true
    }

    override fun from(json: JSONArray?): Boolean {
        return true
    }

    override fun from(p0: XMLHelper?): Boolean {
        return false
    }
}