mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 04:20:46 +00:00
80 lines
2.5 KiB
C#
80 lines
2.5 KiB
C#
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// 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.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
#nullable enable
|
|
namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|
{
|
|
using LukeHagar.PlexAPI.SDK.Utils;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
/// <summary>
|
|
/// The state of the media item
|
|
/// </summary>
|
|
[JsonConverter(typeof(OpenEnumConverter))]
|
|
public class State : IEquatable<State>
|
|
{
|
|
public static readonly State Playing = new State("playing");
|
|
public static readonly State Paused = new State("paused");
|
|
public static readonly State Stopped = new State("stopped");
|
|
|
|
private static readonly Dictionary <string, State> _knownValues =
|
|
new Dictionary <string, State> ()
|
|
{
|
|
["playing"] = Playing,
|
|
["paused"] = Paused,
|
|
["stopped"] = Stopped
|
|
};
|
|
|
|
private static readonly ConcurrentDictionary<string, State> _values =
|
|
new ConcurrentDictionary<string, State>(_knownValues);
|
|
|
|
private State(string value)
|
|
{
|
|
if (value == null) throw new ArgumentNullException(nameof(value));
|
|
Value = value;
|
|
}
|
|
|
|
public string Value { get; }
|
|
|
|
public static State Of(string value)
|
|
{
|
|
return _values.GetOrAdd(value, _ => new State(value));
|
|
}
|
|
|
|
public static implicit operator State(string value) => Of(value);
|
|
public static implicit operator string(State state) => state.Value;
|
|
|
|
public static State[] Values()
|
|
{
|
|
return _values.Values.ToArray();
|
|
}
|
|
|
|
public override string ToString() => Value.ToString();
|
|
|
|
public bool IsKnown()
|
|
{
|
|
return _knownValues.ContainsKey(Value);
|
|
}
|
|
|
|
public override bool Equals(object? obj) => Equals(obj as State);
|
|
|
|
public bool Equals(State? other)
|
|
{
|
|
if (ReferenceEquals(this, other)) return true;
|
|
if (other is null) return false;
|
|
return string.Equals(Value, other.Value);
|
|
}
|
|
|
|
public override int GetHashCode() => Value.GetHashCode();
|
|
}
|
|
|
|
} |