// Copyright Epic Games, Inc. All Rights Reserved.
namespace EpicGames.BuildGraph.Expressions
{
///
/// Describes an agent that can execute execute build steps
///
public class BgAgent : BgExpr
{
///
/// Name of the agent
///
public BgString Name { get; }
///
/// List of agent types to select from, in order of preference. The first agent type supported by a stream will be used.
///
public BgList Types { get; set; }
///
/// Constructor
///
public BgAgent(BgString name, BgString type)
: this(name, BgList.Create(type))
{
}
///
/// Constructor
///
public BgAgent(BgString name, BgList types)
: base(BgExprFlags.ForceFragment)
{
Name = name;
Types = types;
}
///
public override void Write(BgBytecodeWriter writer)
{
BgObject obj = BgObject.Empty;
obj = obj.Set(x => x.Name, Name);
obj = obj.Set(x => x.PossibleTypes, Types);
writer.WriteExpr(obj);
}
///
public override BgString ToBgString() => "{Agent}";
}
}