Lidarr/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs

115 lines
2.9 KiB
C#
Raw Normal View History

2017-09-04 02:20:56 +00:00
using System;
2020-09-22 20:32:57 +00:00
using System.Runtime.CompilerServices;
2013-05-03 05:24:52 +00:00
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; }
2013-05-20 04:19:54 +00:00
public FieldType Type { get; set; }
public bool Advanced { get; set; }
2013-06-13 07:20:33 +00:00
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; }
2013-05-20 04:19:54 +00:00
}
2020-09-22 20:32:57 +00:00
[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
{
public int Value { get; set; }
public string Name { get; set; }
public int Order { get; set; }
public string Hint { get; set; }
public int? ParentValue { get; set; }
}
2013-05-20 04:19:54 +00:00
public enum FieldType
{
Textbox,
Number,
2013-05-20 04:19:54 +00:00
Password,
2013-06-13 07:20:33 +00:00
Checkbox,
Select,
Path,
FilePath,
Tag,
Action,
2016-08-10 18:45:48 +00:00
Url,
2017-09-04 02:20:56 +00:00
Captcha,
OAuth,
Device,
Playlist,
TagSelect,
RootFolder,
QualityProfile,
MetadataProfile,
ArtistTag
2013-05-03 05:24:52 +00:00
}
public enum HiddenType
{
Visible,
Hidden,
HiddenIfNotSet
}
public enum PrivacyLevel
{
Normal,
Password,
ApiKey,
UserName
}
public enum TokenField
{
Label,
HelpText,
HelpTextWarning
}
2017-09-04 02:20:56 +00:00
}