# Path: webservice/service_func.py
# class func_error(Exception):
# class service_func:
# class default_func(service_func):
#     def __init__(self, message):
#     def __str__(self):
#     def __init__(self, func_path):
#     def check_server_key(self, args, server):
#     def init(self):
#     def execute(self, args, server):
#     def answer(self):
#     def get_meta(self):
#     def __init__(self, functions):
#     def answer(self):


from ..service_func import service_func, func_error, meta_arg


class get_categories_rank(service_func):
    def __init__(self):
        service_func.__init__(self, "/category/ranks")
        self.name = "Get categories ranks"
        self.description = "-"

        self.cats = []

    def init(self):
        self.cats = []

    def execute(self, args, server):
        for c in server.game_data.categories:
            cat = {
                "id": c.id,
                "name": c.name,
                "ranks_available": []
            }

            for r in c.ranks_available:
                cat["ranks_available"].append(r)

            self.cats.append(cat)

    def answer(self):
        data = {

# Path: webservice/service_func.py
# class func_error(Exception):
# class service_func:
# class default_func(service_func):
#     def __init__(self, message):
#     def __str__(self):
#     def __init__(self, func_path):
#     def check_server_key(self, args, server):
#     def init(self):
#     def execute(self, args, server):
#     def answer(self):
#     def get_meta(self):
#     def __init__(self, functions):
#     def answer(self):


# Path: webservice/funcs/get_categories_rank.py
from ..service_func import service_func, func_error, meta_arg



class get_categories_rank(service_func):
    def __init__(self):
        service_func.__init__(self, "/category/ranks")
        self.name = "Get categories ranks"
        self.description = "-"

        self.cats = []

    def init(self):
        self.cats = []

    def execute(self, args, server):
        for c in server.game_data.categories:
            cat = {
                "id": c.id,
                "name": c.name,
                "ranks_available": []
            }

            for r in c.ranks_available:
                cat["ranks_available"].append(r)

            self.cats.append(cat)

    def answer(self):
        data = {

            'categories': self.cats