/*
 *      Copyright 2015-2016 GetSocial B.V.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

  var ViewBuilder = require('./ViewBuilder')

  var NATIVE_BRIDGE_NAME = "GetSocialCordova";

  var SmartInviteViewBuilder = function() {
    this.subject = null;
    this.text = null;
    this.referralData = null;
    this.imagePath = null;
  }

    SmartInviteViewBuilder.prototype.setSubject = function(subject) {
      this.subject = subject;
      return this;
    }

    SmartInviteViewBuilder.prototype.setText = function(text) {
      this.text = text;
      return this;
    }

    SmartInviteViewBuilder.prototype.setReferralData = function(referralData) {
       this.referralData = referralData;
       return this;
    }

    SmartInviteViewBuilder.prototype.setImagePath = function(imagePath) {
        this.imagePath = imagePath;
        return this;
    }

    SmartInviteViewBuilder.prototype.show = function() {
      var option = this.toJson();
      if(this.subject != null) {
        option.subject = this.subject;
      }
      if(this.text != null) {
        option.text = this.text;
      }
      if(this.referralData != null) {
        option.referralData = this.referralData;
      }
      if(this.imagePath != null) {
        option.imagePath = this.imagePath;
      }

      cordova.exec(null, null, NATIVE_BRIDGE_NAME, "createSmartInviteView", [option]);
    }

    SmartInviteViewBuilder.prototype.close = function() {
      var option = {}
      cordova.exec(null, null, NATIVE_BRIDGE_NAME, "closeSmartInviteView", [option]);
    }

  SmartInviteViewBuilder.prototype.__proto__ = ViewBuilder.prototype;

  module.exports = SmartInviteViewBuilder;
h