import path_setting
from in_common.base_request import BaseRequest


class user_request(BaseRequest):

    def __init__(self):
        self.data = self.api_load(path_setting.PERSONAL_CENTER_CONFIG)

    def personal_center(self):

        return self.api_send(self.data["personal_center"])




    def __init__(self):
        self.data = self.api_load(path_setting.USER_ANSWER_CONFIG)

    #医院主页问答列表
    def answer(self, user):
        self.params["user"] = user
        return self.api_send(self.data["answer"])

    #我的-日记
    def my_diary_v2(self, start_num, count):

        self.params["start_num"] = start_num
        self.params["count"] = count



        return self.api_send(self.data["my_diary_v2"])

     # 我的-帖子-我发布的
    def user_tractate(self, page, count):

        self.params["page"] = page
        self.params["count"] = count


        return self.api_send(self.data["user_tractate"])

     # 我的-帖子-我回复的
    def reply_tractate(self, page, count, version):

        self.params["page"] = page
        self.params["count"] = count
        self.params["version"] = version


        return self.api_send(self.data["reply_tractate"])


     # 我的-问题-提问
    def my_question(self, start_num, count):

        self.params["start_num"] = start_num
        self.params["count"] = count


        return self.api_send(self.data["my_question"])

     # 我的-收藏-商品
    def favors_services(self, start_num, count, current_city_id, device_id, version):

        self.params["start_num"] = start_num
        self.params["count"] = count
        self.params["current_city_id"] = current_city_id
        self.params["device_id"] = device_id
        self.params["version"] = version

        return self.api_send(self.data["favors_services"])

     # 我的-问题-回答
    def my_answer(self, start_num, count):

        self.params["start_num"] = start_num
        self.params["count"] = count

        return self.api_send(self.data["my_answer"])

     # 我的-收藏-日记本
    def favors_diaries(self, start_num, count):

        self.params["start_num"] = start_num
        self.params["count"] = count

        return self.api_send(self.data["favors_diaries"])

     # 我的-收藏-日记贴
    def favors_topics(self, start_num, count):

        self.params["start_num"] = start_num
        self.params["count"] = count

        return self.api_send(self.data["favors_topics"])

     # 我的-收藏-帖子
    def favors_tractate(self, page, count):

        self.params["page"] = page
        self.params["count"] = count

        return self.api_send(self.data["favors_tractate"])

     # 我的-收藏-回答
    def favors_answers(self, page, count):

        self.params["page"] = page
        self.params["count"] = count

        return self.api_send(self.data["favors_answers"])

     # 我的-粉丝和关注
    def following_or_fans(self, start_num, uid, type, version, current_city_id, device_id):

        self.params["start_num"] = start_num
        self.params["uid"] = uid
        self.params["type"] = type
        self.params["version"] = version
        self.params["current_city_id"] = current_city_id
        self.params["device_id"] = device_id

        return self.api_send(self.data["following_or_fans"])

     # 签到情况
    def base_sign_data(self, client_source, json, version,  device_id):

        self.params["client_source"] = client_source
        self.params["json"] = json
        self.params["version"] = version
        self.params["device_id"] = device_id


        return self.api_send(self.data["base_sign_data"])

if __name__ == '__main__':

    #签到情况
    print(user_request().base_sign_data("app", "", "7.45.0", "869378034450718"))

    # 我的-我的粉丝
    print(user_request().following_or_fans(0, "33910245", "fans", "7.45.0", "beijing", "androidid_16a95f3fa31a4c0b"))

    #个人中心
    print(user_request().personal_center())


    #打印医生/医院主页问答列表接口返回
    print(user_request().answer("21476198"))

    #我的-日记
    print(user_request().my_diary_v2(0, 10))

    #我的-帖子-我发布的
    print(user_request().user_tractate(1, 10))

    #我的-问题
    print(user_request().my_question(0, 10))

    #我的-问题
    print(user_request().favors_services(0, 10, "beijing", "androidid_16a95f3fa31a4c0b", "7.46.0"))
    #我的-帖子-我回复的
    print(user_request().reply_tractate(1, 10, "7.46.0"))

    # 我的-问题-回答
    print(user_request().my_answer(0, 10))

    # 我的-收藏-日记本
    print(user_request().favors_diaries(0, 10))

    # 我的-收藏-日记贴
    print(user_request().favors_topics(0, 10))

   # 我的-收藏-帖子
    print(user_request().favors_tractate(1, 10))

   # 我的-收藏-帖子
    print(user_request().favors_answers(1, 10))






