function UserModel(_lineUserId) {

  let m_lineUserId = _lineUserId;

  function init() {
  }

  /**
   * 用戶登入
   * @returns {TypeUserResponse} Promise
   */
  function loginUser () {
    return GET('/api/survey/healthyPassPort/profile?lineUserId='+m_lineUserId);
  }

  /**
   * 用戶註冊
   * @param {object} _formdata 
   * @returns {TypeResponse} Promise
   */
  function registerUser (_formdata) {
    return POST('/api/survey/healthyPassPort/post', {
      lineUserId: m_lineUserId,
      ..._formdata,
    }).catch((error)=> {
      console.log('_register:' + error);
      throw '表單儲存失敗';
    });
  }

  /**
  * 用戶更新頭貼
  * @returns {TypeUserResponse} Promise
  */
    function updatePhoto(base64Image) {
      return POST('/api/survey/healthyPassPort/stickerUpdate', {
        lineUserId: m_lineUserId,
        headSticker: base64Image,
      });
    }
  
  /**
    * 驗證表單
    * @param {object} formdata 
    * @returns {Object | boolean}
    */
  function verifyUserForm(theContext) {
    const {userName, IDNo, phone, birthday} = formdata;
    let output;
    
    if (!userName || userName.length === 0) {
      output['userName'] = '姓名格式不正確';
    }

    if (/[A-Za-z]{1}[1-2]{1}[0-9]{8}$/.test(IDNo)) {
      output['IDNo'] = '身分證格式不正確';
    }

    if (/09\d{2}\d{3}\d{3}/.test(phone)) {
      output['phone'] = '電話格式不正確';
    }

    if (!/[0-9]{4}\/[0-9]{3}\/[0-9]{3}$/.test(birthday)) {
      output['birthday'] = '生日格式不正確';
    }

    if (output) {
      return output;
    }

    return true;
  }

  {
    init();  
  }

  return {
    loginUser,
    registerUser,
    verifyUserForm,
    updatePhoto
  }
}