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

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 android.widget.TextView;

import kr.co.zumo.app.R;
import kr.co.zumo.app.lifeplus.model.SignUpModel;
import kr.co.zumo.app.lifeplus.view.Event;
import kr.co.zumo.app.lifeplus.view.fragment.FragmentBase;
import kr.co.zumo.app.lifeplus.view.presenter.signup.ISignUpCompletedView;
import kr.co.zumo.app.lifeplus.view.presenter.signup.SignUpCompletePresenter;

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

  @Override
  protected void onAfterActivityCreated(Bundle savedInstanceState) {

    View buttonAuthorization = getView().findViewById(R.id.button_start_life_plus);

    buttonAuthorization.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.SUCCESS).build()));

    presenter.onEvent(new Event.Builder(Event.INIT).build());
  }

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

  @Override
  public void setText(String text) {
    ((TextView) getView().findViewById(R.id.text_view_sign_up_success_message)).setText(text);
  }
}
