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

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import kr.co.zumo.app.R;
import kr.co.zumo.app.lifeplus.model.RestMemberModel;
import kr.co.zumo.app.lifeplus.view.Event;
import kr.co.zumo.app.lifeplus.view.IView;
import kr.co.zumo.app.lifeplus.view.fragment.FragmentBase;
import kr.co.zumo.app.lifeplus.view.presenter.rest.RestMemberStartPresenter;

/**
 * RestMemberStartFragment
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018. 10. 8.]   [최초 작성]
 * @since 2018. 10. 8.
 */
public class RestMemberStartFragment extends FragmentBase<RestMemberStartPresenter> implements IView {
  @Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.activity_rest_member, container, false);
  }

  @Override
  protected void onAfterActivityCreated(Bundle savedInstanceState) {
    View parent = getView();

    parent.findViewById(R.id.button_rest_member_close).setOnClickListener(v -> {
      // 닫기 버튼
      presenter.onEvent(new Event.Builder(Event.EXIT).build());
    });

    parent.findViewById(R.id.button_rest_cancel).setOnClickListener(v -> {
      // 휴면 해제
      presenter.onEvent(new Event.Builder(Event.CONFIRM).build());
    });

    parent.findViewById(R.id.text_view_rest_email_information).setOnClickListener(v -> {
      presenter.onEvent(new Event.Builder(Event.EMAIL_CLICK).build());
    });

  }

  @Override
  protected RestMemberStartPresenter definePresenter() {
    return new RestMemberStartPresenter(getModel(RestMemberModel.class), this);
  }
}
