# This file was generated by liblab | https://liblab.com/

from __future__ import annotations
from typing import List
from .utils.json_map import JsonMap
from .base import BaseModel
from .player import Player
from .team import Team
from .game_linescore import GameLinescore
from .game_boxscore import GameBoxscore
from .game_play import GamePlay
from .game_decision_player import GameDecisionPlayer


@JsonMap({"time_stamp": "timeStamp"})
class MetaData(BaseModel):
    """MetaData

    :param wait: wait, defaults to None
    :type wait: float, optional
    :param time_stamp: time_stamp, defaults to None
    :type time_stamp: str, optional
    """

    def __init__(self, wait: float = None, time_stamp: str = None):
        if wait is not None:
            self.wait = wait
        if time_stamp is not None:
            self.time_stamp = time_stamp


@JsonMap({"type_": "type"})
class GameDataGame(BaseModel):
    """GameDataGame

    :param pk: pk, defaults to None
    :type pk: float, optional
    :param season: season, defaults to None
    :type season: str, optional
    :param type_: type_, defaults to None
    :type type_: str, optional
    """

    def __init__(self, pk: float = None, season: str = None, type_: str = None):
        if pk is not None:
            self.pk = pk
        if season is not None:
            self.season = season
        if type_ is not None:
            self.type_ = type_


@JsonMap({"date_time": "dateTime", "end_date_time": "endDateTime"})
class Datetime(BaseModel):
    """Datetime

    :param date_time: date_time, defaults to None
    :type date_time: str, optional
    :param end_date_time: end_date_time, defaults to None
    :type end_date_time: str, optional
    """

    def __init__(self, date_time: str = None, end_date_time: str = None):
        if date_time is not None:
            self.date_time = date_time
        if end_date_time is not None:
            self.end_date_time = end_date_time


@JsonMap(
    {
        "abstract_game_state": "abstractGameState",
        "coded_game_state": "codedGameState",
        "detailed_state": "detailedState",
        "status_code": "statusCode",
        "start_time_tbd": "startTimeTBD",
    }
)
class GameDataStatus(BaseModel):
    """GameDataStatus

    :param abstract_game_state: abstract_game_state, defaults to None
    :type abstract_game_state: str, optional
    :param coded_game_state: coded_game_state, defaults to None
    :type coded_game_state: str, optional
    :param detailed_state: detailed_state, defaults to None
    :type detailed_state: str, optional
    :param status_code: status_code, defaults to None
    :type status_code: str, optional
    :param start_time_tbd: start_time_tbd, defaults to None
    :type start_time_tbd: bool, optional
    """

    def __init__(
        self,
        abstract_game_state: str = None,
        coded_game_state: str = None,
        detailed_state: str = None,
        status_code: str = None,
        start_time_tbd: bool = None,
    ):
        if abstract_game_state is not None:
            self.abstract_game_state = abstract_game_state
        if coded_game_state is not None:
            self.coded_game_state = coded_game_state
        if detailed_state is not None:
            self.detailed_state = detailed_state
        if status_code is not None:
            self.status_code = status_code
        if start_time_tbd is not None:
            self.start_time_tbd = start_time_tbd


@JsonMap({})
class GameDataTeams(BaseModel):
    """GameDataTeams

    :param away: away, defaults to None
    :type away: Team, optional
    :param home: home, defaults to None
    :type home: Team, optional
    """

    def __init__(self, away: Team = None, home: Team = None):
        if away is not None:
            self.away = self._define_object(away, Team)
        if home is not None:
            self.home = self._define_object(home, Team)


@JsonMap({})
class GameDataVenue(BaseModel):
    """GameDataVenue

    :param name: name, defaults to None
    :type name: str, optional
    :param link: link, defaults to None
    :type link: str, optional
    """

    def __init__(self, name: str = None, link: str = None):
        if name is not None:
            self.name = name
        if link is not None:
            self.link = link


@JsonMap({"datetime_": "datetime"})
class GameData(BaseModel):
    """GameData

    :param game: game, defaults to None
    :type game: GameDataGame, optional
    :param datetime_: datetime_, defaults to None
    :type datetime_: Datetime, optional
    :param status: status, defaults to None
    :type status: GameDataStatus, optional
    :param teams: teams, defaults to None
    :type teams: GameDataTeams, optional
    :param players: players, defaults to None
    :type players: Player, optional
    :param venue: venue, defaults to None
    :type venue: GameDataVenue, optional
    """

    def __init__(
        self,
        game: GameDataGame = None,
        datetime_: Datetime = None,
        status: GameDataStatus = None,
        teams: GameDataTeams = None,
        players: Player = None,
        venue: GameDataVenue = None,
    ):
        if game is not None:
            self.game = self._define_object(game, GameDataGame)
        if datetime_ is not None:
            self.datetime_ = self._define_object(datetime_, Datetime)
        if status is not None:
            self.status = self._define_object(status, GameDataStatus)
        if teams is not None:
            self.teams = self._define_object(teams, GameDataTeams)
        if players is not None:
            self.players = self._define_object(players, Player)
        if venue is not None:
            self.venue = self._define_object(venue, GameDataVenue)


