package automation

// FlowRetriableFault is returned by flow element executors to signal that the
// flow encountered a transient condition (e.g. a missing prerequisite record
// that another in-flight event is expected to create). The flow executor
// propagates this into FlowExecutionResult.IsRetriable = true so that callers
// (notably the connector-inbound worker) can treat the outcome as a retriable
// failure rather than a terminal success.
//
// Unlike FlowCustomErrorFault (which sets IsCustomError and maps to an HTTP-400
// validation-style response) and FlowStatusFault (which carries a deliberate
// status code), FlowRetriableFault is specifically about retry semantics: the
// flow could not complete its intended work because a temporary condition was
// not satisfied, and the caller should re-attempt later.
type FlowRetriableFault struct {
	StatusCode string
	Message    string
}

func (f *FlowRetriableFault) Error() string {
	if f.Message != "" {
		return f.Message
	}
	return "retriable condition"
}
