ironservices-dotnet/ApiModels.cs

279 lines
8.5 KiB
C#

namespace IronServices.Client;
#region Licensing Models
public class LicensingDashboardStats
{
public int TotalLicenses { get; set; }
public int ActiveLicenses { get; set; }
public int ExpiringThisMonth { get; set; }
public int NewThisMonth { get; set; }
public decimal MonthlyRevenue { get; set; }
public int TotalProducts { get; set; }
}
public class LicenseDto
{
public Guid Id { get; set; }
public string LicenseKey { get; set; } = "";
public string Status { get; set; } = "";
public string? CustomerEmail { get; set; }
public string? CustomerName { get; set; }
public string ProductName { get; set; } = "";
public string? ProductSlug { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? ExpiresAt { get; set; }
public DateTime? LastActivatedAt { get; set; }
public int MaxActivations { get; set; }
public int CurrentActivations { get; set; }
public string? SuspensionReason { get; set; }
public string? RevocationReason { get; set; }
}
public class ActivityItem
{
public Guid Id { get; set; }
public string Type { get; set; } = "";
public string Description { get; set; } = "";
public DateTime CreatedAt { get; set; }
public string? EntityType { get; set; }
public Guid? EntityId { get; set; }
public string? UserEmail { get; set; }
public Dictionary<string, object>? Metadata { get; set; }
}
public class TicketDto
{
public Guid Id { get; set; }
public string Subject { get; set; } = "";
public string Status { get; set; } = "";
public string Priority { get; set; } = "";
public string? CustomerEmail { get; set; }
public string? CustomerName { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public int MessageCount { get; set; }
}
public class TicketDetailDto : TicketDto
{
public List<TicketMessageDto> Messages { get; set; } = [];
}
public class TicketMessageDto
{
public Guid Id { get; set; }
public string Content { get; set; } = "";
public string SenderType { get; set; } = "";
public string? SenderEmail { get; set; }
public string? SenderName { get; set; }
public DateTime CreatedAt { get; set; }
}
public class UpdateProfileRequest
{
public string? DisplayName { get; set; }
public string? CurrentPassword { get; set; }
public string? NewPassword { get; set; }
}
#endregion
#region Notify Models
public class NotificationDto
{
public Guid Id { get; set; }
public Guid EventId { get; set; }
public string Type { get; set; } = "";
public string Title { get; set; } = "";
public string Message { get; set; } = "";
public string Severity { get; set; } = "Info";
public string? AppSlug { get; set; }
public string? AppName { get; set; }
public string? ActionUrl { get; set; }
public string? EntityId { get; set; }
public bool IsRead { get; set; }
public bool IsAcknowledged { get; set; }
public bool IsResolved { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? ReadAt { get; set; }
public DateTime? AcknowledgedAt { get; set; }
public DateTime? ResolvedAt { get; set; }
public string? AcknowledgedBy { get; set; }
public string? ResolvedBy { get; set; }
public Dictionary<string, string>? Metadata { get; set; }
}
public class OnCallStatus
{
public bool IsOnCall { get; set; }
public string? OnCallUserName { get; set; }
public string? OnCallUserEmail { get; set; }
public DateTime? OnCallUntil { get; set; }
public string? NextOnCallUserName { get; set; }
public DateTime? NextShiftStart { get; set; }
}
public class ScheduleSlot
{
public Guid UserId { get; set; }
public string UserName { get; set; } = "";
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public bool IsCurrent { get; set; }
}
public class TeamMember
{
public Guid Id { get; set; }
public string Name { get; set; } = "";
public string Email { get; set; } = "";
public string? PhoneNumber { get; set; }
public string? Role { get; set; }
public Guid? TeamId { get; set; }
public string? TeamName { get; set; }
public bool IsOnCall { get; set; }
public int DeviceCount { get; set; }
public DateTime CreatedAt { get; set; }
// Alias for compatibility
public Guid UserId => Id;
}
public class AppSubscription
{
public Guid Id { get; set; }
public string Name { get; set; } = "";
public string Slug { get; set; } = "";
public string? Description { get; set; }
public string? WebhookUrl { get; set; }
public string? WebhookSecret { get; set; }
public bool IsActive { get; set; }
public bool IsMuted { get; set; }
public DateTime? MutedUntil { get; set; }
public int UnreadCount { get; set; }
public int TotalNotifications { get; set; }
public DateTime? LastEventAt { get; set; }
public string SeverityFilter { get; set; } = "All";
public DateTime CreatedAt { get; set; }
// Aliases for compatibility
public string AppSlug => Slug;
public string AppName => Name;
}
public class NotificationPreferences
{
public bool PushEnabled { get; set; } = true;
public bool SoundEnabled { get; set; } = true;
public bool VibrationEnabled { get; set; } = true;
public string MinimumSeverity { get; set; } = "Info";
public TimeSpan? QuietHoursStart { get; set; }
public TimeSpan? QuietHoursEnd { get; set; }
}
#endregion
#region Telemetry Models
public class TelemetryDashboardStats
{
public int TotalErrors { get; set; }
public int OpenIssues { get; set; }
public int ResolvedToday { get; set; }
public double ErrorRate { get; set; }
public int ActiveProjects { get; set; }
public List<ErrorTrend> ErrorTrends { get; set; } = [];
public List<TopIssue> TopIssues { get; set; } = [];
}
public class ErrorTrend
{
public DateTime Date { get; set; }
public int Count { get; set; }
}
public class TopIssue
{
public string Id { get; set; } = "";
public string Title { get; set; } = "";
public int EventCount { get; set; }
public string ProjectName { get; set; } = "";
}
public class IssueDto
{
public Guid Id { get; set; }
public string Title { get; set; } = "";
public string? Culprit { get; set; }
public string Level { get; set; } = "error";
public string Severity { get; set; } = "error";
public string Status { get; set; } = "unresolved";
public int EventCount { get; set; }
public int UserCount { get; set; }
public DateTime FirstSeen { get; set; }
public DateTime LastSeen { get; set; }
public Guid? ProjectId { get; set; }
public string? ProjectName { get; set; }
public string? ProjectSlug { get; set; }
public bool IsIgnored { get; set; }
public Guid? AssignedToUserId { get; set; }
public string? AssignedTo { get; set; }
}
public class SignalDto
{
public Guid Id { get; set; }
public string Type { get; set; } = "";
public string Title { get; set; } = "";
public string? Message { get; set; }
public string Level { get; set; } = "info";
public DateTime CreatedAt { get; set; }
public string? ProjectName { get; set; }
public string? IssueId { get; set; }
public Dictionary<string, object>? Metadata { get; set; }
}
public class TelemetryProjectDto
{
public Guid Id { get; set; }
public string Name { get; set; } = "";
public string Slug { get; set; } = "";
public string? Platform { get; set; }
public string Dsn { get; set; } = "";
public bool IsActive { get; set; }
public bool StackTraceGroupingEnabled { get; set; }
public bool JourneyTrackingEnabled { get; set; }
public bool SourceMapEnabled { get; set; }
public int SampleRate { get; set; }
public Guid? ProductId { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}
public class AlertPreferences
{
public bool PushEnabled { get; set; } = true;
public bool EmailEnabled { get; set; } = true;
public string MinimumLevel { get; set; } = "error";
public int SpikeThreshold { get; set; } = 10;
public bool NotifyOnNewIssue { get; set; } = true;
public bool NotifyOnRegression { get; set; } = true;
public bool NotifyOnSpike { get; set; } = true;
public TimeSpan? QuietHoursStart { get; set; }
public TimeSpan? QuietHoursEnd { get; set; }
}
#endregion
#region Internal Response Types
internal class UnreadCountResponse
{
public int Count { get; set; }
public int UnreadCount { get; set; }
}
#endregion