//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Interfaces;
///
/// Interface for an object which publishes configuration changes to other services.
///
public interface IConfigurationChangePublisher
{
///
/// Gets a publisher which doesn't publish at all.
///
static IConfigurationChangePublisher None { get; } = new NoneConfigurationChangePublisher();
///
/// A configuration has changed.
///
/// The type.
/// The identifier.
/// The changed configuration.
Task ConfigurationChangedAsync(Type type, Guid id, object configuration);
///
/// A configuration has been added.
///
/// The type.
/// The identifier.
/// The added configuration.
Task ConfigurationAddedAsync(Type type, Guid id, object configuration);
///
/// A configuration has been removed.
///
/// The type.
/// The identifier.
Task ConfigurationRemovedAsync(Type type, Guid id);
///
/// A publisher which doesn't publish changes at all.
///
private class NoneConfigurationChangePublisher : IConfigurationChangePublisher
{
///
public Task ConfigurationChangedAsync(Type type, Guid id, object configuration)
{
return Task.CompletedTask;
}
///
public Task ConfigurationAddedAsync(Type type, Guid id, object configuration)
{
return Task.CompletedTask;
}
///
public Task ConfigurationRemovedAsync(Type type, Guid id)
{
return Task.CompletedTask;
}
}
}