package com.gamedog.vididin.request


import com.ama.core.architecture.util.AndroidUtil
import com.ama.core.architecture.util.DeviceUtil
import com.ama.core.architecture.util.MD5Util
import com.gamedog.vididin.VidiConst

class RequestUtil private constructor(){
    companion object {
        const val Request_APPId = "video1"
        const val Request_Sceret = "secret1"

        fun getTimestampSec(): Long {
            return System.currentTimeMillis()/1000
        }

        fun getRequestSign(timeSec: Long): String {
            val signOrigin = "$Request_APPId-${timeSec}-$Request_Sceret"
            return MD5Util.md5(signOrigin)?:""
        }

        // applicationId-timestamp-deviceId-operation-secret
        fun getZeroBuyRequestSign(timeSec: Long, operation: Int): String {
            var signOrigin = "${AndroidUtil.getPackageId()}-${timeSec}-${DeviceUtil.generateDeviceId()}-$operation-${VidiConst.ZEROBUY_SECRET}"
            return MD5Util.md5(signOrigin)?:""
        }


    }
}