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.
27 lines
887 B
27 lines
887 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.TrashIds).NotEmpty().WithMessage(messages.ReleaseProfileTrashIds);
|
|
}
|
|
}
|