Yimaru-BackEnd/internal/domain/enet_pulse.go

465 lines
16 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package domain
import "time"
type EnetPulseSport struct {
ID string `json:"id"`
Name string `json:"name"`
N string `json:"n"`
UT string `json:"ut"`
}
type SportsResponse struct {
Sports map[string]EnetPulseSport `json:"sports"`
}
type TournamentTemplatesResponse struct {
TournamentTemplates map[string]TournamentTemplate `json:"tournament_templates"`
}
type TournamentTemplate struct {
ID string `json:"id"`
Name string `json:"name"`
SportFK string `json:"sportFK"`
Gender string `json:"gender"`
N string `json:"n"`
UT string `json:"ut"`
}
type TournamentTemplateParticipantsResponse struct {
// Map of participant entries or whatever eAPI returns
Participants map[string]TournamentParticipant `json:"participants"`
}
type TournamentTemplateParticipant struct {
ID string `json:"id"`
DateFrom string `json:"date_from"`
DateTo string `json:"date_to"`
Active string `json:"active"`
N string `json:"n"`
UT string `json:"ut"`
// plus nested participant info
Participant interface{} `json:"participant"`
}
// For optional parameters
type ParticipantsOptions struct {
IncludeProperties bool
IncludeParticipantProperties bool
IncludeParticipantSports bool
IncludeCountries bool
IncludeCountryCodes bool
ParticipantType string
}
type Tournament struct {
ID string `json:"id"`
Name string `json:"name"`
TournamentTemplateFK string `json:"tournament_templateFK"`
N string `json:"n"`
UT string `json:"ut"`
}
type TournamentsResponse struct {
Tournaments map[string]Tournament `json:"tournaments"`
}
type TournamentParticipant struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Gender string `json:"gender"`
CountryFK string `json:"countryFK"`
Country string `json:"country_name"`
}
type TournamentWithParticipants struct {
ID string `json:"id"`
Name string `json:"name"`
Participants map[string]map[string]interface{} `json:"participants"` // or a typed struct
}
type TournamentParticipantsResponse struct {
Tournaments map[string]TournamentWithParticipants `json:"tournaments"`
}
type TournamentStage struct {
ID string `json:"id"`
Name string `json:"name"`
TournamentFK string `json:"tournamentFK"`
Gender string `json:"gender"`
CountryFK string `json:"countryFK"`
StartDate string `json:"startdate"`
EndDate string `json:"enddate"`
N string `json:"n"`
UT string `json:"ut"`
CountryName string `json:"country_name"`
}
type TournamentStagesResponse struct {
TournamentStages map[string]TournamentStage `json:"tournament_stages"`
}
type TournamentStageParticipant struct {
ID string `json:"id"`
Name string `json:"name"`
Gender string `json:"gender"`
Type string `json:"type"`
CountryFK string `json:"countryFK"`
Country string `json:"country_name"`
}
type TournamentStageWithParticipants struct {
ID string `json:"id"`
Name string `json:"name"`
TournamentFK string `json:"tournamentFK"`
Participants map[string]map[string]interface{} `json:"participants"` // can refine later
}
type TournamentStageParticipantsResponse struct {
TournamentStages map[string]TournamentStageWithParticipants `json:"tournament_stages"`
}
type DailyEventsRequest struct {
SportFK int // one of these three required
TournamentTemplateFK int
TournamentStageFK int
Date string // YYYY-MM-DD optional
Live string // yes/no optional
IncludeVenue string // yes/no optional
StatusType string // e.g. inprogress, finished...
IncludeEventProperties string // yes/no optional
IncludeCountryCodes string // yes/no optional
IncludeFirstLastName string // yes/no optional
IncludeDeleted string // yes/no optional
}
type DailyEventsResponse struct {
Events map[string]struct {
ID string `json:"id"`
Name string `json:"name"`
StartDate string `json:"startdate"`
Status string `json:"status"`
// add other fields you care about from API
} `json:"events"`
}
type FixturesRequest struct {
SportFK int
TournamentTemplateFK int
TournamentStageFK int
LanguageTypeFK int
Date string // YYYY-MM-DD
Live string // "yes" | "no"
IncludeVenue bool
IncludeEventProperties bool
IncludeCountryCodes bool
IncludeFirstLastName bool
}
// Adjust according to the real API response JSON
type FixturesResponse struct {
Events []FixtureEvent `json:"events"`
}
type FixtureEvent struct {
ID string `json:"id"`
Name string `json:"name"`
StartDate string `json:"startdate"`
// ... add more fields as per API
}
type ResultsRequest struct {
SportFK int
TournamentTemplateFK int
TournamentStageFK int
LanguageTypeFK int
Date string // YYYY-MM-DD
Live string // "yes" | "no"
IncludeVenue bool
IncludeEventProperties bool
IncludeCountryCodes bool
IncludeFirstLastName bool
Limit int
Offset int
}
// Adjust fields to match API JSON exactly
type ResultsResponse struct {
Events []ResultEvent `json:"events"`
}
type ResultEvent struct {
ID string `json:"id"`
Name string `json:"name"`
StartDate string `json:"startdate"`
Status string `json:"status"`
// ... add more fields based on actual API
}
type EventDetailsRequest struct {
ID int
IncludeLineups bool
IncludeIncidents bool
IncludeExtendedResults bool
IncludeProperties bool
IncludeLivestats bool
IncludeVenue bool
IncludeCountryCodes bool
IncludeFirstLastName bool
IncludeDeleted bool
IncludeReference bool
IncludeObjectParticipants bool
IncludeEventIncidentRelation bool
IncludeTeamProperties bool
IncludeObjectRound bool
}
// Adjust fields to match the actual JSON from Enetpulse
type EventDetailsResponse struct {
EventID string `json:"id"`
EventName string `json:"name"`
StartDate string `json:"startdate"`
// Add additional nested structs/fields as needed based on API response
}
type EventListRequest struct {
TournamentFK int // optional
TournamentStageFK int // optional
IncludeEventProperties bool // default true
StatusType string // e.g. "finished", "inprogress"
IncludeVenue bool
IncludeDeleted bool
Limit int
Offset int
}
// Adjust fields to match the actual JSON structure you get from Enetpulse
type EventListResponse struct {
Events map[string]struct {
ID string `json:"id"`
Name string `json:"name"`
StartDate string `json:"startdate"`
// add more fields as per response
} `json:"events"`
}
type ParticipantFixturesRequest struct {
ParticipantFK int // required
SportFK int
TournamentFK int
TournamentTemplateFK int
TournamentStageFK int
Date string
Live string
Limit int
Offset int
IncludeVenue bool
IncludeCountryCodes bool
IncludeFirstLastName bool
IncludeEventProperties bool
LanguageTypeFK int
}
// Adjust this to match the actual API response structure
type ParticipantFixturesResponse struct {
Events []struct {
ID int `json:"id"`
Name string `json:"name"`
// ... other fields from the API
} `json:"events"`
}
type ParticipantResultsRequest struct {
ParticipantFK int64 `json:"participantFK"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
IncludeVenue bool `json:"includeVenue,omitempty"`
IncludeDeleted bool `json:"includeDeleted,omitempty"`
}
type ParticipantResultsResponse struct {
// Adjust to match Enetpulses JSON structure
Results []struct {
EventFK int64 `json:"eventFK"`
ParticipantFK int64 `json:"participantFK"`
Score string `json:"score"`
Status string `json:"status"`
// add more fields as needed
} `json:"results"`
}
type TeamLogoResponse struct {
ContentType string `json:"contentType"` // e.g. "image/png"
Data []byte `json:"-"` // raw image bytes
URL string `json:"url,omitempty"` // optional original URL
}
type TeamShirtsResponse struct {
ContentType string `json:"contentType"` // could be "application/json" or "image/png"
RawData []byte `json:"-"` // raw response
URL string `json:"url,omitempty"`
}
type ImageResponse struct {
ContentType string `json:"contentType"` // e.g., "image/png"
RawData []byte `json:"-"` // raw image bytes
URL string `json:"url,omitempty"`
}
type PreMatchOddsRequest struct {
ObjectFK int64 `json:"objectFK"`
OddsProviderFK []int64 `json:"oddsProviderFK,omitempty"`
OutcomeTypeFK int64 `json:"outcomeTypeFK,omitempty"`
OutcomeScopeFK int64 `json:"outcomeScopeFK,omitempty"`
OutcomeSubtypeFK int64 `json:"outcomeSubtypeFK,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
LanguageTypeFK int64 `json:"languageTypeFK,omitempty"`
}
type PreMatchOddsResponse struct {
// Define fields according to the Enetpulse preodds response structure
// Example:
EventID int64 `json:"eventFK"`
Odds []PreMatchOutcome `json:"odds"`
}
type PreMatchOutcome struct {
OutcomeFK int64 `json:"outcomeFK"`
OutcomeValue string `json:"outcomeValue"`
OddsValue float64 `json:"oddsValue"`
ProviderFK int64 `json:"oddsProviderFK"`
OutcomeTypeFK int64 `json:"outcomeTypeFK"`
}
type TournamentStageOddsRequest struct {
ObjectFK int64 `json:"objectFK"` // Tournament stage ID
OddsProviderFK int64 `json:"oddsProviderFK,omitempty"`
OutcomeTypeFK int64 `json:"outcomeTypeFK"` // Mandatory
OutcomeScopeFK int64 `json:"outcomeScopeFK,omitempty"`
OutcomeSubtypeFK int64 `json:"outcomeSubtypeFK,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
LanguageTypeFK int64 `json:"languageTypeFK,omitempty"`
}
type TournamentStageOddsResponse struct {
// Define fields according to Enetpulse response
StageID int64 `json:"objectFK"`
Odds []PreMatchOutcome `json:"odds"` // reuse PreMatchOutcome from pre-match odds
}
type TournamentOddsRequest struct {
ObjectFK int64 `json:"objectFK"` // Tournament ID
OddsProviderFK int64 `json:"oddsProviderFK,omitempty"`
OutcomeTypeFK int64 `json:"outcomeTypeFK"` // Mandatory
OutcomeScopeFK int64 `json:"outcomeScopeFK,omitempty"`
OutcomeSubtypeFK int64 `json:"outcomeSubtypeFK,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
LanguageTypeFK int64 `json:"languageTypeFK,omitempty"`
}
type TournamentOddsResponse struct {
TournamentID int64 `json:"objectFK"`
Odds []PreMatchOutcome `json:"odds"` // reuse PreMatchOutcome struct from pre-match odds
}
type CreateEnetpulseSport struct {
SportID string `json:"sport_id"` // from API "id"
Name string `json:"name"` // from API "name"
UpdatesCount int `json:"updates_count,omitempty"` // from API "n"
LastUpdatedAt time.Time `json:"last_updated_at"` // from API "ut"
Status int `json:"status,omitempty"` // optional, default 1
}
type EnetpulseSport struct {
ID int64 `json:"id"` // DB primary key
SportID string `json:"sport_id"` // from API "id"
Name string `json:"name"` // from API "name"
UpdatesCount int `json:"updates_count"` // from API "n"
LastUpdatedAt time.Time `json:"last_updated_at"`
Status int `json:"status"` // active/inactive
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type EnetpulseTournamentTemplate struct {
ID int64 `json:"id"`
TemplateID string `json:"template_id"` // from API "id"
Name string `json:"name"` // from API "name"
SportFK string `json:"sport_fk"` // related sport id
Gender string `json:"gender"` // male, female, mixed, unknown
UpdatesCount int `json:"updates_count"` // from API "n"
LastUpdatedAt time.Time `json:"last_updated_at"`
Status int `json:"status"` // optional
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CreateEnetpulseTournamentTemplate struct {
TemplateID string `json:"templateId"` // from API "id"
Name string `json:"name"` // from API "name"
SportFK int64 `json:"sportFK"` // foreign key to sport
Gender string `json:"gender"` // male, female, mixed, unknown
UpdatesCount int `json:"updatesCount"` // from API "n"
LastUpdatedAt time.Time `json:"lastUpdatedAt"` // from API "ut"
Status int `json:"status"` // optional, e.g., active/inactive
}
type CreateEnetpulseTournament struct {
TournamentID string // API "id"
Name string // API "name"
TournamentTemplateFK string // API "tournament_templateFK" (links to template_id)
UpdatesCount int // API "n"
LastUpdatedAt time.Time // API "ut"
Status int // optional, default 1
}
type EnetpulseTournament struct {
ID int64 // internal DB PK
TournamentID string
Name string
TournamentTemplateFK string
UpdatesCount int
LastUpdatedAt time.Time
Status int
CreatedAt time.Time
UpdatedAt *time.Time
}
type EnetpulseTournamentStage struct {
ID int64 `json:"id"`
StageID string `json:"stage_id"` // API id
Name string `json:"name"` // API name
TournamentFK string `json:"tournament_fk"` // Foreign key to tournament
Gender string `json:"gender"` // male/female/mixed/unknown
CountryFK string `json:"country_fk"` // country FK from API
StartDate time.Time `json:"start_date"` // start date/time
EndDate time.Time `json:"end_date"` // end date/time
UpdatesCount int `json:"updates_count"` // n from API
LastUpdatedAt time.Time `json:"last_updated_at"` // ut from API
CountryName string `json:"country_name"` // country name from API
Status int `json:"status"` // active/inactive
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// ✅ Struct for creating new tournament stage rows
type CreateEnetpulseTournamentStage struct {
StageID string `json:"stage_id"` // API id
Name string `json:"name"` // API name
TournamentFK string `json:"tournament_fk"` // DB foreign key to tournaments
Gender string `json:"gender"` // male/female/mixed/unknown
CountryFK string `json:"country_fk"` // country FK from API
StartDate time.Time `json:"start_date"` // start date/time
EndDate time.Time `json:"end_date"` // end date/time
UpdatesCount int `json:"updates_count"` // n from API
LastUpdatedAt time.Time `json:"last_updated_at"` // ut from API
CountryName string `json:"country_name"` // country name from API
Status int `json:"status"` // active/inactive
}