// Copyright Epic Games, Inc. All Rights Reserved.
using System.ComponentModel;
using EpicGames.Core;
using EpicGames.Serialization;
namespace EpicGames.Horde.Jobs.Templates
{
///
/// Identifier for a job template
///
/// Id to construct from
[LogValueType]
[JsonSchemaString]
[TypeConverter(typeof(StringIdTypeConverter))]
[StringIdConverter(typeof(TemplateIdConverter))]
[CbConverter(typeof(StringIdCbConverter))]
public readonly record struct TemplateId(StringId Id)
{
///
/// Constructor
///
public TemplateId(string id) : this(new StringId(id))
{
}
///
public bool IsEmpty => Id.IsEmpty;
///
public override string ToString() => Id.ToString();
}
///
/// Converter to and from instances.
///
class TemplateIdConverter : StringIdConverter
{
///
public override TemplateId FromStringId(StringId id) => new TemplateId(id);
///
public override StringId ToStringId(TemplateId value) => value.Id;
}
}