package football import ( "time" gql "github.com/llehouerou/go-graphql-client" "git.lehouerou.net/laurent/sorare/graphql" "git.lehouerou.net/laurent/sorare/types" ) type Injury struct { Id graphql.Id `graphql:"id"` Active bool `graphql:"active"` StartDate time.Time `graphql:"startDate"` ExpectedEndDate time.Time `graphql:"expectedEndDate"` Kind string `graphql:"kind"` } type Suspension struct { Id graphql.Id `graphql:"id"` Active bool `graphql:"active"` StartDate time.Time `graphql:"startDate"` EndDate time.Time `graphql:"endDate"` Kind string `graphql:"kind"` Matches int `graphql:"matches"` Reason string `graphql:"reason"` Competition struct { Slug string `graphql:"slug"` } `graphql:"competition"` } type CardSupply struct { Season struct { StartYear int `graphql:"startYear"` } `graphql:"season"` Limited int `graphql:"limited"` Rare int `graphql:"rare"` SuperRare int `graphql:"superRare"` Unique int `graphql:"unique"` } type MembershipStats struct { Season struct { StartYear int `graphql:"startYear"` } `graphql:"season"` Appearances int `graphql:"appearances"` Goals int `graphql:"goals"` Assists int `graphql:"assists"` YellowCards int `graphql:"yellowCards"` RedCards int `graphql:"redCards"` MinutesPlayed int `graphql:"minutesPlayed"` SubstituteIn int `graphql:"substituteIn"` SubstituteOut int `graphql:"substituteOut"` } type Membership struct { Id graphql.Id `graphql:"id"` StartDate time.Time `graphql:"startDate"` EndDate *time.Time `graphql:"endDate"` MembershipTeam struct { TypeName string `graphql:"__typename"` Club struct { Slug string `graphql:"slug"` } `graphql:"... on Club"` NationalTeam struct { Slug string `graphql:"slug"` } `graphql:"... on NationalTeam"` } `graphql:"membershipTeam"` //Stats []MembershipStats `graphql:"stats"` } type Player struct { ActiveClub struct { Slug string `graphql:"slug"` ActiveCompetitions []struct { Slug string `graphql:"slug"` Format string `graphql:"format"` } `graphql:"activeCompetitions"` } `graphql:"activeClub"` ActiveNationalTeam struct { Slug string `graphql:"slug"` } `graphql:"activeNationalTeam"` ActiveInjuries []Injury `graphql:"activeInjuries"` ActiveSuspensions []Suspension `graphql:"activeSuspensions"` Age int `graphql:"age"` Appearances int `graphql:"appearances"` BestFoot string `graphql:"bestFoot"` BirthDate time.Time `graphql:"birthDate"` CardPositions []types.Position `graphql:"cardPositions"` CardSupply []CardSupply `graphql:"cardSupply"` Id graphql.Id `graphql:"id"` Memberships []Membership `graphql:"memberships"` Slug string `graphql:"slug"` DisplayName string `graphql:"displayName"` FirstName string `graphql:"firstName"` Height int `graphql:"height"` Injuries []Injury `graphql:"injuries"` LastClub struct { Slug string `graphql:"slug"` } `graphql:"lastClub"` LastName string `graphql:"lastName"` MatchName string `graphql:"matchName"` PictureUrl string `graphql:"pictureUrl"` PlayingStatus types.PlayerPlayingStatus `graphql:"playingStatus"` Country struct { Slug string `graphql:"slug"` Code string `graphql:"code"` } AvatarUrl string `graphql:"avatar:pictureUrl(derivative:\"avatar\")"` Position types.Position `graphql:"position"` ShirtNumber int `graphql:"shirtNumber"` Suspensions []Suspension `graphql:"suspensions"` User struct { Slug string `graphql:"slug"` } `graphql:"user"` Weight int `graphql:"weight"` } type PlayerScore struct { Slug string `graphql:"slug"` So5Score So5Score `graphql:"so5Score(gameId:$gameId)"` } func (f *Football) PlayerCards( playerSlug string, ) *graphql.PaginatedQuery[Card, CardsParams] { return graphql.NewPaginatedQuery[Card, CardsParams]( f.c, "cards", []string{"football", "player(slug:$slug)"}, ).WithQueryParam("slug", playerSlug) } func (f *Football) PlayersGameScores( gameId gql.ID, ) *graphql.Query[[]PlayerScore, graphql.SlugsParams] { return graphql.NewQuery[[]PlayerScore, graphql.SlugsParams]( f.c, "players", []string{"football"}, ).WithQueryParam("gameId", gameId) } type So5ScoresParams struct { Position *types.Position `graphql:"position"` } func (f *Football) PlayerAllSo5Scores( playerSlug string, ) *graphql.PaginatedQuery[So5Score, So5ScoresParams] { return graphql.NewPaginatedQuery[So5Score, So5ScoresParams]( f.c, "allSo5Scores", []string{"football", "player(slug:$slug)"}, ).WithQueryParam("slug", playerSlug) }