-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
416 lines (373 loc) · 10.8 KB
/
types.go
File metadata and controls
416 lines (373 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
// ABOUTME: Type definitions for SleeperPy application
// ABOUTME: Includes data structures for players, leagues, transactions, and caching
package main
import (
"sync"
"time"
)
// Cache for Boris Chen tiers with TTL
type tiersCache struct {
sync.RWMutex
data map[string]map[string][][]string
timestamp map[string]time.Time
ttl time.Duration
}
// Dynasty value data structure
type DynastyValue struct {
Name string
Position string
Value1QB int
Value2QB int
ScrapeDate string
}
// Cache for dynasty values
type dynastyCache struct {
sync.RWMutex
data map[string]DynastyValue // key: normalized player name
timestamp time.Time
ttl time.Duration
}
// Cache for Sleeper players API response
type playersCache struct {
sync.RWMutex
data map[string]interface{}
timestamp time.Time
ttl time.Duration
}
type PlayerRow struct {
Pos string
Name string
Tier interface{}
IsTierWorseThanBench bool
ShouldSwapIn bool
IsFreeAgent bool
IsUpgrade bool
UpgradeFor string // Name of player this FA is better than
UpgradeType string // "Starter" or "Bench" or ""
IsFlex bool // Heuristic FLEX indicator
IsSuperflex bool // Heuristic SUPERFLEX indicator
DynastyValue int // Dynasty value from DynastyProcess (0-10000 scale)
Age int // Player age from Sleeper API
RosterPercent float64
}
type TeamAgeData struct {
TeamName string
OwnerName string
AvgAge float64
Rank int // Standings rank (wins)
RosterID int
IsUserTeam bool
RosterValue int // Total dynasty value of roster
}
type PowerRanking struct {
Rank int
TeamName string
RosterValue int
Wins int
Losses int
AvgAge float64
Strategy string // "Win Now", "Contending", "Rebuilding"
IsUserTeam bool
ValueRank int // Rank by dynasty value
StandingRank int // Rank by wins
}
type DraftPick struct {
Round int
Year int
OwnerName string // "You" or team name
OriginalName string // Original owner if traded, empty if not traded
RosterID int
IsYours bool
}
type ProjectedDraftPick struct {
Year int
Round int
OverallPick int // Projected overall pick number (e.g., 1.01 = 1, 1.12 = 12, 2.01 = 13)
ProjectedPosition int // Projected position within round (1-12)
OwnerName string // Team that currently owns this pick
OriginalOwner string // Original owner if traded
CurrentStanding int // Current standing of the team (1 = worst record, 12 = best)
TeamRecord string // e.g., "3-11"
IsYours bool
}
type PositionalKTC struct {
QB int
RB int
WR int
TE int
}
type TradeTarget struct {
TeamName string
Reason string
YourSurplus string
TheirSurplus string
YourSurplusKTC int
TheirSurplusKTC int
Proposal *TradeProposal // Feature #9: Trade coach proposal
}
type TradeProposal struct {
TargetTeamName string
YourOffer []ProposalPlayer
TheirReturn []ProposalPlayer
ValueDelta int
Fairness string
DraftMessage string
Rationale string
RiskLevel string
WinNowImpact int
FutureImpact int
}
type ProposalPlayer struct {
Name string
Position string
DynastyValue int
Tier string
}
type PlayerNews struct {
PlayerName string
Position string
NewsText string
Source string
Timestamp time.Time
InjuryStatus string
InjuryBodyPart string
InjuryNotes string
IsStarter bool
DynastyValue int
ImportanceScore int // Feature #4: 0-200 range for news prioritization
}
type CompressedNews struct {
TimeWindow string // "This Week" or "Last 3 Months"
TopHeadlines []PlayerNews // Max 3 items
TotalItems int // Total news items for user's players
}
type ContextCard struct {
Title string // "Age Rank", "Value Rank", etc.
Value string // "3rd youngest", "8,450 (#2)"
Trend string // "↗ Getting younger", "→ Stable", etc.
Icon string // Single emoji for visual scanning
Color string // Color code for styling
}
type ValueChange struct {
PlayerName string
Position string
OldValue int
NewValue int
Delta int
DeltaPct float64
IsRiser bool
IsOwned bool // User owns this player
}
type TradeFairness struct {
Winner string // "TeamA" or "TeamB" or "Fair"
ValueDelta int // Absolute KTC difference
ValueDeltaPct float64 // % of smaller team's roster value
Fleeced bool // Extreme gap flag
Context string // "Competing strategy", "Rebuilding", "Extreme value gap"
WinnerTeam string // Team that got better value
DisplayBadge string // "🟢 +12%", "🔴 FLEECED", "→ Fair"
}
type TradeRetrospective struct {
Winner string // Who won the trade overall
ValueSwing int // How much value swung
DaysElapsed int // Days since trade
WinnerGain string // "+500 value" or similar
}
type Transaction struct {
Type string // "trade", "waiver", "free_agent"
LeagueID string
Timestamp time.Time
Description string
TeamNames []string
PlayerNames []string
Team1 string
Team2 string
Team1Gave []string
Team2Gave []string
Team1GaveValue int // Total dynasty value of Team1's players
Team2GaveValue int // Total dynasty value of Team2's players
NetValue int // Net value difference (positive = Team1 gained value)
AddedPlayer string
DroppedPlayer string
Fairness TradeFairness // Feature #3: Trade fairness detection
Retrospective TradeRetrospective // Feature #5: Trade retrospective analysis
}
type RookieProspect struct {
Name string
Position string
College string
Value int
Rank int
Year int // Draft year
}
type LeagueTrends struct {
MostActiveTeams []TeamActivity
HotWaiverPlayers []WaiverActivity
TradeVolume int
WaiverVolume int
PositionScarcity map[string]int // Position -> number of available players
}
type TeamActivity struct {
TeamName string
Transactions int
Trades int
WaiverClaims int
ActivityLevel string // "Very Active", "Active", "Quiet"
}
type WaiverActivity struct {
PlayerName string
Position string
ClaimCount int
LastClaimed string // Time ago
}
type Action struct {
Priority int // 1-5 (1 = highest)
Category string // "swap", "waiver", "trade", "injury", "lineup"
Title string // "Swap Starter"
Description string // "Start Jahmyr Gibbs over James Conner"
Impact string // "+1.2 tier upgrade"
Link string // "#player-name" anchor link
Completed bool // User checked it off
WeekID string // "2026-W14" for persistence
}
type WaiverRecommendation struct {
Player PlayerRow
Score int
Priority string
SuggestedBid int
Rationale string
ImpactType string
Role string
UsageSignal string
TierDelta float64
PositionScarcity int
}
type SeasonPlan struct {
CurrentPhase string
PhaseDescription string
Strategy string
ScheduleDifficulty string
ScheduleNote string
KeyDates []KeyDate
Recommendations []string
TradeWindow string
NextMilestone string
WeeksRemaining int
}
type KeyDate struct {
Date time.Time
Label string
DaysAway int
Importance string
ActionItems []string
}
type DraftStrategy struct {
OverallApproach string
Needs []RookieDraftNeed
PickInventory string
CapitalLevel string
Recommendations []string
}
type RookieDraftNeed struct {
Position string
Priority int
Reasoning string
TargetArchetype string
DraftRange string
PicksAvailable int
Examples []string
}
type LeagueData struct {
LeagueName string
Season string
Scoring string
IsDynasty bool
HasMatchups bool
DynastyValueDate string
LeagueSize int
RosterSlots string
Starters []PlayerRow
Unranked []PlayerRow
AvgTier string
AvgOppTier string
WinProb string
Bench []PlayerRow
BenchUnranked []PlayerRow
FreeAgentsByPos map[string][]PlayerRow
TopFreeAgents []PlayerRow
TopFreeAgentsByValue []PlayerRow
TotalRosterValue int
UserAvgAge float64
TeamAges []TeamAgeData
PowerRankings []PowerRanking
DraftPicks []DraftPick
ProjectedDraftPicks []ProjectedDraftPick
TradeTargets []TradeTarget
PositionalBreakdown PositionalKTC
PlayerNewsFeed []PlayerNews
BreakoutCandidates []PlayerRow
AgingPlayers []PlayerRow
RecentTransactions []Transaction
TopRookies []RookieProspect
LeagueTrends LeagueTrends
PremiumTeamTalk string
WeeklyActions []Action // Feature #2: Weekly Action List
CompressedNews CompressedNews // Feature #4: News Signal Compression
ContextCards []ContextCard // Feature #6: League Context Cards
ValueChanges []ValueChange // Feature #7: Value Change Tracker
WaiverRecommendations []WaiverRecommendation // Feature #10: Advanced Waiver Model
SeasonPlan SeasonPlan // Feature #11: Season Planner
DraftStrategy DraftStrategy // Feature #12: Rookie Draft Needs
}
type TiersPage struct {
Error string
Leagues []LeagueData
Username string
IsPremium bool
PremiumEnabled bool
PremiumOverview string
}
type IndexPage struct {
SavedUsername string
SavedUsernames []string
}
// Dashboard types for cross-league overview
type LeagueSummary struct {
LeagueID string
LeagueName string
Season string // "2024", "2025" - year of the league
Scoring string
IsDynasty bool
IsSuperFlex bool
LeagueSize int
// Dynasty metrics
TotalRosterValue int
ValueRank int // 1-12
ValueTrend string // "↗ +5%", "↘ -3%", "→ stable"
AvgAge float64
AgeRank int
DraftPicksSummary string // "2026 1st, 2027 1st, 2nd"
// Season metrics
Record string // "8-5" or empty if offseason
PlayoffStatus string // "Clinched", "In Hunt", "Eliminated", ""
// Action items (for Feature #2)
ActionCount int
LastUpdated time.Time
}
type DashboardPage struct {
Username string
LeagueSummaries []LeagueSummary
TotalLeagues int
DynastyCount int
RedraftCount int
}
// Cache for roster value trends (24h comparison)
type CachedRosterValue struct {
RosterValue int
Timestamp time.Time
}
type valueTrendCache struct {
sync.RWMutex
data map[string]CachedRosterValue // key: "username:leagueID"
ttl time.Duration
}