Lidarr/NzbDrone.Core/ThingiProvider/IProvider.cs

75 lines
1.8 KiB
C#
Raw Normal View History

2013-09-21 00:18:11 +00:00

2013-09-22 05:20:26 +00:00
using System;
using System.Collections.Generic;
using FluentValidation.Results;
2013-09-21 00:18:11 +00:00
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.ThingiProvider
{
2013-09-22 05:20:26 +00:00
public interface IProviderRepository<TProvider> : IBasicRepository<TProvider> where TProvider : ModelBase, new()
2013-09-21 00:18:11 +00:00
{
2013-09-22 05:20:26 +00:00
TProvider GetByName(string name);
2013-09-21 00:18:11 +00:00
}
2013-09-22 05:20:26 +00:00
public class ProviderRepository<TProviderDefinition> : BasicRepository<TProviderDefinition>, IProviderRepository<TProviderDefinition>
where TProviderDefinition : ModelBase,
new()
{
2013-09-22 05:20:26 +00:00
protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
{
}
2013-09-22 05:20:26 +00:00
public TProviderDefinition GetByName(string name)
{
throw new NotImplementedException();
}
2013-09-21 00:18:11 +00:00
}
2013-09-22 05:20:26 +00:00
public interface IProvider
2013-09-21 00:18:11 +00:00
{
2013-09-22 05:20:26 +00:00
string Name { get; }
IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
ProviderDefinition Definition { get; set; }
2013-09-21 00:18:11 +00:00
}
public abstract class ProviderDefinition : ModelBase
2013-09-21 00:18:11 +00:00
{
public string Name { get; set; }
2013-09-21 00:18:11 +00:00
public string Implementation { get; set; }
2013-09-22 05:20:26 +00:00
public bool Enable { get; set; }
2013-09-21 00:18:11 +00:00
public string ConfigContract
{
get
{
if (Settings == null) return null;
return Settings.GetType().Name;
}
set
{
}
}
2013-09-21 00:18:11 +00:00
public IProviderConfig Settings { get; set; }
2013-09-21 00:18:11 +00:00
}
public interface IProviderConfig
2013-09-21 00:18:11 +00:00
{
ValidationResult Validate();
}
public class NullSetting : IProviderConfig
{
public static readonly NullSetting Instance = new NullSetting();
public ValidationResult Validate()
{
return new ValidationResult();
}
2013-09-21 00:18:11 +00:00
}
}