You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
961 B
28 lines
961 B
using FluentValidation;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace TrashLib.Sonarr.Config
|
|
{
|
|
[UsedImplicitly]
|
|
internal class SonarrConfigurationValidator : AbstractValidator<SonarrConfiguration>
|
|
{
|
|
public SonarrConfigurationValidator(
|
|
ISonarrValidationMessages messages,
|
|
IValidator<ReleaseProfileConfig> releaseProfileConfigValidator)
|
|
{
|
|
RuleFor(x => x.BaseUrl).NotEmpty().WithMessage(messages.BaseUrl);
|
|
RuleFor(x => x.ApiKey).NotEmpty().WithMessage(messages.ApiKey);
|
|
RuleForEach(x => x.ReleaseProfiles).SetValidator(releaseProfileConfigValidator);
|
|
}
|
|
}
|
|
|
|
[UsedImplicitly]
|
|
internal class ReleaseProfileConfigValidator : AbstractValidator<ReleaseProfileConfig>
|
|
{
|
|
public ReleaseProfileConfigValidator(ISonarrValidationMessages messages)
|
|
{
|
|
RuleFor(x => x.Type).IsInEnum().WithMessage(messages.ReleaseProfileType);
|
|
}
|
|
}
|
|
}
|