Yimaru-BackEnd/internal/domain/enet_pulse.go

707 lines
26 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
}
// For insertion
type CreateEnetpulseFixture struct {
FixtureID string
Name string
SportFK string
TournamentFK string
TournamentTemplateFK string
TournamentStageFK string
TournamentStageName string
TournamentName string
TournamentTemplateName string
SportName string
Gender string
StartDate time.Time
StatusType string
StatusDescFK string
RoundTypeFK string
UpdatesCount int
LastUpdatedAt time.Time
}
// Full domain model
type EnetpulseFixture struct {
FixtureID string `json:"id"`
Name string `json:"name"`
SportFK string `json:"sportFK"`
TournamentFK string `json:"tournamentFK"`
TournamentTemplateFK string `json:"tournament_templateFK"`
TournamentStageFK string `json:"tournament_stageFK"`
TournamentStageName string `json:"tournament_stage_name"`
TournamentName string `json:"tournament_name"`
TournamentTemplateName string `json:"tournament_template_name"`
SportName string `json:"sport_name"`
Gender string `json:"gender"`
StartDate string `json:"startdate"` // ISO 8601
StatusType string `json:"status_type"`
StatusDescFK string `json:"status_descFK"`
RoundTypeFK string `json:"round_typeFK"`
UpdatesCount string `json:"n"` // convert to int
LastUpdatedAt string `json:"ut"` // parse to time.Time
}
type CreateEnetpulseResult struct {
ResultID string `json:"result_id"`
Name string `json:"name"`
SportFK string `json:"sport_fk"`
TournamentFK string `json:"tournament_fk"`
TournamentTemplateFK string `json:"tournament_template_fk"`
TournamentStageFK string `json:"tournament_stage_fk"`
TournamentStageName string `json:"tournament_stage_name"`
TournamentName string `json:"tournament_name"`
TournamentTemplateName string `json:"tournament_template_name"`
SportName string `json:"sport_name"`
StartDate time.Time `json:"start_date"`
StatusType string `json:"status_type"`
StatusDescFK string `json:"status_desc_fk"`
RoundTypeFK string `json:"round_type_fk"`
UpdatesCount int32 `json:"updates_count"`
LastUpdatedAt time.Time `json:"last_updated_at"`
// Optional metadata
Round string `json:"round"`
Live string `json:"live"`
VenueName string `json:"venue_name"`
LivestatsPlus string `json:"livestats_plus"`
LivestatsType string `json:"livestats_type"`
Commentary string `json:"commentary"`
LineupConfirmed bool `json:"lineup_confirmed"`
Verified bool `json:"verified"`
Spectators int32 `json:"spectators"`
// Time-related metadata
GameStarted *time.Time `json:"game_started"`
FirstHalfEnded *time.Time `json:"first_half_ended"`
SecondHalfStarted *time.Time `json:"second_half_started"`
SecondHalfEnded *time.Time `json:"second_half_ended"`
GameEnded *time.Time `json:"game_ended"`
}
// ✅ Used for reading result records
type EnetpulseResult struct {
ID int64 `json:"id"`
ResultID string `json:"result_id"`
Name string `json:"name"`
SportFK string `json:"sport_fk"`
TournamentFK string `json:"tournament_fk"`
TournamentTemplateFK string `json:"tournament_template_fk"`
TournamentStageFK string `json:"tournament_stage_fk"`
TournamentStageName string `json:"tournament_stage_name"`
TournamentName string `json:"tournament_name"`
TournamentTemplateName string `json:"tournament_template_name"`
SportName string `json:"sport_name"`
StartDate time.Time `json:"start_date"`
StatusType string `json:"status_type"`
StatusDescFK string `json:"status_desc_fk"`
RoundTypeFK string `json:"round_type_fk"`
UpdatesCount int32 `json:"updates_count"`
LastUpdatedAt *time.Time `json:"last_updated_at"`
Round string `json:"round"`
Live string `json:"live"`
VenueName string `json:"venue_name"`
LivestatsPlus string `json:"livestats_plus"`
LivestatsType string `json:"livestats_type"`
Commentary string `json:"commentary"`
LineupConfirmed bool `json:"lineup_confirmed"`
Verified bool `json:"verified"`
Spectators int32 `json:"spectators"`
GameStarted *time.Time `json:"game_started"`
FirstHalfEnded *time.Time `json:"first_half_ended"`
SecondHalfStarted *time.Time `json:"second_half_started"`
SecondHalfEnded *time.Time `json:"second_half_ended"`
GameEnded *time.Time `json:"game_ended"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
}
type EnetpulseOutcomeType struct {
ID int64 `json:"id"`
OutcomeTypeID string `json:"outcome_type_id"` // changed from int64 → string
Name string `json:"name"`
Description string `json:"description"`
UpdatesCount int32 `json:"updates_count"`
LastUpdatedAt time.Time `json:"last_updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// CreateEnetpulseOutcomeType represents the payload to create or update an outcome type.
type CreateEnetpulseOutcomeType struct {
OutcomeTypeID string `json:"outcome_type_id"` // changed from int64 → string
Name string `json:"name"`
Description string `json:"description"`
UpdatesCount int32 `json:"updates_count"`
LastUpdatedAt time.Time `json:"last_updated_at"`
}
type EnetpulsePreoddsTemp struct {
PreoddsID string `json:"preodds_id"`
EventFK string `json:"event_fk"`
OutcomeTypeFK string `json:"outcome_type_fk"`
OutcomeScopeFK string `json:"outcome_scope_fk"`
OutcomeSubtypeFK string `json:"outcome_subtype_fk"`
EventParticipantNumber int `json:"event_participant_number"`
IParam string `json:"iparam"`
IParam2 string `json:"iparam2"`
DParam string `json:"dparam"`
DParam2 string `json:"dparam2"`
SParam string `json:"sparam"`
UpdatesCount int `json:"updates_count"`
LastUpdatedAt time.Time `json:"last_updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// CreateEnetpulsePreodds is used when inserting a new preodds record
type CreateEnetpulsePreodds struct {
PreoddsID string `json:"preodds_id"`
EventFK string `json:"event_fk"`
OutcomeTypeFK string `json:"outcome_type_fk"`
OutcomeScopeFK string `json:"outcome_scope_fk"`
OutcomeSubtypeFK string `json:"outcome_subtype_fk"`
EventParticipantNumber int `json:"event_participant_number"`
IParam string `json:"iparam"`
IParam2 string `json:"iparam2"`
DParam string `json:"dparam"`
DParam2 string `json:"dparam2"`
SParam string `json:"sparam"`
UpdatesCount int `json:"updates_count"`
LastUpdatedAt time.Time `json:"last_updated_at"`
}
type CreateEnetpulsePreoddsBettingOffer struct {
BettingOfferID string
PreoddsFK string
BettingOfferStatusFK int32
OddsProviderFK int32
Odds float64
OddsOld float64
Active string
CouponKey string
UpdatesCount int
LastUpdatedAt time.Time
}
// EnetpulsePreoddsBettingOffer represents the DB record of a betting offer
type EnetpulsePreoddsBettingOffer struct {
ID int64 `json:"id"`
BettingOfferID string `json:"betting_offer_id"`
PreoddsFK string `json:"preodds_fk"`
BettingOfferStatusFK int32 `json:"betting_offer_status_fk"`
OddsProviderFK int32 `json:"odds_provider_fk"`
Odds float64 `json:"odds"`
OddsOld float64 `json:"odds_old"`
Active string `json:"active"`
CouponKey string `json:"coupon_key"`
UpdatesCount int `json:"updates_count"`
LastUpdatedAt time.Time `json:"last_updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type EnetpulseFixtureWithPreodds struct {
FixtureID string
FixtureApiID string
FixtureName string
SportFk string
TournamentFk string
TournamentTemplateFk string
TournamentStageFk string
StartDate time.Time
StatusType string
StatusDescFk string
RoundTypeFk string
UpdatesCount int32
LastUpdatedAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
Preodds []EnetpulsePreodds
}
type EnetpulsePreodds struct {
ID int64
PreoddsID string
EventFK int64
OutcomeTypeFK int32
OutcomeScopeFK int32
OutcomeSubtypeFK int32
EventParticipantNumber int32
IParam string
IParam2 string
DParam string
DParam2 string
SParam string
UpdatesCount int32
LastUpdatedAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}