package com.adealink.weparty.deviceidservice

import com.adealink.frame.base.Rlt
import com.adealink.frame.deviceid.IDeviceIdServiceConfig
import com.adealink.weparty.App

class DeviceIdServiceConfig : IDeviceIdServiceConfig {

    private val deviceIdHttpService by lazy {
        App.instance.networkService.getHttpService(DeviceIdHttpService::class.java)
    }

    override suspend fun getGAid(): String {
        return App.instance.googleService.getGAid()
    }

    override suspend fun updateDeviceId(
        deviceId: String,
        oldDeviceId: String,
        gAid: String,
        androidId: String,
        mac: String,
        normalDeviceInfo: String,
        advanceDeviceInfo: String
    ): Rlt<String> {
//        return when (val result = deviceIdHttpService.updateDeviceId(
//            UpdateDeviceIdRequest(
//                deviceId,
//                oldDeviceId,
//                AppBase.platform,
//                gAid,
//                androidId,
//                mac,
//                normalDeviceInfo,
//                advanceDeviceInfo
//            )
//        )) {
//            is Rlt.Success -> {
//                val newDeviceId = result.data.data
//                if (newDeviceId.isNullOrEmpty()) {
//                    return Rlt.Failed(CommonDataNullError())
//                }
//                return Rlt.Success(newDeviceId)
//            }
//            is Rlt.Failed -> result
//        }
        // TODO:
        return Rlt.Success("不支持")
    }

    override fun onDeviceIdGot() {
        // TODO: 上报
//        reportAppOpenIfNeed(AppUtil.background)
//        AttributionModule.reportAttributionData()
//        serveReportManager.reportFirebaseAppInstanceId()
    }

}