/*
 * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
 */
package kr.co.zumo.app.lifeplus.view.presenter;

import android.support.v7.app.ActionBar;
import android.util.Log;

import io.reactivex.disposables.Disposable;
import kr.co.zumo.app.lifeplus.model.PinModel;
import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
import kr.co.zumo.app.lifeplus.view.Event;
import kr.co.zumo.app.lifeplus.view.IPinView;
import kr.co.zumo.app.lifeplus.view.command.ActivityChangeCommand;

/**
 * PinResetPresenter
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018. 9. 21.]   [최초 작성]
 * @since 2018. 9. 21.
 */
public class PinResetPresenter extends Presenter<PinModel, IPinView> {

  private Disposable disposable;

  public PinResetPresenter(PinModel model, IPinView view) {
    super(model, view);
  }

  @Override
  protected void startInternal() {

  }

  @Override
  protected void stopInternal() {

  }

  @Override
  protected void resumeInternal() {

  }

  @Override
  protected void pauseInternal() {

  }

  @Override
  protected void destroyInternal() {
    if (null != disposable) {
      disposable.dispose();
      disposable = null;
    }
  }

  @Override
  public void onResult(Event event) {

  }

  @Override
  public boolean onBackPressed() {
    onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MAIN, ScreenID.DIRECTION_BACK));
    return true;
  }

  @Override
  protected void onEventInternal(Event event) {
    switch (event.getEventId()) {
      case Event.SUCCESS:
        String pin = event.getString();
        Log.i("APP# PinResetPresenter | onEventInternal", "|" + pin);
        model.savePin(pin);
        onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MAIN, ScreenID.DIRECTION_NEXT));
        break;
      default:
        break;
    }
  }

  @Override
  public void onClickTitle(ActionBar actionBar) {

  }

  @Override
  public void onClickSearch(ActionBar actionBar) {

  }

  @Override
  public void onClickMenu(ActionBar actionBar) {

  }

  @Override
  public void onClickLike(ActionBar actionBar) {

  }

  @Override
  public void onClickBookmark(ActionBar actionBar) {

  }

  @Override
  public void onClickShare(ActionBar actionBar) {

  }
}
