package com.cooleshow.teacher.presenter.homePage;

import com.common.im.bean.ContactRoomListBean;
import com.cooleshow.base.presenter.BasePresenter;
import com.cooleshow.base.rx.BaseObserver;
import com.cooleshow.teacher.api.APIService;
import com.cooleshow.teacher.bean.TeacherSelfStyleInfoBean;
import com.cooleshow.teacher.bean.TeacherUserInfo;
import com.cooleshow.teacher.bean.request.QueryGroupListEntry;
import com.cooleshow.teacher.contract.HomePageContract;
import com.cooleshow.teacher.contract.MineStyleContract;
import com.cooleshow.usercenter.bean.UserInfo;

import java.util.List;

/**
 * Author by pq, Date on 2022/4/20.
 */
public class MineStylePresenter extends BasePresenter<MineStyleContract.MineStylePageView> implements MineStyleContract.Presenter {

    /**
     * 查询UserInfo
     *
     * @param
     */
    public void getUserInfo() {
        addSubscribe(create(APIService.class).getUserInfo(), new BaseObserver<UserInfo>(getView()) {
            @Override
            protected void onSuccess(UserInfo data) {
//                if (getView() != null) {
//                    getView().getUserInfoSuccess(data);
//                }
            }
        });
    }

    @Override
    public void getTeacherSelfStyle() {
        addSubscribe(create(APIService.class).getTeacherSelfStyle(), new BaseObserver<TeacherSelfStyleInfoBean>(getView()) {
            @Override
            protected void onSuccess(TeacherSelfStyleInfoBean data) {
                if (getView() != null) {
                    getView().getSelfStyleSuccess(data);
                }
            }
        });
    }

    public void getTeaGroupList() {
        QueryGroupListEntry entry = new QueryGroupListEntry();
        entry.type = "FAN";
        addSubscribe(create(APIService.class).queryTeaGroupList(entry), new BaseObserver<List<ContactRoomListBean>>(getView()) {
            @Override
            protected void onSuccess(List<ContactRoomListBean> list) {
                if (getView() != null) {
                    getView().getFunGroupList(list);
                }
            }
        });
    }
}
