51 lines
2.2 KiB
C#
51 lines
2.2 KiB
C#
using RobotNet10.CustomConfiguration.Events;
|
|
using RobotNet10.CustomConfiguration.Models;
|
|
|
|
namespace RobotNet10.CustomConfiguration.Services;
|
|
|
|
/// <summary>
|
|
/// Service interface cho quản lý configuration files
|
|
/// </summary>
|
|
public interface IConfigService
|
|
{
|
|
// ==========================================
|
|
// EVENTS
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// Event được trigger khi có thay đổi trong config (tạo mới, cập nhật, xóa, hoặc thay đổi variables)
|
|
/// </summary>
|
|
event EventHandler<ConfigChangedEventArgs>? ConfigChanged;
|
|
|
|
// ==========================================
|
|
// CONFIG FILE MANAGEMENT
|
|
// ==========================================
|
|
|
|
Task<ConfigFile> CreateConfigAsync(string configType, List<ConfigVariable> variables, string? description = null);
|
|
Task<ConfigFile?> GetConfigByIdAsync(Guid id);
|
|
Task<ConfigFile?> GetConfigByTypeAsync(string configType);
|
|
Task<List<ConfigFileMetadata>> GetAllConfigsAsync();
|
|
Task<List<ConfigFileMetadata>> SearchConfigsAsync(string? searchText);
|
|
Task<ConfigFile> UpdateConfigAsync(Guid id, List<ConfigVariable>? variables = null, string? description = null);
|
|
Task<bool> DeleteConfigAsync(Guid id);
|
|
Task<bool> ConfigTypeExistsAsync(string configType);
|
|
|
|
// ==========================================
|
|
// IMPORT/EXPORT
|
|
// ==========================================
|
|
|
|
Task<ConfigFile> ImportConfigFromJsonAsync(Stream jsonStream, string configType);
|
|
Task<ConfigFile> ImportConfigFromJsonAsync(Stream jsonStream, string configType, string? description);
|
|
Task<Stream> ExportConfigToJsonAsync(Guid id);
|
|
Task<Stream> ExportConfigToJsonAsync(ConfigFile config);
|
|
|
|
// ==========================================
|
|
// VARIABLE MANAGEMENT
|
|
// ==========================================
|
|
|
|
Task<ConfigFile> UpdateVariableAsync(Guid configId, string variableName, object? value);
|
|
Task<ConfigFile> AddVariableAsync(Guid configId, ConfigVariable variable);
|
|
Task<ConfigFile> RemoveVariableAsync(Guid configId, string variableName);
|
|
}
|
|
|