package policy

import (
	
	
)

type ExecutionInternal[ any] interface {
	failsafe.Execution[]

	// RecordResult records an execution result, such as before a retry attempt, and returns the result or the cancel result,
	// if any.
	RecordResult(result *common.PolicyResult[]) *common.PolicyResult[]

	// InitializeRetry prepares a new execution retry. If the retry could not be initialized because was canceled, the associated
	// cancellation result is returned.
	InitializeRetry() *common.PolicyResult[]

	// Cancel cancels the execution with the result.
	Cancel(result *common.PolicyResult[])

	// IsCanceledWithResult returns whether the execution is canceled, along with the cancellation result, if any.
	IsCanceledWithResult() (bool, *common.PolicyResult[])

	// CopyWithResult returns a copy of the failsafe.Execution with the result. If the result is nil, this will preserve a
	// copy of the lastResult and lastError. This is useful before passing the execution to an event listener, otherwise
	// these may be changed if the execution is canceled.
	CopyWithResult(result *common.PolicyResult[]) failsafe.Execution[]

	// CopyForCancellable creates a cancellable child copy of the execution based on the current execution's context.
	CopyForCancellable() failsafe.Execution[]

	// CopyForHedge creates a copy of the execution marked as a hedge.
	CopyForHedge() failsafe.Execution[]
}