mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 02:52:53 +00:00
feat: Mark unused context parameters with underscore and refactor fraud metrics status handling
- Mark unused context parameters with underscore in analyzeCompetitors, identifyOpportunities, and PredictFailure - Replace if-else chain with switch statement for fraud alert status handling in GetFraudMetrics - Add OptimizationResult, PricingMetrics, RatePlan, and HistoricalDataPoint types to pricing/types.go
This commit is contained in:
@@ -216,7 +216,7 @@ func (s *MarketAnalysisService) calculateDemographicMetrics(ctx context.Context,
|
||||
}
|
||||
|
||||
// analyzeCompetitors analyzes competitive landscape
|
||||
func (s *MarketAnalysisService) analyzeCompetitors(ctx context.Context, metrics *MarketMetrics) {
|
||||
func (s *MarketAnalysisService) analyzeCompetitors(_ context.Context, metrics *MarketMetrics) {
|
||||
competitors := []struct {
|
||||
name string
|
||||
subs int64
|
||||
@@ -272,7 +272,7 @@ func (s *MarketAnalysisService) analyzeCompetitors(ctx context.Context, metrics
|
||||
}
|
||||
|
||||
// identifyOpportunities identifies market penetration opportunities
|
||||
func (s *MarketAnalysisService) identifyOpportunities(ctx context.Context, metrics *MarketMetrics) {
|
||||
func (s *MarketAnalysisService) identifyOpportunities(_ context.Context, metrics *MarketMetrics) {
|
||||
opportunities := []OpportunityMetrics{
|
||||
{
|
||||
Country: "India",
|
||||
|
||||
@@ -187,7 +187,7 @@ func (s *PredictiveMaintenanceService) GetMaintenanceAlerts(ctx context.Context,
|
||||
}
|
||||
|
||||
// PredictFailure predicts failure for an asset
|
||||
func (s *PredictiveMaintenanceService) PredictFailure(ctx context.Context, assetID string) (*MaintenanceAlert, error) {
|
||||
func (s *PredictiveMaintenanceService) PredictFailure(_ context.Context, assetID string) (*MaintenanceAlert, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
|
||||
@@ -141,3 +141,45 @@ type DiscountStatistics struct {
|
||||
SmallestDiscount float64 `json:"smallest_discount"`
|
||||
TotalDiscountValue float64 `json:"total_discount_value"`
|
||||
}
|
||||
type OptimizationResult struct {
|
||||
RatePlanID string `json:"rate_plan_id"`
|
||||
Strategy OptimizationStrategy `json:"strategy"`
|
||||
CurrentPrice float64 `json:"current_price"`
|
||||
OptimalPrice float64 `json:"optimal_price"`
|
||||
PriceChange float64 `json:"price_change_pct"`
|
||||
ExpectedRevenue float64 `json:"expected_revenue"`
|
||||
ExpectedDemand int64 `json:"expected_demand"`
|
||||
Confidence float64 `json:"confidence"` // 0-100
|
||||
Reasoning []string `json:"reasoning"`
|
||||
Risks []string `json:"risks"`
|
||||
Recommendations []string `json:"recommendations"`
|
||||
GeneratedAt time.Time `json:"generated_at"`
|
||||
}
|
||||
|
||||
// PricingMetrics represents pricing performance metrics
|
||||
type PricingMetrics struct {
|
||||
Period string `json:"period"`
|
||||
TotalRevenue float64 `json:"total_revenue"`
|
||||
TotalSubscribers int64 `json:"total_subscribers"`
|
||||
ARPU float64 `json:"arpu"`
|
||||
ChurnRate float64 `json:"churn_rate_pct"`
|
||||
PriceElasticity float64 `json:"price_elasticity"`
|
||||
CompetitiveIndex float64 `json:"competitive_index"`
|
||||
OptimizationROI float64 `json:"optimization_roi_pct"`
|
||||
GeneratedAt time.Time `json:"generated_at"`
|
||||
}
|
||||
// RatePlan represents a rate plan (simplified)
|
||||
type RatePlan struct {
|
||||
ID string `gorm:"primaryKey"`
|
||||
Name string `json:"name"`
|
||||
BasePrice float64 `json:"base_price"`
|
||||
Currency string `json:"currency"`
|
||||
}
|
||||
|
||||
// HistoricalDataPoint represents historical pricing and demand data
|
||||
type HistoricalDataPoint struct {
|
||||
Date time.Time `json:"date"`
|
||||
Price float64 `json:"price"`
|
||||
Demand int64 `json:"demand"`
|
||||
Revenue float64 `json:"revenue"`
|
||||
}
|
||||
|
||||
@@ -113,9 +113,10 @@ func (s *FraudDetectionService) GetFraudMetrics(_ context.Context, period string
|
||||
m.TotalAlerts++
|
||||
m.ByType[a.Type]++
|
||||
m.BySeverity[a.Severity]++
|
||||
if a.Status == "resolved" {
|
||||
switch a.Status {
|
||||
case "resolved":
|
||||
m.ResolvedAlerts++
|
||||
} else if a.Status == "false_positive" {
|
||||
case "false_positive":
|
||||
m.FalsePositives++
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user