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

from __future__ import annotations
from enum import Enum
from .utils.json_map import JsonMap
from .base import BaseModel
from .cancellation_reason import CancellationReason


class ParlayLegLegBetType(Enum):
    """An enumeration representing different categories.

    :cvar MONEYLINE: "MONEYLINE"
    :vartype MONEYLINE: str
    :cvar SPREAD: "SPREAD"
    :vartype SPREAD: str
    :cvar TOTAL_POINTS: "TOTAL_POINTS"
    :vartype TOTAL_POINTS: str
    """

    MONEYLINE = "MONEYLINE"
    SPREAD = "SPREAD"
    TOTAL_POINTS = "TOTAL_POINTS"

    def list():
        """Lists all category values.

        :return: A list of all category values.
        :rtype: list
        """
        return list(map(lambda x: x.value, ParlayLegLegBetType._member_map_.values()))


class ParlayLegLegBetStatus(Enum):
    """An enumeration representing different categories.

    :cvar CANCELLED: "CANCELLED"
    :vartype CANCELLED: str
    :cvar LOST: "LOST"
    :vartype LOST: str
    :cvar PUSHED: "PUSHED"
    :vartype PUSHED: str
    :cvar REFUNDED: "REFUNDED"
    :vartype REFUNDED: str
    :cvar WON: "WON"
    :vartype WON: str
    :cvar ACCEPTED: "ACCEPTED"
    :vartype ACCEPTED: str
    :cvar HALF_WON_HALF_PUSHED: "HALF_WON_HALF_PUSHED"
    :vartype HALF_WON_HALF_PUSHED: str
    :cvar HALF_LOST_HALF_PUSHED: "HALF_LOST_HALF_PUSHED"
    :vartype HALF_LOST_HALF_PUSHED: str
    """

    CANCELLED = "CANCELLED"
    LOST = "LOST"
    PUSHED = "PUSHED"
    REFUNDED = "REFUNDED"
    WON = "WON"
    ACCEPTED = "ACCEPTED"
    HALF_WON_HALF_PUSHED = "HALF_WON_HALF_PUSHED"
    HALF_LOST_HALF_PUSHED = "HALF_LOST_HALF_PUSHED"

    def list():
        """Lists all category values.

        :return: A list of all category values.
        :rtype: list
        """
        return list(map(lambda x: x.value, ParlayLegLegBetStatus._member_map_.values()))


class ParlayLegSide(Enum):
    """An enumeration representing different categories.

    :cvar OVER: "OVER"
    :vartype OVER: str
    :cvar UNDER: "UNDER"
    :vartype UNDER: str
    """

    OVER = "OVER"
    UNDER = "UNDER"

    def list():
        """Lists all category values.

        :return: A list of all category values.
        :rtype: list
        """
        return list(map(lambda x: x.value, ParlayLegSide._member_map_.values()))


