2020-01-17 03:21:39 +00:00
using FluentValidation ;
2019-12-15 07:34:27 +00:00
using NzbDrone.Core.Annotations ;
2024-04-14 04:16:26 +00:00
using NzbDrone.Core.Validation ;
2019-12-15 07:34:27 +00:00
2020-09-04 02:50:56 +00:00
namespace NzbDrone.Core.ImportLists.TMDb.Popular
2019-12-15 07:34:27 +00:00
{
public class TMDbPopularSettingsValidator : TMDbSettingsBaseValidator < TMDbPopularSettings >
{
public TMDbPopularSettingsValidator ( )
{
2020-01-26 22:42:44 +00:00
RuleFor ( c = > c . TMDbListType ) . NotNull ( ) ;
2019-12-15 07:34:27 +00:00
RuleFor ( c = > c . FilterCriteria ) . SetValidator ( _ = > new TMDbFilterSettingsValidator ( ) ) ;
}
}
public class TMDbPopularSettings : TMDbSettingsBase < TMDbPopularSettings >
{
2024-04-14 04:16:26 +00:00
private static readonly TMDbPopularSettingsValidator Validator = new ( ) ;
2019-12-15 07:34:27 +00:00
public TMDbPopularSettings ( )
{
2020-01-15 21:41:57 +00:00
TMDbListType = ( int ) TMDbPopularListType . Popular ;
2019-12-15 07:34:27 +00:00
}
[FieldDefinition(1, Label = "List Type", Type = FieldType.Select, SelectOptions = typeof(TMDbPopularListType), HelpText = "Type of list your seeking to import from")]
2020-01-15 21:41:57 +00:00
public int TMDbListType { get ; set ; }
2019-12-15 07:34:27 +00:00
[FieldDefinition(2)]
2024-04-14 04:16:26 +00:00
public TMDbFilterSettings FilterCriteria { get ; set ; } = new ( ) ;
public override NzbDroneValidationResult Validate ( )
{
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
}
2019-12-15 07:34:27 +00:00
}
}