//------------------------------------------------------------------------------
//
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
//
//------------------------------------------------------------------------------
#nullable enable
namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
///
/// The status of this update.
///
///
///
/// - available - This release is available
/// - downloading - This release is downloading
/// - downloaded - This release has been downloaded
/// - installing - This release is installing
/// - tonight - This release will be installed tonight
/// - skipped - This release has been skipped
/// - error - This release has an error
/// - notify - This release is only notifying it is available (typically because it cannot be installed on this setup)
/// - done - This release is complete
///
///
///
public enum GetUpdatesStatusState
{
[JsonProperty("available")]
Available,
[JsonProperty("downloading")]
Downloading,
[JsonProperty("downloaded")]
Downloaded,
[JsonProperty("installing")]
Installing,
[JsonProperty("tonight")]
Tonight,
[JsonProperty("skipped")]
Skipped,
[JsonProperty("error")]
Error,
[JsonProperty("notify")]
Notify,
[JsonProperty("done")]
Done,
}
public static class GetUpdatesStatusStateExtension
{
public static string Value(this GetUpdatesStatusState value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetUpdatesStatusState ToEnum(this string value)
{
foreach(var field in typeof(GetUpdatesStatusState).GetFields())
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
if (enumVal is GetUpdatesStatusState)
{
return (GetUpdatesStatusState)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetUpdatesStatusState");
}
}
}