Initial push

This commit is contained in:
2025-07-20 03:41:39 -04:00
commit d315f5d26e
118 changed files with 25819 additions and 0 deletions

View File

@@ -0,0 +1,111 @@
namespace SampleWebApi.Models;
public class BulkUpdateResult
{
public string OperationId { get; set; } = "";
public int TotalProducts { get; set; }
public int UpdatedProducts { get; set; }
public int FailedProducts { get; set; }
public bool Completed { get; set; }
public string? CheckpointId { get; set; }
public int TotalProcessed { get; set; }
public int SuccessCount { get; set; }
public int FailureCount { get; set; }
public TimeSpan Duration { get; set; }
public List<string> Errors { get; set; } = new();
}
public class ReportRequest
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public List<string> MetricsToInclude { get; set; } = new();
public bool IncludeDetailedBreakdown { get; set; }
}
public class ReportResult
{
public string ReportId { get; set; } = "";
public DateTime GeneratedAt { get; set; }
public Dictionary<string, object> Metrics { get; set; } = new();
public List<CategoryBreakdown> CategoryBreakdowns { get; set; } = new();
public List<CustomerActivity> TopCustomers { get; set; } = new();
public List<ProductPerformance> TopProducts { get; set; } = new();
public bool Completed { get; set; }
public double ProgressPercent { get; set; }
public long ProcessingTimeMs { get; set; }
public long MemoryUsedMB { get; set; }
}
public class CategoryBreakdown
{
public string Category { get; set; } = "";
public decimal Revenue { get; set; }
public int OrderCount { get; set; }
public decimal AverageOrderValue { get; set; }
}
public class CustomerActivity
{
public string CustomerId { get; set; } = "";
public string CustomerName { get; set; } = "";
public decimal TotalSpent { get; set; }
public int OrderCount { get; set; }
}
public class ProductPerformance
{
public int ProductId { get; set; }
public string ProductName { get; set; } = "";
public decimal Revenue { get; set; }
public int QuantitySold { get; set; }
}
public class PatternAnalysisRequest
{
public string PatternType { get; set; } = "";
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public Dictionary<string, object> Parameters { get; set; } = new();
public int MaxOrdersToAnalyze { get; set; } = 100000;
public bool IncludeCustomerSegmentation { get; set; }
public bool IncludeSeasonalAnalysis { get; set; }
}
public class PatternResult
{
public string Pattern { get; set; } = "";
public double Confidence { get; set; }
public Dictionary<string, object> Data { get; set; } = new();
}
public class MemoryStats
{
public long CurrentMemoryUsageMB { get; set; }
public long PeakMemoryUsageMB { get; set; }
public int ExternalSortOperations { get; set; }
public int CheckpointsSaved { get; set; }
public long DataSpilledToDiskMB { get; set; }
public double CacheHitRate { get; set; }
public string CurrentMemoryPressure { get; set; } = "";
}
public class BulkPriceUpdateRequest
{
public string? CategoryFilter { get; set; }
public decimal PriceMultiplier { get; set; }
}
public class OrderAggregate
{
public DateTime Hour { get; set; }
public int OrderCount { get; set; }
public decimal TotalRevenue { get; set; }
public int UniqueCustomers { get; set; }
}
public class MemoryOptions
{
public int MaxMemoryMB { get; set; } = 512;
public int WarningThresholdPercent { get; set; } = 80;
}

View File

