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

from __future__ import annotations
from enum import Enum
from typing import List
from .utils.json_map import JsonMap
from .base import BaseModel
from .odds_format import OddsFormat
from .cancellation_reason import CancellationReason
from .teaser_leg import TeaserLeg


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

    :cvar ACCEPTED: "ACCEPTED"
    :vartype ACCEPTED: str
    :cvar CANCELLED: "CANCELLED"
    :vartype CANCELLED: str
    :cvar LOSE: "LOSE"
    :vartype LOSE: str
    :cvar REFUNDED: "REFUNDED"
    :vartype REFUNDED: str
    :cvar WON: "WON"
    :vartype WON: str
    """

    ACCEPTED = "ACCEPTED"
    CANCELLED = "CANCELLED"
    LOSE = "LOSE"
    REFUNDED = "REFUNDED"
    WON = "WON"

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

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


@JsonMap(
    {
        "bet_id": "betId",
        "unique_request_id": "uniqueRequestId",
        "wager_number": "wagerNumber",
        "placed_at": "placedAt",
        "bet_status": "betStatus",
        "bet_type": "betType",
        "win_loss": "winLoss",
        "odds_format": "oddsFormat",
        "customer_commission": "customerCommission",
        "cancellation_reason": "cancellationReason",
        "update_sequence": "updateSequence",
        "teaser_name": "teaserName",
        "is_same_event_only": "isSameEventOnly",
        "min_picks": "minPicks",
        "max_picks": "maxPicks",
        "final_price": "finalPrice",
        "teaser_id": "teaserId",
        "teaser_group_id": "teaserGroupId",
    }
)
class TeaserBet(BaseModel):
    """TeaserBet

    :param bet_id: Bet identification
    :type bet_id: int
    :param unique_request_id: Unique Request Id, defaults to None
    :type unique_request_id: str, optional
    :param wager_number: Wager identification. All bets placed thru the API will have value 1. Website Classic view supports multiple contest(special) bets placement in the same bet slip in that case the bet would have appropriate wager number, as well as all round robin parlay bets.
    :type wager_number: int
    :param placed_at: Date time when the bet was placed.
    :type placed_at: str
    :param bet_status: Bet Status. <br><br>ACCEPTED = Bet was accepted,  <br>CANCELLED = Bet is cancelled as per Pinnacle betting rules,  <br>LOSE = The bet is settled as lose,  <br>REFUNDED = When an event is cancelled or when the bet is settled as push, the bet will have REFUNDED status,  <br>WON = The bet is settled as won <br>
    :type bet_status: TeaserBetBetStatus
    :param bet_type: bet_type
    :type bet_type: str
    :param win: Win amount.
    :type win: float
    :param risk: Risk amount.
    :type risk: float
    :param win_loss: Win-Loss for settled bets., defaults to None
    :type win_loss: float, optional
    :param odds_format: Bet odds format.  <br>AMERICAN = American odds format,  <br>DECIMAL = Decimal (European) odds format,  <br>HONGKONG = Hong Kong odds format,  <br>INDONESIAN = Indonesian odds format,  <br>MALAY = Malaysian odds format <br>
    :type odds_format: OddsFormat
    :param customer_commission: Client’s commission on the bet., defaults to None
    :type customer_commission: 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
    :param update_sequence: Update Sequence
    :type update_sequence: int
    :param teaser_name: teaser_name
    :type teaser_name: str
    :param is_same_event_only: is_same_event_only
    :type is_same_event_only: bool
    :param min_picks: min_picks
    :type min_picks: float
    :param max_picks: max_picks
    :type max_picks: float
    :param price: Populated for all teaser bets and will be the original price at the time of the placement., defaults to None
    :type price: float, optional
    :param final_price: Only for settled parlay. Final price may differ in case leg was cancelled or half won., defaults to None
    :type final_price: float, optional
    :param teaser_id: Reference to the teaser id, defaults to None
    :type teaser_id: float, optional
    :param teaser_group_id: Reference to the teaser group id, defaults to None
    :type teaser_group_id: float, optional
    :param legs: legs
    :type legs: List[TeaserLeg]
    """

    def __init__(
        self,
        bet_id: int,
        wager_number: int,
        placed_at: str,
        bet_status: TeaserBetBetStatus,
        bet_type: str,
        win: float,
        risk: float,
        odds_format: OddsFormat,
        update_sequence: int,
        teaser_name: str,
        is_same_event_only: bool,
        min_picks: float,
        max_picks: float,
        legs: List[TeaserLeg],
        unique_request_id: str = None,
        win_loss: float = None,
        customer_commission: float = None,
        cancellation_reason: CancellationReason = None,
        price: float = None,
        final_price: float = None,
        teaser_id: float = None,
        teaser_group_id: float = None,
    ):
        self.bet_id = bet_id
        if unique_request_id is not None:
            self.unique_request_id = unique_request_id
        self.wager_number = wager_number
        self.placed_at = placed_at
        self.bet_status = self._enum_matching(
            bet_status, TeaserBetBetStatus.list(), "bet_status"
        )
        self.bet_type = bet_type
        self.win = win
        self.risk = risk
        if win_loss is not None:
            self.win_loss = win_loss
        self.odds_format = self._enum_matching(
            odds_format, OddsFormat.list(), "odds_format"
        )
        if customer_commission is not None:
            self.customer_commission = customer_commission
        if cancellation_reason is not None:
            self.cancellation_reason = self._define_object(
                cancellation_reason, CancellationReason
            )
        self.update_sequence = update_sequence
        self.teaser_name = teaser_name
        self.is_same_event_only = is_same_event_only
        self.min_picks = min_picks
        self.max_picks = max_picks
        if price is not None:
            self.price = price
        if final_price is not None:
            self.final_price = final_price
        if teaser_id is not None:
            self.teaser_id = teaser_id
        if teaser_group_id is not None:
            self.teaser_group_id = teaser_group_id
        self.legs = self._define_list(legs, TeaserLeg)
