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