@@ -0,0 +1,149 @@
namespace SampleWebApi.Models;
public class Product
{
public int Id { get; set; }
public string Name { get; set; } = "";
public string Description { get; set; } = "";
public string Category { get; set; } = "";
public decimal Price { get; set; }
public int StockQuantity { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public class Order
{
public int Id { get; set; }
public string CustomerId { get; set; } = "";
public DateTime OrderDate { get; set; }
public decimal TotalAmount { get; set; }
public string Status { get; set; } = "";
public List<OrderItem> Items { get; set; } = new();
}
public class OrderItem
{
public int Id { get; set; }
public int OrderId { get; set; }
public int ProductId { get; set; }
public int Quantity { get; set; }
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
public Order Order { get; set; } = null!;
public Product Product { get; set; } = null!;
}
public class Customer
{
public string Id { get; set; } = "";
public string Name { get; set; } = "";
public string Email { get; set; } = "";
public DateTime RegisteredAt { get; set; }
public List<Order> Orders { get; set; } = new();
}
public class PagedResult<T>
{
public List<T> Items { get; set; } = new();
public int Page { get; set; }
public int PageSize { get; set; }
public int TotalCount { get; set; }
public int TotalPages => (int)Math.Ceiling(TotalCount / (double)PageSize);
public bool HasNextPage => Page < TotalPages;
public bool HasPreviousPage => Page > 1;
}
public class ProductStatistics
{
public int TotalProducts { get; set; }
public decimal AveragePrice { get; set; }
public decimal MinPrice { get; set; }
public decimal MaxPrice { get; set; }
public Dictionary<string, int> ProductsByCategory { get; set; } = new();
public Dictionary<string, decimal> AveragePriceByCategory { get; set; } = new();
public long ComputationTimeMs { get; set; }
public string ComputationMethod { get; set; } = ""; // "InMemory" or "External"
}
public class CategoryRevenue
{
public string Category { get; set; } = "";
public decimal TotalRevenue { get; set; }
public int OrderCount { get; set; }
public decimal AverageOrderValue { get; set; }
}
public class CustomerSummary
{
public string CustomerId { get; set; } = "";
public string CustomerName { get; set; } = "";
public int TotalOrders { get; set; }
public decimal TotalSpent { get; set; }
public decimal AverageOrderValue { get; set; }
public DateTime FirstOrderDate { get; set; }
public DateTime LastOrderDate { get; set; }
}
public class RealTimeAnalytics
{
public DateTime Timestamp { get; set; }
public int OrdersLastHour { get; set; }
public decimal RevenueLastHour { get; set; }
public int ActiveCustomers { get; set; }
public Dictionary<string, int> TopProductsLastHour { get; set; } = new();
public double OrdersPerMinute { get; set; }
}
public class BulkUpdateState
{
public string OperationId { get; set; } = "";
public int ProcessedCount { get; set; }
public int UpdatedCount { get; set; }
public int FailedCount { get; set; }
public DateTime LastCheckpoint { get; set; }
}
public class ReportState
{
public string ReportId { get; set; } = "";
public int ProgressPercent { get; set; }
public Dictionary<string, object> PartialResults { get; set; } = new();
public DateTime LastCheckpoint { get; set; }
}
public class PatternAnalysisResult
{
public Dictionary<string, double> OrderPatterns { get; set; } = new();
public List<CustomerSegment> CustomerSegments { get; set; } = new();
public SeasonalAnalysis? SeasonalAnalysis { get; set; }
public long AnalysisTimeMs { get; set; }
public long RecordsProcessed { get; set; }
public long MemoryUsedMB { get; set; }
}
public class CustomerSegment
{
public string SegmentName { get; set; } = "";
public int CustomerCount { get; set; }
public Dictionary<string, double> Characteristics { get; set; } = new();
}
public class SeasonalAnalysis
{
public Dictionary<string, double> MonthlySalesPattern { get; set; } = new();
public Dictionary<string, double> WeeklySalesPattern { get; set; } = new();
public List<string> PeakPeriods { get; set; } = new();
}
public class MemoryStatistics
{
public long CurrentMemoryUsageMB { get; set; }
public long PeakMemoryUsageMB { get; set; }
public int ExternalSortOperations { get; set; }
public int CheckpointsSaved { get; set; }
public long DataSpilledToDiskMB { get; set; }
public double CacheHitRate { get; set; }
public string CurrentMemoryPressure { get; set; } = "";
}