package com.oo.eye.net;

import android.content.Context;

import com.app.baselibrary.base.app.BaseApplication;
import com.oo.eye.bean.SchoolBean;
import com.oo.eye.bean.StudentBean;
import com.oo.seex.netlibrary.net.response.OldResponseImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import rx.Observable;
import rx.schedulers.Schedulers;

/**
 * Desc:app管理类；（网络本地管理）
 * Author: pl
 * Date: 2017-03-16 19:45
 */
public class EyeDataManager {
    private static final String TAG = "EyeDataManager";
    private static EyeDataManager sAppDateManager;
    private Context mContext;
    public static EyeDataManager getInstance() {
        if (null == sAppDateManager) {
            synchronized (EyeDataManager.class) {
                if (null == sAppDateManager)
                    sAppDateManager = new EyeDataManager();
            }
        }
        return sAppDateManager;
    }
    public EyeDataManager() {
        mContext = BaseApplication.getAppContext();
    }

    /**
     * 上传视力测试结果
     */
    public Observable<OldResponseImpl<String>> postEyeTestData(Map<String ,String> params){
        return EyeNetManager.getInstance().getApiService(EyeApiService.class).postEyeTestData(params)
				.subscribeOn(Schedulers.io());
    }

    /**
     * 获取学校信息
     */
    public Observable<OldResponseImpl<SchoolBean>> getSchoolInfo(String schoolId){
		Map<String,String> map = new HashMap<>();
		map.put("sid",schoolId);
        return EyeNetManager.getInstance().getApiService(EyeApiService.class).getSchoolInfo(map)
				.subscribeOn(Schedulers.io());
    }

    /**
     * 获取学生信息
     */
    public Observable<OldResponseImpl<List<StudentBean>>> getStudents(Map<String ,String> params){
        return EyeNetManager.getInstance().getApiService(EyeApiService.class).getStudents(params)
				.subscribeOn(Schedulers.io());
    }

}
