(function (paw, utils, _super) {
  paw.lang.extend(Fa2Auth, _super);
  function Fa2Auth(settings, localization) {
    _super.call(this, settings, localization);
  }

  Fa2Auth.prototype.onFa2Requested = function (resp) {
    if (resp.Required) {
      this.fa2Data.phoneNumber = resp.PhoneNumber;
      this.fa2Data.email = resp.Email;
      this.fa2Data.viberPhone = resp.ViberPhone;
      this.fa2Data.resendLockDuration = resp.ResendLockDuration;
      return true;
    }
    this.fa2Completed = true;
    return false;
  };

  Fa2Auth.prototype.requestFa2 = function () {
    return utils.async.post(this.settings.check2FaApiUrl, this.authModel());
  };

  Fa2Auth.prototype.authModel = function () {
    return {
      Username: this.settings.$username.val(),
      Password: this.settings.$password.val(),
      DomainName: this.settings.$domain.val(),
    };
  };

  paw.com.fa2.Fa2Auth = Fa2Auth;
})(paw, paw.utils, paw.com.fa2.Fa2Base);
