package com.adealink.weparty.wallet.pay.model

import com.android.billingclient.api.Purchase

data class GooglePurchase(val purchase: Purchase) : com.adealink.weparty.module.wallet.data.Purchase {

    override fun isPurchased(): Boolean {
        return purchase.purchaseState == Purchase.PurchaseState.PURCHASED
    }

    override fun isPending(): Boolean {
        return purchase.purchaseState == Purchase.PurchaseState.PENDING
    }

    override fun getSkuId(): String {
        return purchase.products.getOrNull(0) ?: ""
    }

    override fun getOrderId(): String {
        return purchase.orderId ?: ""
    }

    override fun getPurchaseToken(): String {
        return purchase.purchaseToken
    }

    override fun isAcknowledged(): Boolean {
        return purchase.isAcknowledged
    }

    override fun obfuscatedAccountId(): String? {
        return purchase.accountIdentifiers?.obfuscatedAccountId
    }

    override fun obfuscatedProfileId(): String? {
        return purchase.accountIdentifiers?.obfuscatedProfileId
    }
}
