from server.model.color import Color
from server.model.value import Value


def encode_value(v: Value, lang="en"):
    if lang == "fr":
        return {
            "Two": "Deux",
            "Three": "Trois",
            "Four": "Quatre",
            "Five": "Cinq",
            "Six": "Six",
            "Seven": "Sept",
            "Eight": "Huit",
            "Nine": "Neuf",
            "Ten": "Dix",
            "Jack": "Valet",
            "Queen": "Dame",
            "King": "Roi",
            "Ace": "As"
        }[v.name]
    else:
        return {
            "Two": "2",
            "Three": "3",
            "Four": "4",
            "Five": "5",
            "Six": "6",
            "Seven": "7",
            "Eight": "8",
            "Nine": "9",
            "Ten": "10",
            "Jack": "jack",
            "Queen": "queen",
            "King": "king",
            "Ace": "ace"
        }[v.name]


def encode_color(c: Color, lang="en"):
    return {
        "Hearts": "Coeur",
        "Spades": "Pique",
        "Clubs": "Trèfle",
        "Diamonds": "Carreau"
    }[c.name] if lang == "fr" else {
        "Hearts": "hearts",
        "Spades": "spades",
        "Clubs": "clubs",
        "Diamonds": "diamonds"
    }[c.name]