@JsonMap(
    {
        "sport_id": "sportId",
        "leg_bet_type": "legBetType",
        "leg_bet_status": "legBetStatus",
        "league_id": "leagueId",
        "event_id": "eventId",
        "event_start_time": "eventStartTime",
        "team_name": "teamName",
        "period_number": "periodNumber",
        "ft_team1_score": "ftTeam1Score",
        "ft_team2_score": "ftTeam2Score",
        "p_team1_score": "pTeam1Score",
        "p_team2_score": "pTeam2Score",
        "cancellation_reason": "cancellationReason",
    }
)
class ParlayLeg(BaseModel):
    """ParlayLeg

    :param sport_id: sport_id, defaults to None
    :type sport_id: int, optional
    :param leg_bet_type: Parlay leg type., defaults to None
    :type leg_bet_type: ParlayLegLegBetType, optional
    :param leg_bet_status: Parlay Leg status.<br>CANCELLED = The leg is canceled- the stake on this leg will be transferred to the next one. In this case the leg will be ignored when calculating the winLoss.<br>LOST = The leg is a loss or a push-lose. When Push-lose happens, the half of the stake on the leg will be pushed to the next leg, and the other half will be a lose. This can happen only when the leg is placed on a quarter points handicap.  <br>PUSHED = The leg is a push - the stake on this leg will be transferred to the next one. In this case the leg will be ignored when calculating the winLoss.  <br>REFUNDED = The leg is refunded - the stake on this leg will be transferred to the next one. In this case the leg will be ignored when calculating the winLoss.  <br>WON = The leg is a won or a push-won. When Push-won happens, the half of the stake on the leg will be pushed to the next leg, and the other half is won. This can happen only when the leg is placed on a quarter points handicap.<br>HALF_WON_HALF_PUSHED = The bet is settled as half won half pushed. Only for asian handicap legs.<br>HALF_LOST_HALF_PUSHED =  The bet is settled as half lost half pushed. Only for asian handicap legs. <br>, defaults to None
    :type leg_bet_status: ParlayLegLegBetStatus, optional
    :param league_id: league_id, defaults to None
    :type league_id: int, optional
    :param event_id: event_id, defaults to None
    :type event_id: int, optional
    :param event_start_time: Date time when the event starts., defaults to None
    :type event_start_time: str, optional
    :param handicap: handicap, defaults to None
    :type handicap: float, optional
    :param price: price, defaults to None
    :type price: float, optional
    :param team_name: team_name, defaults to None
    :type team_name: str, optional
    :param side: Side type., defaults to None
    :type side: ParlayLegSide, optional
    :param team1: Wellington Phoenix, defaults to None
    :type team1: str, optional
    :param team2: Adelaide United, defaults to None
    :type team2: str, optional
    :param period_number: period_number, defaults to None
    :type period_number: int, optional
    :param ft_team1_score: Full time team 1 score, defaults to None
    :type ft_team1_score: float, optional
    :param ft_team2_score: Full time team 2 score, defaults to None
    :type ft_team2_score: float, optional
    :param p_team1_score: End of period team 1 score. If the bet was placed on Game period (periodNumber =0) , this will be null, defaults to None
    :type p_team1_score: float, optional
    :param p_team2_score: End of period team 2 score. If the bet was placed on Game period (periodNumber =0) , this will be null, defaults to None
    :type p_team2_score: float, optional
    :param cancellation_reason: Possible keys \:  <br>* correctTeam1Id<br>* correctTeam2Id<br>* correctListedPitcher1<br>* correctListedPitcher2<br>* correctSpread<br>* correctTotalPoints<br>* correctTeam1TotalPoints<br>* correctTeam2TotalPoints<br>* correctTeam1Score<br>* correctTeam2Score<br>* correctTeam1TennisSetsScore<br>* correctTeam2TennisSetsScore<br>, defaults to None
    :type cancellation_reason: CancellationReason, optional
    """

    def __init__(
        self,
        sport_id: int = None,
        leg_bet_type: ParlayLegLegBetType = None,
        leg_bet_status: ParlayLegLegBetStatus = None,
        league_id: int = None,
        event_id: int = None,
        event_start_time: str = None,
        handicap: float = None,
        price: float = None,
        team_name: str = None,
        side: ParlayLegSide = None,
        team1: str = None,
        team2: str = None,
        period_number: int = None,
        ft_team1_score: float = None,
        ft_team2_score: float = None,
        p_team1_score: float = None,
        p_team2_score: float = None,
        cancellation_reason: CancellationReason = None,
    ):
        if sport_id is not None:
            self.sport_id = sport_id
        if leg_bet_type is not None:
            self.leg_bet_type = self._enum_matching(
                leg_bet_type, ParlayLegLegBetType.list(), "leg_bet_type"
            )
        if leg_bet_status is not None:
            self.leg_bet_status = self._enum_matching(
                leg_bet_status, ParlayLegLegBetStatus.list(), "leg_bet_status"
            )
        if league_id is not None:
            self.league_id = league_id
        if event_id is not None:
            self.event_id = event_id
        if event_start_time is not None:
            self.event_start_time = event_start_time
        if handicap is not None:
            self.handicap = handicap
        if price is not None:
            self.price = price
        if team_name is not None:
            self.team_name = team_name
        if side is not None:
            self.side = self._enum_matching(side, ParlayLegSide.list(), "side")
        if team1 is not None:
            self.team1 = team1
        if team2 is not None:
            self.team2 = team2
        if period_number is not None:
            self.period_number = period_number
        if ft_team1_score is not None:
            self.ft_team1_score = ft_team1_score
        if ft_team2_score is not None:
            self.ft_team2_score = ft_team2_score
        if p_team1_score is not None:
            self.p_team1_score = p_team1_score
        if p_team2_score is not None:
            self.p_team2_score = p_team2_score
        if cancellation_reason is not None:
            self.cancellation_reason = self._define_object(
                cancellation_reason, CancellationReason
            )
