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

import android.os.Bundle;
import android.support.v7.app.ActionBar;

import kr.co.zumo.app.R;
import kr.co.zumo.app.lifeplus.manager.ActionBarManager;
import kr.co.zumo.app.lifeplus.model.Model;
import kr.co.zumo.app.lifeplus.model.SuperModel;
import kr.co.zumo.app.lifeplus.view.Event;
import kr.co.zumo.app.lifeplus.view.IView;
import kr.co.zumo.app.lifeplus.view.command.ExitCommand;
import kr.co.zumo.app.lifeplus.view.presenter.Presenter;

/**
 * PermissionInfoActivity
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018-09-29]   [최초 작성]
 * @since 2018-09-29
 */
public class PermissionInfoActivity extends ActivityBase {
  ActivityStarter starter;

  @Override
  void onAfterCreate(Bundle savedInstanceState) {

    setContentView(R.layout.activity_access_authority);

    starter = new ActivityStarter(this);

    findViewById(R.id.button_access_authority).setOnClickListener(v -> {
      SuperModel.getInstance().getPreferences().setPermissionInfoDone(true);

      starter.launch(true);
    });

  }

  @Override
  void defineActionBar() {
    ActionBarManager.getInstance().hide();
  }

  @Override
  Presenter definePresenter() {
    return new InnerPresenter(new InnerModel(), this);
  }

  @Override
  public void onBackPressed() {
    presenter.onEvent(new Event.Builder(Event.BACK).build());
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (null != starter) {
      starter.dispose();
      starter = null;
    }
  }

  private class InnerPresenter extends Presenter {

    public InnerPresenter(Model model, IView view) {
      super(model, view);
    }

    @Override
    public boolean onBackPressed() {
      return false;
    }

    @Override
    protected void destroyInternal() {

    }

    @Override
    protected void startInternal() {

    }

    @Override
    protected void stopInternal() {

    }

    @Override
    protected void resumeInternal() {

    }

    @Override
    protected void pauseInternal() {

    }

    @Override
    protected void onEventInternal(Event event) {
      switch (event.getEventId()) {
        case Event.BACK:
          onCommand(new ExitCommand());
          break;
        default:
          break;
      }

    }

    @Override
    public void onResult(Event event) {

    }

    @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) {

    }
  }

  private class InnerModel extends Model {

    @Override
    protected void destroyInternal() {

    }

    @Override
    protected void startInternal() {

    }

    @Override
    protected void stopInternal() {

    }

    @Override
    protected void resumeInternal() {

    }

    @Override
    protected void pauseInternal() {

    }
  }
}
