
// myIdentityBalance provides functions to retrieve a user's identity balance

package myIdentityBalance

// Only Mate/Host identities use identity balances. Moderator identities use Identity Scores.

// This package is useful because a user's identity balance will be retained, even if the database if deleted
// We will keep a seperate local copy of all of our payment proofs we purchase for our own identity balances
// We will also download any payment proofs that other people purchase for our identities and import them into local storage

//TODO: Complete this package
// We need to retrieve this information from the account funds interface servers

import "seekia/internal/helpers"
import "seekia/internal/myIdentity"

import "time"
import "errors"

// Start time and end time describe the current uninterrupted period of the balance being sufficient
// The start time is recorded locally whenever we successfully fund the balance
//Outputs:
//	-bool: My identity found
//	-bool: Balance is sufficient
//	-int64: Balance is sufficient end time (Expiration time) (Unix)
//	-error
func GetMyIdentityBalanceStatus(myIdentityHash [16]byte, networkType byte)(bool, bool, int64, error){

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

	isMine, identityType, err := myIdentity.CheckIfIdentityHashIsMine(myIdentityHash)
	if (err != nil) { return false, false, 0, err }
	if (isMine == false){
		return false, false, 0, nil
	}
	if (identityType == "Moderator"){
		return false, false, 0, errors.New("GetMyIdentityBalanceStatus called with Moderator identity")
	}

	//TODO: Build function

	fakeExpirationTime := time.Now().Unix() + 10000000
	
	return true, true, fakeExpirationTime, nil
}



