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

import io.reactivex.Single;
import kr.co.zumo.app.lifeplus.bean.api.LifeplusAPIBean;
import kr.co.zumo.app.lifeplus.bean.api.MobileAuthorizationBean;
import kr.co.zumo.app.lifeplus.bean.api.MobileAuthorizationConfirmBean;
import kr.co.zumo.app.lifeplus.config.NetworkConfig;

/**
 * LifeplusAPIService
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018. 9. 19.]   [최초 작성]
 * @since 2018. 9. 19.
 */
public class LifeplusAPIService extends RetrofitService {

  private static final String AUTH_URL = NetworkConfig.HOST_URL + ":" + NetworkConfig.HOST_PORT + "/";
  private static final String METHOD_GET = "GET";

  private static LifeplusAPI api(String url) {
    return retrofit(url, LifeplusAPI.class, 2000);
  }

  /**
   * 모바일 인증 번호 요청
   *
   * @param bean MobileAuthorizationBean
   * @return rx single with LifeplusAPIBean
   */
  public static Single<LifeplusAPIBean> requestMobileAuthorizationNumber(MobileAuthorizationBean bean) {
    return api(AUTH_URL).requestMobileAuthorizationNumber(bean);
  }

  /**
   * 인증 번호 확인 요청
   *
   * @param bean MobileAuthorizationConfirmBean
   * @return rx single with LifeplusAPIBean
   */
  public static Single<LifeplusAPIBean> requestMobileAuthorization(MobileAuthorizationConfirmBean bean) {
    return api(AUTH_URL).requestMobileAuthorization(bean);
  }
}
