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


import android.util.Log;

import kr.co.zumo.app.lifeplus.activity.ActivityStarter;
import kr.co.zumo.app.lifeplus.model.SuperModel;
import kr.co.zumo.app.lifeplus.model.TutorialModel;
import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
import kr.co.zumo.app.lifeplus.view.Event;
import kr.co.zumo.app.lifeplus.view.ITutorialView;
import kr.co.zumo.app.lifeplus.view.command.ActivityChangeCommand;

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

  public TutorialPresenter(TutorialModel model, ITutorialView view) {
    super(model, view);
  }

  @Override
  public void startInternal() {

  }

  @Override
  protected void stopInternal() {

  }

  @Override
  protected void resumeInternal() {

  }

  @Override
  protected void pauseInternal() {

  }

  @Override
  protected void destroyInternal() {
  }

  @Override
  public void onResult(Event event) throws Throwable {

  }

  @Override
  public boolean onBackPressed() {
    Log.e("APP#  TutorialPresenter | onBackPressed", "|" + "onBackPressed");
    onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MAIN, ScreenID.DIRECTION_BACK));
    return true;
  }

  @Override
  protected void onEventInternal(Event event) {
    switch (event.getEventId()) {
      case Event.TUTORIAL_CLOSE:
        // tutorial 본 것으로 표시
        SuperModel.getInstance().getPreferences().setTutorialDone(true);

        ActivityStarter starter = new ActivityStarter(view.getActivity());
        starter.launch(true);
        break;
      case Event.TUTORIAL_NEXT:
        view.onNextButtonClick();
        break;

      default:
        break;
    }

  }
}
