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