// Copyright Epic Games, Inc. All Rights Reserved.
using EpicGames.Core;
using EpicGames.Horde.Tools;
namespace UnrealToolbox
{
///
/// Describes a tool available to be installed
///
public interface IToolCatalogItem
{
///
/// Identifier for the tool
///
ToolId Id { get; }
///
/// Name of the tool
///
string Name { get; }
///
/// Description for the tool
///
string Description { get; }
///
/// Latest available version of the tool
///
ToolDeploymentInfo? Latest { get; }
///
/// The current tool deployment
///
CurrentToolDeploymentInfo? Current { get; }
///
/// Pending tool deployment, if an install or uninstall operation
///
PendingToolDeploymentInfo? Pending { get; }
///
/// Callback for the item state changing
///
event Action? OnItemChanged;
///
/// Cancel any pending installation
///
void Cancel();
///
/// Start installing this tool or updating it to the latest version
///
void Install();
///
/// Start uninstalling this tool
///
void Uninstall();
}
///
/// Information about a particular tool deployment
///
/// Identifier for the deployment
/// Version number for this deployment
public record class ToolDeploymentInfo(ToolDeploymentId Id, string Version);
///
/// Information about an installed tool deployment
///
/// Identifier for the deployment
/// Version number for this deployment
/// Directory containing the tool
/// Configuration for the tool
public record class CurrentToolDeploymentInfo(ToolDeploymentId Id, string Version, DirectoryReference Dir, ToolConfig Config) : ToolDeploymentInfo(Id, Version);
///
/// Information about a pending tool installation
///
/// Whether the installation failed
/// Current status message
/// Information about the pending deployment
/// Whether to show a link to the log
public record class PendingToolDeploymentInfo(bool Failed, string? Message, ToolDeploymentInfo? Deployment, bool ShowLogLink = false);
}