128 lines
3.8 KiB
Go
128 lines
3.8 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
// TODO: turn status into an enum
|
|
// Status represents the status of an event.
|
|
// 0 Not Started
|
|
// 1 InPlay
|
|
// 2 TO BE FIXED
|
|
// 3 Ended
|
|
// 4 Postponed
|
|
// 5 Cancelled
|
|
// 6 Walkover
|
|
// 7 Interrupted
|
|
// 8 Abandoned
|
|
// 9 Retired
|
|
// 10 Suspended
|
|
// 11 Decided by FA
|
|
// 99 Removed
|
|
type EventStatus string
|
|
|
|
const (
|
|
STATUS_PENDING EventStatus = "upcoming"
|
|
STATUS_IN_PLAY EventStatus = "in_play"
|
|
STATUS_TO_BE_FIXED EventStatus = "to_be_fixed"
|
|
STATUS_ENDED EventStatus = "ended"
|
|
STATUS_POSTPONED EventStatus = "postponed"
|
|
STATUS_CANCELLED EventStatus = "cancelled"
|
|
STATUS_WALKOVER EventStatus = "walkover"
|
|
STATUS_INTERRUPTED EventStatus = "interrupted"
|
|
STATUS_ABANDONED EventStatus = "abandoned"
|
|
STATUS_RETIRED EventStatus = "retired"
|
|
STATUS_SUSPENDED EventStatus = "suspended"
|
|
STATUS_DECIDED_BY_FA EventStatus = "decided_by_fa"
|
|
STATUS_REMOVED EventStatus = "removed"
|
|
)
|
|
|
|
type Event struct {
|
|
ID string
|
|
SportID int32
|
|
MatchName string
|
|
HomeTeam string
|
|
AwayTeam string
|
|
HomeTeamID int32
|
|
AwayTeamID int32
|
|
HomeKitImage string
|
|
AwayKitImage string
|
|
LeagueID int32
|
|
LeagueName string
|
|
LeagueCC string
|
|
StartTime string
|
|
Score string
|
|
MatchMinute int
|
|
TimerStatus string
|
|
AddedTime int
|
|
MatchPeriod int
|
|
IsLive bool
|
|
Status string
|
|
Source string
|
|
}
|
|
|
|
type BetResult struct {
|
|
Success int `json:"success"`
|
|
Pager struct {
|
|
Page int `json:"page"`
|
|
PerPage int `json:"per_page"`
|
|
Total int `json:"total"`
|
|
}
|
|
Results []struct {
|
|
ID string `json:"id"`
|
|
SportID string `json:"sport_id"`
|
|
Time string `json:"time"`
|
|
League struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
} `json:"league"`
|
|
Home struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
} `json:"home"`
|
|
Away *struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
} `json:"away"`
|
|
} `json:"results"`
|
|
}
|
|
|
|
type UpcomingEvent struct {
|
|
ID string `json:"id"` // Event ID
|
|
SportID int32 `json:"sport_id"` // Sport ID
|
|
MatchName string `json:"match_name"` // Match or event name
|
|
HomeTeam string `json:"home_team"` // Home team name (if available)
|
|
AwayTeam string `json:"away_team"` // Away team name (can be empty/null)
|
|
HomeTeamID int32 `json:"home_team_id"` // Home team ID
|
|
AwayTeamID int32 `json:"away_team_id"` // Away team ID (can be empty/null)
|
|
HomeKitImage string `json:"home_kit_image"` // Kit or image for home team (optional)
|
|
AwayKitImage string `json:"away_kit_image"` // Kit or image for away team (optional)
|
|
LeagueID int32 `json:"league_id"` // League ID
|
|
LeagueName string `json:"league_name"` // League name
|
|
LeagueCC string `json:"league_cc"` // League country code
|
|
StartTime time.Time `json:"start_time"` // Converted from "time" field in UNIX format
|
|
Source string `json:"source"` // bet api provider (bet365, betfair)
|
|
Status EventStatus `json:"status"` //Match Status for event
|
|
IsFeatured bool `json:"is_featured"` //Whether the event is featured or not
|
|
IsMonitored bool `json:"is_monitored"` //Whether the event is monitored or not
|
|
IsActive bool `json:"is_active"` //Whether the event is active or not
|
|
}
|
|
type MatchResult struct {
|
|
EventID string
|
|
FullScore string
|
|
HalfScore string
|
|
Status string
|
|
Scores map[string]map[string]string
|
|
}
|
|
|
|
type EventFilter struct {
|
|
Query ValidString
|
|
SportID ValidInt32
|
|
LeagueID ValidInt32
|
|
CountryCode ValidString
|
|
FirstStartTime ValidTime
|
|
LastStartTime ValidTime
|
|
Limit ValidInt64
|
|
Offset ValidInt64
|
|
MatchStatus ValidString // e.g., "upcoming", "in_play", "ended"
|
|
Featured ValidBool
|
|
}
|