# Path: pykintone/comment.py
# class Mention():
# 
#     def __init__(self, code, target_type):
#         self.code = code
#         self.target_type = target_type
# 
#     @classmethod
#     def deserialize(cls, mention_dict):
#         return Mention(mention_dict["code"], mention_dict["type"])
# 
#     def serialize(self):
#         return {
#             "code": self.code,
#             "type": self.target_type
#         }


import json
import requests
import pykintone.comment_result as cr
from pykintone.comment import Mention
        return r


    def create(self, comment, mentions=()):
        """
        create comment
        :param comment:
        :param mentions: list of pair of code and type("USER", "GROUP", and so on)
        :return:
        """

        data = {
            "app": self.app_id,
            "record": self.record_id,
            "comment": {
                "text": comment,
            }
        }

        if len(mentions) > 0:
            _mentions = []
            for m in mentions:
                if isinstance(m, (list, tuple)):
                    if len(m) == 2:
                        _mentions.append({
                            "code": m[0],
                            "type": m[1]
                        })
                    else:
                        raise Exception("mention have to have code and target type. ex.[('user_1', 'USER')]")

# Path: pykintone/comment.py
# class Mention():
# 
#     def __init__(self, code, target_type):
#         self.code = code
#         self.target_type = target_type
# 
#     @classmethod
#     def deserialize(cls, mention_dict):
#         return Mention(mention_dict["code"], mention_dict["type"])
# 
#     def serialize(self):
#         return {
#             "code": self.code,
#             "type": self.target_type
#         }


# Path: pykintone/comment_api.py
import json
import requests
import pykintone.comment_result as cr
from pykintone.comment import Mention

        return r


    def create(self, comment, mentions=()):
        """
        create comment
        :param comment:
        :param mentions: list of pair of code and type("USER", "GROUP", and so on)
        :return:
        """

        data = {
            "app": self.app_id,
            "record": self.record_id,
            "comment": {
                "text": comment,
            }
        }

        if len(mentions) > 0:
            _mentions = []
            for m in mentions:
                if isinstance(m, (list, tuple)):
                    if len(m) == 2:
                        _mentions.append({
                            "code": m[0],
                            "type": m[1]
                        })
                    else:
                        raise Exception("mention have to have code and target type. ex.[('user_1', 'USER')]")

                elif isinstance(m, Mention):