using System; using System.Collections.Generic; namespace Haoliang.Models.DataCollection { public class CollectionTask { public int Id { get; set; } public int DeviceId { get; set; } public string TaskName { get; set; } public string Status { get; set; } // Pending, Running, Completed, Failed public DateTime ScheduledTime { get; set; } public DateTime? StartTime { get; set; } public DateTime? EndTime { get; set; } public bool IsSuccess { get; set; } public string ErrorMessage { get; set; } public int RetryCount { get; set; } public DateTime CreatedAt { get; set; } } public class CollectionResult { public int Id { get; set; } public int DeviceId { get; set; } public bool IsSuccess { get; set; } public string RawJson { get; set; } public string ParsedData { get; set; } public DateTime CollectionTime { get; set; } public long? ResponseTime { get; set; } public int? DataSize { get; set; } public string ErrorMessage { get; set; } public DateTime CreatedAt { get; set; } } public class CollectionLog { public int Id { get; set; } public int DeviceId { get; set; } public LogLevel LogLevel { get; set; } public string LogCategory { get; set; } public string LogMessage { get; set; } public string LogData { get; set; } public DateTime LogTime { get; set; } public DateTime CreatedAt { get; set; } } public class PingResult { public bool IsSuccess { get; set; } public int PingTimeMs { get; set; } public string ErrorMessage { get; set; } public DateTime Timestamp { get; set; } } public class DeviceStatus { public int Id { get; set; } public int DeviceId { get; set; } public string Status { get; set; } public bool IsRunning { get; set; } public string NCProgram { get; set; } public int CumulativeCount { get; set; } public string OperatingMode { get; set; } public DateTime RecordTime { get; set; } } public class TagData { public string Id { get; set; } public string Desc { get; set; } public string Quality { get; set; } public object Value { get; set; } public DateTime Time { get; set; } } public class CollectionStatistics { public DateTime Date { get; set; } public int TotalAttempts { get; set; } public int SuccessCount { get; set; } public int FailedCount { get; set; } public decimal SuccessRate { get; set; } public int DeviceCount { get; set; } public int OnlineDeviceCount { get; set; } public long TotalDataSize { get; set; } public TimeSpan? AverageResponseTime { get; set; } } public interface ICachingService { Task GetAsync(string key); Task SetAsync(string key, T value, TimeSpan? expiration = null); Task RemoveAsync(string key); Task ExistsAsync(string key); Task ClearAsync(); Task GetOrCreateAsync(string key, Func> factory, TimeSpan? expiration = null); Task> GetAllKeysAsync(); Task RefreshAsync(string key); } public interface ISchedulerService { Task StartSchedulerAsync(); Task StopSchedulerAsync(); Task ScheduleTaskAsync(ScheduledTask task); Task RemoveTaskAsync(string taskId); Task> GetAllScheduledTasksAsync(); Task GetTaskByIdAsync(string taskId); Task ExecuteTaskAsync(string taskId); Task GetTaskExecutionResultAsync(string taskId); Task IsTaskRunningAsync(string taskId); } public interface IWebSocketAuthMiddleware { Task AuthenticateAsync(string connectionId, string token); Task GetUserIdAsync(string connectionId); Task GetConnectionIdAsync(string userId); Task IsAuthenticatedAsync(string connectionId); Task HasPermissionAsync(string connectionId, string permission); } public class BackgroundTaskManager : ISchedulerService { // Implementation would go here - this is just a placeholder public async Task StartSchedulerAsync() { await Task.CompletedTask; } public async Task StopSchedulerAsync() { await Task.CompletedTask; } public async Task ScheduleTaskAsync(ScheduledTask task) { await Task.CompletedTask; } public async Task RemoveTaskAsync(string taskId) { return true; } public async Task> GetAllScheduledTasksAsync() { return new List(); } public async Task GetTaskByIdAsync(string taskId) { return null; } public async Task ExecuteTaskAsync(string taskId) { await Task.CompletedTask; } public async Task GetTaskExecutionResultAsync(string taskId) { return null; } public async Task IsTaskRunningAsync(string taskId) { return false; } } public class CacheManager : ICachingService { // Implementation would go here - this is just a placeholder public async Task GetAsync(string key) { return default; } public async Task SetAsync(string key, T value, TimeSpan? expiration = null) { await Task.CompletedTask; } public async Task RemoveAsync(string key) { return true; } public async Task ExistsAsync(string key) { return false; } public async Task ClearAsync() { await Task.CompletedTask; } public async Task GetOrCreateAsync(string key, Func> factory, TimeSpan? expiration = null) { return default; } public async Task> GetAllKeysAsync() { return new List(); } public async Task RefreshAsync(string key) { return true; } } }