Yimaru-BackEnd/internal/domain/analytics.go

122 lines
3.9 KiB
Go

package domain
import "time"
type AnalyticsLabelCount struct {
Label string `json:"label"`
Count int64 `json:"count"`
}
type AnalyticsLabelAmount struct {
Label string `json:"label"`
Count int64 `json:"count"`
Amount float64 `json:"amount"`
}
type AnalyticsRevenueByPlan struct {
PlanName string `json:"plan_name"`
Currency string `json:"currency"`
Revenue float64 `json:"revenue"`
}
type AnalyticsTimePoint struct {
Date time.Time `json:"date"`
Count int64 `json:"count"`
}
type AnalyticsRevenueTimePoint struct {
Date time.Time `json:"date"`
Revenue float64 `json:"revenue"`
}
type AnalyticsUsersSection struct {
TotalUsers int64 `json:"total_users"`
NewToday int64 `json:"new_today"`
NewWeek int64 `json:"new_week"`
NewMonth int64 `json:"new_month"`
ByRole []AnalyticsLabelCount `json:"by_role"`
ByStatus []AnalyticsLabelCount `json:"by_status"`
ByAgeGroup []AnalyticsLabelCount `json:"by_age_group"`
ByKnowledgeLevel []AnalyticsLabelCount `json:"by_knowledge_level"`
ByRegion []AnalyticsLabelCount `json:"by_region"`
RegistrationsLast30Days []AnalyticsTimePoint `json:"registrations_last_30_days"`
}
type AnalyticsSubscriptionsSection struct {
TotalSubscriptions int64 `json:"total_subscriptions"`
ActiveSubscriptions int64 `json:"active_subscriptions"`
NewToday int64 `json:"new_today"`
NewWeek int64 `json:"new_week"`
NewMonth int64 `json:"new_month"`
ByStatus []AnalyticsLabelCount `json:"by_status"`
RevenueByPlan []AnalyticsRevenueByPlan `json:"revenue_by_plan"`
NewSubscriptionsLast30Days []AnalyticsTimePoint `json:"new_subscriptions_last_30_days"`
}
type AnalyticsPaymentsSection struct {
TotalRevenue float64 `json:"total_revenue"`
AvgTransactionValue float64 `json:"avg_transaction_value"`
TotalPayments int64 `json:"total_payments"`
SuccessfulPayments int64 `json:"successful_payments"`
ByStatus []AnalyticsLabelAmount `json:"by_status"`
ByMethod []AnalyticsLabelAmount `json:"by_method"`
RevenueLast30Days []AnalyticsRevenueTimePoint `json:"revenue_last_30_days"`
}
type AnalyticsCoursesSection struct {
TotalCategories int64 `json:"total_categories"`
TotalCourses int64 `json:"total_courses"`
TotalSubCourses int64 `json:"total_sub_courses"`
TotalVideos int64 `json:"total_videos"`
}
type AnalyticsContentSection struct {
TotalQuestions int64 `json:"total_questions"`
TotalQuestionSets int64 `json:"total_question_sets"`
QuestionsByType []AnalyticsLabelCount `json:"questions_by_type"`
QuestionSetsByType []AnalyticsLabelCount `json:"question_sets_by_type"`
}
type AnalyticsNotificationsSection struct {
TotalSent int64 `json:"total_sent"`
ReadCount int64 `json:"read_count"`
UnreadCount int64 `json:"unread_count"`
ByChannel []AnalyticsLabelCount `json:"by_channel"`
ByType []AnalyticsLabelCount `json:"by_type"`
}
type AnalyticsIssuesSection struct {
TotalIssues int64 `json:"total_issues"`
ResolvedIssues int64 `json:"resolved_issues"`
ResolutionRate float64 `json:"resolution_rate"`
ByStatus []AnalyticsLabelCount `json:"by_status"`
ByType []AnalyticsLabelCount `json:"by_type"`
}
type AnalyticsTeamSection struct {
TotalMembers int64 `json:"total_members"`
ByRole []AnalyticsLabelCount `json:"by_role"`
ByStatus []AnalyticsLabelCount `json:"by_status"`
}
type AnalyticsDashboard struct {
GeneratedAt time.Time `json:"generated_at"`
Users AnalyticsUsersSection `json:"users"`
Subscriptions AnalyticsSubscriptionsSection `json:"subscriptions"`
Payments AnalyticsPaymentsSection `json:"payments"`
Courses AnalyticsCoursesSection `json:"courses"`
Content AnalyticsContentSection `json:"content"`
Notifications AnalyticsNotificationsSection `json:"notifications"`
Issues AnalyticsIssuesSection `json:"issues"`
Team AnalyticsTeamSection `json:"team"`
}