package com.adealink.weparty.base

import android.net.Uri
import com.adealink.frame.base.IAppBase
import com.adealink.frame.log.ILog
import com.adealink.frame.log.Log
import com.adealink.weparty.BuildConfig
import com.adealink.weparty.debug.DebugPrefs
import com.adealink.weparty.network.RELEASE_HOSTS

class AppBaseImpl: IAppBase {
    override val debugLog: Boolean
        get() = BuildConfig.DEBUG
    override val isRelease: Boolean
        get() = BuildConfig.IS_RELEASE
    override val platform: String
        get() = "android"
    override val deeplinkScheme: String
        get() = BuildConfig.DEEP_LINK_SCHEME
    override val deeplinkHost: String
        get() = BuildConfig.DEEP_LINK_HOST
    override val isProdEnv: Boolean
        get() = isRelease || RELEASE_HOSTS.contains(Uri.parse(DebugPrefs.httpUrl).host)
    override val appName: String
        get() = "yoki"
    override val log: ILog = object : ILog {

        override fun d(tag: String, msg: String) {
            Log.d(tag, msg)
        }

        override fun i(tag: String, msg: String) {
            Log.i(tag, msg)
        }

        override fun e(tag: String, msg: String, e: Exception?) {
            Log.e(tag, msg, e)
        }
    }
}