# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from enum import Enum, unique


class CardEnum(Enum):
    """Card enum class. String representation is value."""
    def __str__(self):
        return self.value


@unique
class CardRank(CardEnum):
    """Card enum class for card ranks."""
    Three = '3'
    Four = '4'
    Five = '5'
    Six = '6'
    Seven = '7'
    Eight = '8'
    Nine = '9'
    Ten = '10'
    Jack = 'jack'
    Queen = 'queen'
    King = 'king'
    Ace = 'ace'
    Two = '2'
    Joker = 'joker'


natural_ranks = [CardRank.Four, CardRank.Five, CardRank.Six, CardRank.Seven, CardRank.Eight,
                 CardRank.Nine, CardRank.Ten, CardRank.Jack, CardRank.Queen, CardRank.King, CardRank.Ace]
wild_ranks = [CardRank.Two, CardRank.Joker]


@unique
class CardSuit(CardEnum):
    """Card enum class for card suits."""
    Clubs = 'clubs'
    Spades = 'spades'
    Hearts = 'hearts'
    Diamonds = 'diamonds'


black_suits = [CardSuit.Clubs, CardSuit.Spades]
red_suits = [CardSuit.Hearts, CardSuit.Diamonds]

sorting_suits = {suit: i for i, suit in enumerate(CardSuit)}

n_sorting_suits = len(sorting_suits.keys())
sorting_ranks = {rank: i * n_sorting_suits for i, rank in enumerate(CardRank)}

# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from enum import Enum, unique


class CardEnum(Enum):
    """Card enum class. String representation is value."""
    def __str__(self):
        return self.value


@unique
class CardRank(CardEnum):
    """Card enum class for card ranks."""
    Three = '3'
    Four = '4'
    Five = '5'
    Six = '6'
    Seven = '7'
    Eight = '8'
    Nine = '9'
    Ten = '10'
    Jack = 'jack'
    Queen = 'queen'
    King = 'king'
    Ace = 'ace'
    Two = '2'
    Joker = 'joker'


natural_ranks = [CardRank.Four, CardRank.Five, CardRank.Six, CardRank.Seven, CardRank.Eight,
                 CardRank.Nine, CardRank.Ten, CardRank.Jack, CardRank.Queen, CardRank.King, CardRank.Ace]
wild_ranks = [CardRank.Two, CardRank.Joker]


@unique
class CardSuit(CardEnum):
    """Card enum class for card suits."""
    Clubs = 'clubs'
    Spades = 'spades'
    Hearts = 'hearts'
    Diamonds = 'diamonds'


black_suits = [CardSuit.Clubs, CardSuit.Spades]
red_suits = [CardSuit.Hearts, CardSuit.Diamonds]

sorting_suits = {suit: i for i, suit in enumerate(CardSuit)}

n_sorting_suits = len(sorting_suits.keys())
sorting_ranks = {rank: i * n_sorting_suits for i, rank in enumerate(CardRank)}

# MIT License # # Copyright (c) 2021 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. Card enum class. String representation is value. Card enum class for card ranks. Card enum class for card suits.