package com.doverfuelingsolutions.issp.data

import com.doverfuelingsolutions.issp.utils.DeviceUtil
import com.doverfuelingsolutions.issp.utils.sp.SPKeys
import com.doverfuelingsolutions.issp.utils.sp.SPUtil

object GlobalData {

    val serialNumber = GlobalDataProvider(DeviceUtil.generateSerialNumber(), SPKeys.SN)

    var isLogin = false
    val accountName = GlobalDataProvider("", SPKeys.ACCOUNT_NAME)
    val password = GlobalDataProvider("", SPKeys.PASSWORD)
    val accessToken = GlobalDataProvider("", SPKeys.ACCESS_TOKEN)
    val accessTokenExpire = GlobalDataProvider("0", SPKeys.ACCESS_TOKEN_EXPIRE)

    val businessId = GlobalDataProvider("", SPKeys.BU_ID)
    val businessName = GlobalDataProvider("", SPKeys.BU_NAME)
    val stationTel = GlobalDataProvider("", SPKeys.STATION_TEL)
    val stationLogoFileName = GlobalDataProvider("", SPKeys.STATION_LOGO_FILE)

    fun init() {
        isLogin = System.currentTimeMillis() < accessTokenExpire.get().toLong()
    }
}