2023-03-13 06:41:35 +00:00
|
|
|
using FluentValidation;
|
|
|
|
using NzbDrone.Core.Annotations;
|
|
|
|
using NzbDrone.Core.Validation;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.ImportLists.Rss
|
|
|
|
{
|
2024-04-14 04:16:26 +00:00
|
|
|
public class RssImportSettingsValidator<TSettings> : AbstractValidator<TSettings>
|
|
|
|
where TSettings : RssImportBaseSettings<TSettings>
|
2023-03-13 06:41:35 +00:00
|
|
|
{
|
|
|
|
public RssImportSettingsValidator()
|
|
|
|
{
|
|
|
|
RuleFor(c => c.Url).NotEmpty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-14 04:16:26 +00:00
|
|
|
public class RssImportBaseSettings<TSettings> : ImportListSettingsBase<TSettings>
|
|
|
|
where TSettings : RssImportBaseSettings<TSettings>
|
2023-03-13 06:41:35 +00:00
|
|
|
{
|
2024-04-14 04:16:26 +00:00
|
|
|
private static readonly RssImportSettingsValidator<TSettings> Validator = new ();
|
2023-03-13 06:41:35 +00:00
|
|
|
|
2024-04-14 04:16:26 +00:00
|
|
|
public override string BaseUrl { get; set; }
|
2023-03-13 06:41:35 +00:00
|
|
|
|
2024-01-14 20:57:42 +00:00
|
|
|
[FieldDefinition(0, Label = "ImportListsSettingsRssUrl", Type = FieldType.Textbox)]
|
2023-03-13 06:41:35 +00:00
|
|
|
public virtual string Url { get; set; }
|
|
|
|
|
2024-04-14 04:16:26 +00:00
|
|
|
public override NzbDroneValidationResult Validate()
|
2023-03-13 06:41:35 +00:00
|
|
|
{
|
2024-04-14 04:16:26 +00:00
|
|
|
return new NzbDroneValidationResult(Validator.Validate(this as TSettings));
|
2023-03-13 06:41:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|