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

from .utils.validator import Validator
from .utils.base_service import BaseService
from ..net.transport.serializer import Serializer
from ..models.utils.cast_models import cast_models


class GameService(BaseService):

    @cast_models
    def get_game_information(self, lang: str) -> dict:
        """Retrieve game information.

        :param lang: Language code
        :type lang: str
        ...
        :raises RequestError: Raised when a request fails, with optional HTTP status code and details.
        ...
        :return: Successful response
        :rtype: dict
        """

        Validator(str).validate(lang)

        serialized_request = (
            Serializer(f"{self.base_url}/{{lang}}/game", self.get_default_headers())
            .add_path("lang", lang)
            .serialize()
            .set_method("GET")
        )

        response = self.send_request(serialized_request)

        return response

    @cast_models
    def get_game_metadata(self, lang: str) -> dict:
        """Retrieve metadata for game.

        :param lang: Language code
        :type lang: str
        ...
        :raises RequestError: Raised when a request fails, with optional HTTP status code and details.
        ...
        :return: Successful response
        :rtype: dict
        """

        Validator(str).validate(lang)

        serialized_request = (
            Serializer(
                f"{self.base_url}/{{lang}}/game/meta", self.get_default_headers()
            )
            .add_path("lang", lang)
            .serialize()
            .set_method("GET")
        )

        response = self.send_request(serialized_request)

        return response
