// Copyright Epic Games, Inc. All Rights Reserved. using EpicGames.Horde.Agents.Leases; using HordeAgent.Services; namespace HordeAgent.Leases { /// /// Result from executing a lease /// internal class LeaseResult { /// /// Outcome of the lease (whether it completed/failed due to an internal error, etc...) /// public LeaseOutcome Outcome { get; } /// /// Output from executing the task /// public byte[]? Output { get; } /// /// If a lease wants to terminate the current session, this specifies the subsequent action to take. /// public SessionResult? SessionResult { get; } /// /// Static instance of a cancelled result /// public static LeaseResult Cancelled { get; } = new LeaseResult(LeaseOutcome.Cancelled); /// /// Static instance of a failed result /// public static LeaseResult Failed { get; } = new LeaseResult(LeaseOutcome.Failed); /// /// Static instance of a succesful result without a payload /// public static LeaseResult Success { get; } = new LeaseResult(LeaseOutcome.Success); /// /// Constructor for /// /// private LeaseResult(LeaseOutcome outcome) { Outcome = outcome; } /// /// Constructor for successful results /// /// public LeaseResult(byte[]? output) { Outcome = LeaseOutcome.Success; Output = output; } /// /// Constructor for successful results that cause a session state change /// /// Session result public LeaseResult(SessionResult sessionResult) { Outcome = LeaseOutcome.Success; SessionResult = sessionResult; } } }