1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-22 22:15:17 -04:00
Files
Radarr/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs
T
Mark McDowall 085b1db77f New: Ability to select Plex Media Server from plex.tv
(cherry picked from commit 4c622fd41289cd293a68a6a9f6b8da2a086edecb)

Closes #10110
2024-06-26 04:07:24 +03:00

128 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace NzbDrone.Core.Annotations
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class FieldDefinitionAttribute : Attribute
{
public FieldDefinitionAttribute(int order)
{
Order = order;
}
public int Order { get; private set; }
public string Label { get; set; }
public string Unit { get; set; }
public string HelpText { get; set; }
public string HelpTextWarning { get; set; }
public string HelpLink { get; set; }
public FieldType Type { get; set; }
public bool Advanced { get; set; }
public Type SelectOptions { get; set; }
public string SelectOptionsProviderAction { get; set; }
public string Section { get; set; }
public HiddenType Hidden { get; set; }
public PrivacyLevel Privacy { get; set; }
public string Placeholder { get; set; }
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class FieldOptionAttribute : Attribute
{
public FieldOptionAttribute(string label = null, [CallerLineNumber] int order = 0)
{
Order = order;
Label = label;
}
public int Order { get; private set; }
public string Label { get; set; }
public string Hint { get; set; }
}
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public class FieldTokenAttribute : Attribute
{
public FieldTokenAttribute(TokenField field, string label = "", string token = "", object value = null)
{
Label = label;
Field = field;
Token = token;
Value = value?.ToString();
}
public string Label { get; set; }
public TokenField Field { get; set; }
public string Token { get; set; }
public string Value { get; set; }
}
public class FieldSelectOption<T>
where T : struct
{
public T Value { get; set; }
public string Name { get; set; }
public int Order { get; set; }
public string Hint { get; set; }
public T? ParentValue { get; set; }
public bool? IsDisabled { get; set; }
public Dictionary<string, object> AdditionalProperties { get; set; }
}
public class FieldSelectStringOption
{
public string Value { get; set; }
public string Name { get; set; }
public int Order { get; set; }
public string Hint { get; set; }
public string ParentValue { get; set; }
public bool? IsDisabled { get; set; }
public Dictionary<string, object> AdditionalProperties { get; set; }
}
public enum FieldType
{
Textbox,
Number,
Password,
Checkbox,
Select,
Path,
FilePath,
Tag,
Action,
Url,
Captcha,
OAuth,
Device,
TagSelect,
RootFolder,
QualityProfile,
MovieTag
}
public enum HiddenType
{
Visible,
Hidden,
HiddenIfNotSet
}
public enum PrivacyLevel
{
Normal,
Password,
ApiKey,
UserName
}
public enum TokenField
{
Label,
HelpText,
HelpTextWarning
}
}