@JsonMap({"start_index": "startIndex", "end_index": "endIndex"})
class PlaysByPeriod(BaseModel):
    """PlaysByPeriod

    :param start_index: start_index, defaults to None
    :type start_index: float, optional
    :param plays: plays, defaults to None
    :type plays: List[float], optional
    :param end_index: end_index, defaults to None
    :type end_index: float, optional
    """

    def __init__(
        self,
        start_index: float = None,
        plays: List[float] = None,
        end_index: float = None,
    ):
        if start_index is not None:
            self.start_index = start_index
        if plays is not None:
            self.plays = plays
        if end_index is not None:
            self.end_index = end_index


@JsonMap(
    {
        "all_plays": "allPlays",
        "scoring_plays": "scoringPlays",
        "penalty_plays": "penaltyPlays",
        "plays_by_period": "playsByPeriod",
        "current_play": "currentPlay",
    }
)
class Plays(BaseModel):
    """Plays

    :param all_plays: all_plays, defaults to None
    :type all_plays: List[GamePlay], optional
    :param scoring_plays: scoring_plays, defaults to None
    :type scoring_plays: List[float], optional
    :param penalty_plays: penalty_plays, defaults to None
    :type penalty_plays: List[float], optional
    :param plays_by_period: plays_by_period, defaults to None
    :type plays_by_period: List[PlaysByPeriod], optional
    :param current_play: current_play, defaults to None
    :type current_play: GamePlay, optional
    """

    def __init__(
        self,
        all_plays: List[GamePlay] = None,
        scoring_plays: List[float] = None,
        penalty_plays: List[float] = None,
        plays_by_period: List[PlaysByPeriod] = None,
        current_play: GamePlay = None,
    ):
        if all_plays is not None:
            self.all_plays = self._define_list(all_plays, GamePlay)
        if scoring_plays is not None:
            self.scoring_plays = scoring_plays
        if penalty_plays is not None:
            self.penalty_plays = penalty_plays
        if plays_by_period is not None:
            self.plays_by_period = self._define_list(plays_by_period, PlaysByPeriod)
        if current_play is not None:
            self.current_play = self._define_object(current_play, GamePlay)


@JsonMap(
    {"first_star": "firstStar", "second_star": "secondStar", "third_star": "thirdStar"}
)
class Decisions(BaseModel):
    """Decisions

    :param winner: winner, defaults to None
    :type winner: GameDecisionPlayer, optional
    :param loser: loser, defaults to None
    :type loser: GameDecisionPlayer, optional
    :param first_star: first_star, defaults to None
    :type first_star: GameDecisionPlayer, optional
    :param second_star: second_star, defaults to None
    :type second_star: GameDecisionPlayer, optional
    :param third_star: third_star, defaults to None
    :type third_star: GameDecisionPlayer, optional
    """

    def __init__(
        self,
        winner: GameDecisionPlayer = None,
        loser: GameDecisionPlayer = None,
        first_star: GameDecisionPlayer = None,
        second_star: GameDecisionPlayer = None,
        third_star: GameDecisionPlayer = None,
    ):
        if winner is not None:
            self.winner = self._define_object(winner, GameDecisionPlayer)
        if loser is not None:
            self.loser = self._define_object(loser, GameDecisionPlayer)
        if first_star is not None:
            self.first_star = self._define_object(first_star, GameDecisionPlayer)
        if second_star is not None:
            self.second_star = self._define_object(second_star, GameDecisionPlayer)
        if third_star is not None:
            self.third_star = self._define_object(third_star, GameDecisionPlayer)


@JsonMap({})
class LiveData(BaseModel):
    """LiveData

    :param plays: plays, defaults to None
    :type plays: Plays, optional
    :param linescore: linescore, defaults to None
    :type linescore: GameLinescore, optional
    :param boxscore: boxscore, defaults to None
    :type boxscore: GameBoxscore, optional
    :param decisions: decisions, defaults to None
    :type decisions: Decisions, optional
    """

    def __init__(
        self,
        plays: Plays = None,
        linescore: GameLinescore = None,
        boxscore: GameBoxscore = None,
        decisions: Decisions = None,
    ):
        if plays is not None:
            self.plays = self._define_object(plays, Plays)
        if linescore is not None:
            self.linescore = self._define_object(linescore, GameLinescore)
        if boxscore is not None:
            self.boxscore = self._define_object(boxscore, GameBoxscore)
        if decisions is not None:
            self.decisions = self._define_object(decisions, Decisions)


@JsonMap(
    {
        "game_pk": "gamePk",
        "meta_data": "metaData",
        "game_data": "gameData",
        "live_data": "liveData",
    }
)
class Game(BaseModel):
    """Game

    :param copyright: copyright, defaults to None
    :type copyright: str, optional
    :param game_pk: game_pk, defaults to None
    :type game_pk: float, optional
    :param link: link, defaults to None
    :type link: str, optional
    :param meta_data: meta_data, defaults to None
    :type meta_data: MetaData, optional
    :param game_data: game_data, defaults to None
    :type game_data: GameData, optional
    :param live_data: live_data, defaults to None
    :type live_data: LiveData, optional
    """

    def __init__(
        self,
        copyright: str = None,
        game_pk: float = None,
        link: str = None,
        meta_data: MetaData = None,
        game_data: GameData = None,
        live_data: LiveData = None,
    ):
        if copyright is not None:
            self.copyright = copyright
        if game_pk is not None:
            self.game_pk = game_pk
        if link is not None:
            self.link = link
        if meta_data is not None:
            self.meta_data = self._define_object(meta_data, MetaData)
        if game_data is not None:
            self.game_data = self._define_object(game_data, GameData)
        if live_data is not None:
            self.live_data = self._define_object(live_data, LiveData)
