import type { Lexics, Episodes } from 'requests'

import type { MatchPlaylistIds } from './helpers/buildPlaylists'

export enum PlaylistTypes {
  MATCH,
  PLAYER,
  INTERVIEW,
  EVENT,
}

export type MatchPlaylistOption = {
  data: Episodes,
  duration?: number,
  id: MatchPlaylistIds,
  lexic: number | string,
  type: PlaylistTypes.MATCH,
}

export type PlayerPlaylistOption = {
  dur: number,
  gk?: boolean,
  id: number,
  name_eng: string,
  name_rus: string,
  num: string,
  start?: boolean,
  type: PlaylistTypes.PLAYER,
}

export type InterviewPlaylistOption = {
  id: number,
  name_eng: string,
  name_rus: string,
  type: PlaylistTypes.INTERVIEW,
}

export type EventPlaylistOption = {
  data: Episodes,
  id: number,
  type: PlaylistTypes.EVENT,
}

export type PlaylistOption = (
  MatchPlaylistOption
  | PlayerPlaylistOption
  | InterviewPlaylistOption
  | EventPlaylistOption
)

export type InterviewPlaylistOptions = Array<InterviewPlaylistOption>
export type MatchPlaylistOptions = Array<MatchPlaylistOption>
export type PlayerPlaylistOptions = Array<PlayerPlaylistOption>

export type Playlists = {
  interview: InterviewPlaylistOptions,
  lexics?: Lexics,
  match: MatchPlaylistOptions,
  players: {
    team1: PlayerPlaylistOptions,
    team2: PlayerPlaylistOptions,
  },
  score1: number,
  score2: number,
  state?: string,
}
