
// getFundedStatuses provides functions to retrieve the funded status of identities, messages, profiles, and reports
// Funded statuses are determined by payment proofs and their associated blockchain address deposits
// If the user is hosting their own blockchain, this package will retrieve those address deposits from the user's own node
// If the user is not hosting their own blockchain, this package will retrieve those address deposits from other hosts

package getFundedStatuses

// Be aware that Funded means that the content/identity will be hosted by the network
// It may have been funded at one point in the past, but if it has expired, it is no longer considered Funded

//TODO: Build this package

// For our own funded statuses, we use different packages:
// myIdentityBalance for our identities, and myFundedStatus for content
// This is because we want to store our own payment proofs in a seperate place than the database

// The status being known for a particular status means that we at least tried to retrieve a payment proof and checked its balance.
// The problem is that we never truly know if the content is actually funded, as a payment proof could be hard to download from the network
// It is still useful to know if the status is known, as this will help with pruning unfunded content from our database.

import "seekia/internal/encoding"
import "seekia/internal/helpers"
import "seekia/internal/identity"

import "errors"

// This should only be used for Mate/Host identities
// Moderator identities are funded through identity scores, which use blockchain(s) without payment proofs
//Outputs:
//	-bool: Status is known
//	-bool: Identity is funded
//	-int64: Time of expiration
//	-error
func GetIdentityIsFundedStatus(identityHash [16]byte, networkType byte)(bool, bool, int64, error){

	identityType, err := identity.GetIdentityTypeFromIdentityHash(identityHash)
	if (err != nil) {
		identityHashHex := encoding.EncodeBytesToHexString(identityHash[:])
		return false, false, 0, errors.New("GetIdentityIsFundedStatus called with invalid identityHash: " + identityHashHex)
	}
	if (identityType != "Mate" && identityType != "Host"){
		return false, false, 0, errors.New("GetIdentityIsFundedStatus called with Host identity: " + identityType)
	}

	isValid := helpers.VerifyNetworkType(networkType)
	if (isValid == false){
		networkTypeString := helpers.ConvertByteToString(networkType)
		return false, false, 0, errors.New("GetIdentityIsFundedStatus called with invalid networkType: " + networkTypeString)
	}

	//TODO
	
	return true, true, 10000000000000, nil 
}


//Outputs:
//	-bool: Status is known
//	-bool: Profile Is Funded
//	-int64: Time of expiration
//	-error
func GetMateProfileIsFundedStatus(profileHash [28]byte)(bool, bool, int64, error){

	//TODO

	return true, true, 10000000000000, nil
}


//Outputs:
//	-bool: Status is known
//	-bool: Message Is funded
//	-int64: Time of expiration
//	-error
func GetMessageIsFundedStatus(messageHash [26]byte)(bool, bool, int64, error){

	//TODO
	// The size of the message is needed to get the isFunded status.
	// We will use contentMetadata for this.

	return true, true, 10000000000000, nil
}


//Outputs:
//	-bool: Status is known
//	-bool: Report Is funded
//	-int64: Time of expiration
//	-error
func GetReportIsFundedStatus(reportHash [30]byte)(bool, bool, int64, error){

	//TODO

	return true, true, 10000000000000, nil
}


