// Copyright Epic Games, Inc. All Rights Reserved.
using System.ComponentModel;
using EpicGames.Core;
namespace EpicGames.Horde.Jobs
{
///
/// Identifier for a job
///
/// Id to construct from
[LogValueType]
[JsonSchemaString]
[TypeConverter(typeof(BinaryIdTypeConverter))]
[BinaryIdConverter(typeof(JobIdConverter))]
public readonly record struct JobId(BinaryId Id)
{
///
/// Constant value for an empty job id
///
public static JobId Empty { get; } = default;
///
public static JobId Parse(string text) => new JobId(BinaryId.Parse(text));
///
public override string ToString() => Id.ToString();
}
///
/// Converter to and from instances.
///
class JobIdConverter : BinaryIdConverter
{
///
public override JobId FromBinaryId(BinaryId id) => new JobId(id);
///
public override BinaryId ToBinaryId(JobId value) => value.Id;
}
}