package com.tofly.ghrq_route.module.trouble.service;

import android.content.Context;

import com.tofly.ghrq_route.base.URLResponseCode;
import com.tofly.ghrq_route.module.trouble.TroubleDaoHelper;
import com.tofly.ghrq_route.module.trouble.controller.TroubleCallBack;
import com.tofly.ghrq_route.module.trouble.domain.AuditSchemeBean;
import com.tofly.ghrq_route.module.trouble.domain.TroubleAudioBean;
import com.tofly.ghrq_route.module.trouble.domain.TroubleBean;
import com.tofly.ghrq_route.module.trouble.domain.TroublePictureBean;

import java.util.List;

/**
 * Created by Amu on 2017/3/8.
 */

public class TroubleServiceImplOffline implements ITroubleService {
    private Context mContext;

    private TroubleDaoHelper troubleDaoHelper;

    public TroubleServiceImplOffline(Context context){
        mContext = context;
        troubleDaoHelper = TroubleDaoHelper.getInstance();
    }

    @Override
    public void getTroubleList(Context context, final String userid, int select_state, String keyword, final int pageindex, final int pagesize, final TroubleCallBack troubleCallBack) {
        int total = 0;
        List<TroubleBean> troubleBeans = troubleDaoHelper.getTroubleList(userid, TroubleBean.SERVER_STATE, TroubleBean.TROUBLE_TYPE_DANGER);
        if (troubleBeans != null) {
            total = troubleBeans.size();
        }
        troubleCallBack.onGetTroubleList(true, URLResponseCode.ErrorCode.SUCCESS_OFFLINE, "", troubleBeans, total);
    }

    @Override
    public void getTroubleAudio(final String token, final String url, final TroubleCallBack troubleCallBack) {
        TroubleAudioBean audioBean = troubleDaoHelper.queryTroubleAudio(url);
        troubleCallBack.onGetTroubleAudio(true, URLResponseCode.ErrorCode.SUCCESS_OFFLINE, "", audioBean.getPath());
    }

    @Override
    public void getTroubleFile(Context context, String url, String fileName, String fileDir,TroubleCallBack troubleCallBack) {
        TroubleAudioBean audioBean = troubleDaoHelper.queryTroubleAudio(url);
        troubleCallBack.onGetTroubleFile(true, URLResponseCode.ErrorCode.SUCCESS_OFFLINE, "", audioBean.getPath());
    }

    @Override
    public void getTroubleInfo(Context context, String troubleid, final TroubleCallBack troubleCallBack) {
        TroubleBean troubleBean = troubleDaoHelper.queryTrouble(troubleid);
        troubleCallBack.onGetTroubleInfo(true, URLResponseCode.ErrorCode.SUCCESS_OFFLINE, "", troubleBean);
    }

    @Override
    public void getTroubleEventType(Context context, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void addTroubleRecord(final String token, final String tableid, final List<TroublePictureBean> photos, final List<TroubleAudioBean> audios, final String notes, final TroubleCallBack troubleCallBack) {

    }

    @Override
    public void getTroubleRecordList(final String token, final String tableid, final String searchDate, final int pageindex, final int pagesize, final TroubleCallBack troubleCallBack) {

    }

    @Override
    public void removeTroubleRecord(final String token, final String tableid, final TroubleCallBack troubleCallBack) {

    }

    @Override
    public void addTroubleClearRecord(final String token, final String troubleid, final String plan_point_id, final List<TroublePictureBean> photos, final List<TroubleAudioBean> audios, final String notes, final TroubleCallBack troubleCallBack) {

    }

    @Override
    public void getTroubleClearRecordList(final String token, final String troubleid, final String childPlanId, final int pageindex, final int pagesize, final TroubleCallBack troubleCallBack) {

    }

    @Override
    public void addTroubleNew(Context context, final TroubleBean troubleBean, final List<TroublePictureBean> photos,
                              final List<TroubleAudioBean> audios, List<TroubleAudioBean> files, final TroubleCallBack troubleCallBack) {

    }

    @Override
    public void ondutyUserCheckTrouble(Context context, TroubleBean trouble, List<TroublePictureBean> photos,
                                       List<TroubleAudioBean> audios, List<TroubleAudioBean> files, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void undertakerVerifyTrouble(Context context, TroubleBean troubleBean, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void undertakerHandleTrouble(Context context, TroubleBean troubleBean, List<TroublePictureBean> photos,
                                        List<TroubleAudioBean> audios, List<TroubleAudioBean> files, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void underSectaryVerifyAssignTrouble(Context context, TroubleBean troubleBean, AuditSchemeBean schemeBean, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void ondutyMakeScheme(Context context, String troubleId, int flag, AuditSchemeBean schemeBean, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void sectaryVerifyScheme(Context context, TroubleBean troubleBean, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void ondutyHandleScheme(Context context, TroubleBean troubleBean, String notes, List<TroublePictureBean> photos, List<TroubleAudioBean> audios, List<TroubleAudioBean> files, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void undersectaryVerifyHandle(Context context, TroubleBean troubleBean, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void updatePipeDevice(Context context, TroubleBean troubleBean, TroubleCallBack troubleCallBack) {

    }

    @Override
    public void getRestrictFileInfo(Context context, TroubleCallBack troubleCallBack) {

    }
}
