package com.casic.dcms.mvp.presenter.impl;

import com.casic.dcms.bean.CaseVerifyBean;
import com.casic.dcms.listener.OnGetCaseVerifyListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.CaseVerifyModelImpl;
import com.casic.dcms.mvp.presenter.ICaseVerifyPresenter;
import com.casic.dcms.mvp.view.ICaseVerifyView;

public class CaseVerifiedPresenterImpl extends BasePresenter implements ICaseVerifyPresenter, OnGetCaseVerifyListener {

    private final ICaseVerifyView view;
    private final CaseVerifyModelImpl actionModel;

    public CaseVerifiedPresenterImpl(ICaseVerifyView caseVerifyView) {
        this.view = caseVerifyView;
        actionModel = new CaseVerifyModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(int limit, int offset) {
        addSubscription(actionModel.sendCaseVerifyRequest(limit, offset, true));
    }

    @Override
    public void disposeRetrofitRequest() {
        unSubscription();
    }

    @Override
    public void onSuccess(CaseVerifyBean resultBean) {
        view.obtainVerifyListResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
