Generated from package comments and exported declarations. Edit the Go source, not this file.
adminreporting
import "codeberg.org/hemanta212/playgo/api/adminreporting"
Package adminreporting defines backend-owned reporting contracts for admin dashboards.
Reports expose derived business, exposure, accounting, and player risk summaries rather than raw SQL rows. Keeping the derivation in the backend is what stops two dashboards from computing the same metric slightly differently and quietly disagreeing.
Windows are normalized in the reporting timezone, and reports exclude internal tester and system activity by default, so operators can compare numbers without reimplementing business filters in clients.
Where a report carries a caveat, that caveat is part of the response and part of the number's meaning. Downstream consumers should surface it, not strip it - a figure shown without its caveat can be arithmetically correct and still mislead.
Constants
const (
ReportingTimezone = "America/New_York"
Player360RiskRuleVersion = "player360-risk/2026-07-15.v1"
)
const ManualMethodStaffRecorded = "staff_recorded"
ManualPayoutTipPlayersListed caps the per-player tip rows in a report.
const ManualPayoutTipPlayersListed = 50
Variables
var ErrInvalidQuery = errors.New("admin reporting: invalid query")
type AccountingSnapshot
type AccountingSnapshot struct {
AsOf time.Time
PlayerAccountCount int64
CashBalance apiledger.Cents
WithdrawableCashBalance apiledger.Cents
PendingWithdrawalBalance apiledger.Cents
FreeplayBalance apiledger.Cents
TotalOperationalLiability apiledger.Cents
}
type BusinessReport
type BusinessReport struct {
GeneratedAt time.Time
Window Window
Granularity Granularity
IncludeInternal bool
Finance FinanceMetrics
Outcomes OutcomeSummary
Exposure Exposure
Accounting AccountingSnapshot
Series []BusinessSeriesPoint
Providers []ProviderBreakdown
ManualMethods []ManualMethodBreakdown
ManualPayoutMethods []ManualPayoutMethodBreakdown
ManualPayoutTips ManualPayoutTips
}
type BusinessSeriesPoint
type BusinessSeriesPoint struct {
BucketStart time.Time
BucketEnd time.Time
Finance FinanceMetrics
Outcomes OutcomeSummary
}
type Exposure
type Exposure struct {
OpenDepositCount int64
OpenDepositAmount apiledger.Cents
OpenProviderTransferCount int64
OpenProviderTransferAmount apiledger.Cents
OpenWithdrawalCount int64
OpenWithdrawalAmount apiledger.Cents
TotalOpenCount int64
TotalOpenAmount apiledger.Cents
DepositReconciliationCount int64
ProviderTransferReconciliationCount int64
WithdrawalReconciliationCount int64
TotalReconciliationCount int64
}
type FinanceMetrics
type FinanceMetrics struct {
SettledDepositCount int64
SettledDepositAmount apiledger.Cents
SucceededWithdrawalCount int64
SucceededWithdrawalGrossAmount apiledger.Cents
SucceededWithdrawalActualNetAmount apiledger.Cents
SucceededWithdrawalActualFeeAmount apiledger.Cents
WithdrawalActualsMissingCount int64
NetCashFlowProxy apiledger.Cents
}
type Granularity
type Granularity string
const (
GranularityDay Granularity = "day"
GranularityMonth Granularity = "month"
)
type ManualMethodBreakdown
ManualMethodBreakdown reports house claim decisions and settled principal, keyed by immutable method ID rather than a mutable display label.
type ManualMethodBreakdown struct {
Method string
MethodName string
ApprovedCount int64
RejectedCount int64
PendingCount int64
ApprovedAmount apiledger.Cents
RejectedAmount apiledger.Cents
}
type ManualPayoutMethodBreakdown
ManualPayoutMethodBreakdown separates request/decision activity from settled money.
type ManualPayoutMethodBreakdown struct {
Method string
MethodName string
RequestedCount int64
RequestedAmount apiledger.Cents
ApprovedCount int64
ApprovedAmount apiledger.Cents
DeclinedCount int64
DeclinedAmount apiledger.Cents
PaidCount int64
PaidGrossAmount apiledger.Cents
PaidNetAmount apiledger.Cents
PaidFeeAmount apiledger.Cents
ActualsMissingCount int64
}
type ManualPayoutTipPlayer
ManualPayoutTipPlayer is one player's staff tips: earned on payouts paid in the window, waiting on payouts still open.
type ManualPayoutTipPlayer struct {
UserID uuid.UUID
Email string
DisplayName string
EarnedCount int64
EarnedAmount apiledger.Cents
WaitingCount int64
WaitingAmount apiledger.Cents
}
type ManualPayoutTips
ManualPayoutTips totals staff tips for every player and lists the top players.
type ManualPayoutTips struct {
EarnedCount int64
EarnedAmount apiledger.Cents
WaitingCount int64
WaitingAmount apiledger.Cents
PlayerCount int64
Players []ManualPayoutTipPlayer
}
type OutcomeCounts
type OutcomeCounts struct {
TotalCount int64
SuccessCount int64
TerminalFailureCount int64
PendingCount int64
UnresolvedCount int64
ResolvedCount int64
SuccessRateBPS int64
}
type OutcomeSummary
type OutcomeSummary struct {
Deposits OutcomeCounts
Withdrawals OutcomeCounts
ProviderTransfers OutcomeCounts
}
type PlayerReport
type PlayerReport struct {
GeneratedAt time.Time
Window Window
Granularity Granularity
IncludeInternal bool
Summary PlayerSummary
AccountStatuses []StatusCount
RiskLevels []RiskLevelCount
Series []PlayerSeriesPoint
}
type PlayerSeriesPoint
type PlayerSeriesPoint struct {
BucketStart time.Time
BucketEnd time.Time
NewPlayers int64
BusinessActivePlayers int64
Depositors int64
FirstTimeDepositors int64
GameActivePlayers int64
WithdrawingPlayers int64
}
type PlayerSummary
type PlayerSummary struct {
TotalPlayerAccounts int64
ActivePlayerAccounts int64
NewPlayers int64
BusinessActivePlayers int64
Depositors int64
FirstTimeDepositors int64
GameActivePlayers int64
WithdrawingPlayers int64
RiskPlayers int64
ReconciliationPlayers int64
}
type ProviderBreakdown
type ProviderBreakdown struct {
ProviderCode string
Finance FinanceMetrics
Outcomes OutcomeSummary
}
type Query
type Query struct {
From *time.Time
To *time.Time
Granularity Granularity
IncludeInternal bool
}
type RechargeCohorts
RechargeCohorts is a point-in-time recharge recency snapshot: successful wallet deposits and completed wallet-to-game loads. It says nothing about gameplay activity.
type RechargeCohorts struct {
AsOf time.Time
EligiblePlayers int64
Deposits RechargeRecency
GameLoads RechargeRecency
}
type RechargeFilter
RechargeFilter is the directory's existing AdminRechargeRecencyFilter vocabulary.
type RechargeFilter string
const (
RechargeNever RechargeFilter = "never"
RechargeInactive2d RechargeFilter = "inactive_2d"
RechargeInactive3d RechargeFilter = "inactive_3d"
RechargeInactive7d RechargeFilter = "inactive_7d"
)
func (RechargeFilter) Valid
func (f RechargeFilter) Valid() bool
type RechargeRecency
RechargeRecency counts active external players by how long ago their newest SUCCESSFUL event was, in rolling 24-hour multiples from RechargeCohorts.AsOf. Never (no success at all) is disjoint from the Inactive buckets; the Inactive buckets are cumulative (Inactive7d is a subset of Inactive3d, then Inactive2d).
type RechargeRecency struct {
Never int64
Inactive2d int64
Inactive3d int64
Inactive7d int64
}
type RiskLevelCount
type RiskLevelCount struct {
Level string
Count int64
}
type StatusCount
type StatusCount struct {
Status string
Count int64
}
type Window
type Window struct {
From time.Time
To time.Time
}
Generated by gomarkdoc