import { SportTypes } from 'config'

type AwsTeamMedia = {
  cover_url: string | null,
  logo_url: string | null,
}

type AwsTournamentMedia = AwsTeamMedia & {
  landing_mobile_url: string | null,
  landing_url: string | null,
}

export type TournamentType = {
  id: number,
  is_super_tournament?: boolean,
  media?: AwsTournamentMedia,
  name_eng: string,
  name_rus: string,
  sportType: SportTypes,
}

type Team = {
  id: number,
  media?: AwsTeamMedia,
  name_eng: string,
  name_rus: string,
  score?: number | null,
}

export type SportInfo = {
  id: number,
  lexic: number,
}

export type Match = {
  access: boolean,
  /** тип трансляции */
  c_type_broadcast: number,
  calc: boolean,
  country: TournamentType,
  country_id: number,
  date: string,
  /** Информация о турнире, если турнир входит в супер турнир */
  group: TournamentType,
  /** наличие mp4 видео */
  has_video: boolean,
  id: number,
  /** матч закончен */
  is_finished?: boolean,
  /** наличие hls стрима */
  live: boolean,
  preview?: string,
  previewURL?: string,
  sport: SportTypes,
  sport_info: SportInfo,
  /** наличие завершенного hls стрима */
  storage: boolean,
  sub: boolean,
  team1: Team,
  team2: Team,
  tournament: TournamentType,
}

export type Matches = Array<Match>

type VideoContent = {
  broadcast: Matches,
  features: Matches,
  highlights: Matches,
}

export type MatchesResponse = {
  is_video_sections: boolean | null,
  show: boolean,
  video_content: VideoContent,
}

export type MatchesBySection = {
  broadcast: Matches,
  features: Matches,
  hasNextPage: boolean,
  highlights: Matches,
  isVideoSections: boolean,
}
