text: 'use strict';
  
  /* jshint ignore:start */
  /**
   * This code was generated by
   * \ / _    _  _|   _  _
   *  | (_)\/(_)(_|\/| |(/_  v1.0.0
   *       /       /
   */
  /* jshint ignore:end */
  
  var Q = require('q');  /* jshint ignore:line */
  var _ = require('lodash');  /* jshint ignore:line */
  var Page = require('../../../base/Page');  /* jshint ignore:line */
  var deserialize = require(
      '../../../base/deserialize');  /* jshint ignore:line */
  var values = require('../../../base/values');  /* jshint ignore:line */
  
  var ConfigurationList;
  var ConfigurationPage;
  var ConfigurationInstance;
  var ConfigurationContext;
  
  /* jshint ignore:start */
  /**
   * @description Initialize the ConfigurationList
   *
   * @param {Twilio.FlexApi.V1} version - Version of the resource
   */
  /* jshint ignore:end */
  ConfigurationList = function ConfigurationList(version) {
    /* jshint ignore:start */
    /**
     * @param {string} sid - sid of instance
     *
     * @returns {Twilio.FlexApi.V1.ConfigurationContext}
     */
    /* jshint ignore:end */
    function ConfigurationListInstance(sid) {
      return ConfigurationListInstance.get(sid);
    }
  
    ConfigurationListInstance._version = version;
    // Path Solution
    ConfigurationListInstance._solution = {};
    /* jshint ignore:start */
    /**
     * Constructs a configuration
     *
     * @returns {Twilio.FlexApi.V1.ConfigurationContext}
     */
    /* jshint ignore:end */
    ConfigurationListInstance.get = function get() {
      return new ConfigurationContext(this._version);
    };
  
    return ConfigurationListInstance;
  };
  
  
  /* jshint ignore:start */
  /**
   * Initialize the ConfigurationPage
   *
   * @param {V1} version - Version of the resource
   * @param {Response<string>} response - Response from the API
   * @param {ConfigurationSolution} solution - Path solution
   *
   * @returns ConfigurationPage
   */
  /* jshint ignore:end */
  ConfigurationPage = function ConfigurationPage(version, response, solution) {
    // Path Solution
    this._solution = solution;
  
    Page.prototype.constructor.call(this, version, response, this._solution);
  };
  
  _.extend(ConfigurationPage.prototype, Page.prototype);
  ConfigurationPage.prototype.constructor = ConfigurationPage;
  
  /* jshint ignore:start */
  /**
   * Build an instance of ConfigurationInstance
   *
   * @param {ConfigurationPayload} payload - Payload response from the API
   *
   * @returns ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationPage.prototype.getInstance = function getInstance(payload) {
    return new ConfigurationInstance(this._version, payload);
  };
  
  
  /* jshint ignore:start */
  /**
   * Initialize the ConfigurationContext
   *
   * @property {string} accountSid -
   *          The unique id of the Account responsible for this configuration
   * @property {Date} dateCreated -
   *          The time the Configuration was created, given as GMT in ISO 8601 format
   * @property {Date} dateUpdated -
   *          The time the Configuration was last updated, given as GMT in ISO 8601 format
   * @property {string} attributes - Attiributes
   * @property {configuration.status} status - Status of the Flex onboarding
   * @property {string} taskrouterWorkspaceSid -
   *          The unique ID of the TaskRouter Workspace
   * @property {string} taskrouterTargetWorkflowSid -
   *          The unique ID of the TaskRouter Target Workflow
   * @property {string} taskrouterTargetTaskqueueSid -
   *          The unique ID of the TaskRouter Target TaskQueue
   * @property {string} taskrouterTaskqueues - Array of TaskRouter TaskQueues
   * @property {string} taskrouterSkills - Skill description for TaskRouter workers
   * @property {string} taskrouterWorkerChannels -
   *          TaskRouter default channel capacities and availability for workers
   * @property {string} taskrouterWorkerAttributes - The taskrouter_worker_attributes
   * @property {string} taskrouterOfflineActivitySid -
   *          The unique ID of the offline activity
   * @property {string} runtimeDomain - Flex resources hosting URL for the main UI
   * @property {string} messagingServiceInstanceSid -
   *          Unique 34 character ID of the Messaging Service
   * @property {string} chatServiceInstanceSid -
   *          The unique id of the Chat Service this user belongs to
   * @property {string} uiLanguage - Main language of the Flex UI
   * @property {string} uiAttributes - UI Attributes
   * @property {string} uiVersion - Pinned UI version
   * @property {string} serviceVersion - Flex Service version
   * @property {boolean} callRecordingEnabled - Call recording enabled
   * @property {string} callRecordingWebhookUrl - Call recording webhook url
   * @property {boolean} crmEnabled - Flag indicating whether CRM is present for Flex
   * @property {string} crmType - CRM Type
   * @property {string} crmCallbackUrl - CRM Callback URL
   * @property {string} crmFallbackUrl - CRM Fallback URL
   * @property {string} crmAttributes - CRM Attributes
   * @property {string} publicAttributes - Public Attributes
   * @property {string} url - The URL for this resource
   *
   * @param {V1} version - Version of the resource
   * @param {ConfigurationPayload} payload - The instance payload
   */
  /* jshint ignore:end */
  ConfigurationInstance = function ConfigurationInstance(version, payload) {
    this._version = version;
  
    // Marshaled Properties
    this.accountSid = payload.account_sid; // jshint ignore:line
    this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
    this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
    this.attributes = payload.attributes; // jshint ignore:line
    this.status = payload.status; // jshint ignore:line
    this.taskrouterWorkspaceSid = payload.taskrouter_workspace_sid; // jshint ignore:line
    this.taskrouterTargetWorkflowSid = payload.taskrouter_target_workflow_sid; // jshint ignore:line
    this.taskrouterTargetTaskqueueSid = payload.taskrouter_target_taskqueue_sid; // jshint ignore:line
    this.taskrouterTaskqueues = payload.taskrouter_taskqueues; // jshint ignore:line
    this.taskrouterSkills = payload.taskrouter_skills; // jshint ignore:line
    this.taskrouterWorkerChannels = payload.taskrouter_worker_channels; // jshint ignore:line
    this.taskrouterWorkerAttributes = payload.taskrouter_worker_attributes; // jshint ignore:line
    this.taskrouterOfflineActivitySid = payload.taskrouter_offline_activity_sid; // jshint ignore:line
    this.runtimeDomain = payload.runtime_domain; // jshint ignore:line
    this.messagingServiceInstanceSid = payload.messaging_service_instance_sid; // jshint ignore:line
    this.chatServiceInstanceSid = payload.chat_service_instance_sid; // jshint ignore:line
    this.uiLanguage = payload.ui_language; // jshint ignore:line
    this.uiAttributes = payload.ui_attributes; // jshint ignore:line
    this.uiVersion = payload.ui_version; // jshint ignore:line
    this.serviceVersion = payload.service_version; // jshint ignore:line
    this.callRecordingEnabled = payload.call_recording_enabled; // jshint ignore:line
    this.callRecordingWebhookUrl = payload.call_recording_webhook_url; // jshint ignore:line
    this.crmEnabled = payload.crm_enabled; // jshint ignore:line
    this.crmType = payload.crm_type; // jshint ignore:line
    this.crmCallbackUrl = payload.crm_callback_url; // jshint ignore:line
    this.crmFallbackUrl = payload.crm_fallback_url; // jshint ignore:line
    this.crmAttributes = payload.crm_attributes; // jshint ignore:line
    this.publicAttributes = payload.public_attributes; // jshint ignore:line
    this.url = payload.url; // jshint ignore:line
  
    // Context
    this._context = undefined;
    this._solution = {};
  };
  
  Object.defineProperty(ConfigurationInstance.prototype,
    '_proxy', {
    get: function() {
      if (!this._context) {
        this._context = new ConfigurationContext(this._version);
      }
  
      return this._context;
    }
  });
  
  /* jshint ignore:start */
  /**
   * fetch a ConfigurationInstance
   *
   * @param {object} [opts] - Options for request
   * @param {string} [opts.uiVersion] - Pinned UI version
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationInstance.prototype.fetch = function fetch(opts, callback) {
    return this._proxy.fetch(opts, callback);
  };
  
  /* jshint ignore:start */
  /**
   * create a ConfigurationInstance
   *
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationInstance.prototype.create = function create(callback) {
    return this._proxy.create(callback);
  };
  
  /* jshint ignore:start */
  /**
   * update a ConfigurationInstance
   *
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationInstance.prototype.update = function update(callback) {
    return this._proxy.update(callback);
  };
  
  /* jshint ignore:start */
  /**
   * Produce a plain JSON object version of the ConfigurationInstance for serialization.
   * Removes any circular references in the object.
   *
   * @returns Object
   */
  /* jshint ignore:end */
  ConfigurationInstance.prototype.toJSON = function toJSON() {
    let clone = {};
    _.forOwn(this, function(value, key) {
      if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
        clone[key] = value;
      }
    });
    return clone;
  };
  
  
  /* jshint ignore:start */
  /**
   * Initialize the ConfigurationContext
   *
   * @param {V1} version - Version of the resource
   */
  /* jshint ignore:end */
  ConfigurationContext = function ConfigurationContext(version) {
    this._version = version;
  
    // Path Solution
    this._solution = {};
    this._uri = _.template(
      '/Configuration' // jshint ignore:line
    )(this._solution);
  };
  
  /* jshint ignore:start */
  /**
   * fetch a ConfigurationInstance
   *
   * @param {object} [opts] - Options for request
   * @param {string} [opts.uiVersion] - Pinned UI version
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationContext.prototype.fetch = function fetch(opts, callback) {
    if (_.isFunction(opts)) {
      callback = opts;
      opts = {};
    }
    opts = opts || {};
  
    var deferred = Q.defer();
    var data = values.of({'UiVersion': _.get(opts, 'uiVersion')});
  
    var promise = this._version.fetch({uri: this._uri, method: 'GET', params: data});
  
    promise = promise.then(function(payload) {
      deferred.resolve(new ConfigurationInstance(this._version, payload));
    }.bind(this));
  
    promise.catch(function(error) {
      deferred.reject(error);
    });
  
    if (_.isFunction(callback)) {
      deferred.promise.nodeify(callback);
    }
  
    return deferred.promise;
  };
  
  /* jshint ignore:start */
  /**
   * create a ConfigurationInstance
   *
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationContext.prototype.create = function create(callback) {
    var deferred = Q.defer();
    var data = values.of({});
  
    var promise = this._version.create({uri: this._uri, method: 'POST'});
  
    promise = promise.then(function(payload) {
      deferred.resolve(new ConfigurationInstance(this._version, payload));
    }.bind(this));
  
    promise.catch(function(error) {
      deferred.reject(error);
    });
  
    if (_.isFunction(callback)) {
      deferred.promise.nodeify(callback);
    }
  
    return deferred.promise;
  };
  
  /* jshint ignore:start */
  /**
   * update a ConfigurationInstance
   *
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed ConfigurationInstance
   */
  /* jshint ignore:end */
  ConfigurationContext.prototype.update = function update(callback) {
    var deferred = Q.defer();
    var data = values.of({});
  
    var promise = this._version.update({uri: this._uri, method: 'POST'});
  
    promise = promise.then(function(payload) {
      deferred.resolve(new ConfigurationInstance(this._version, payload));
    }.bind(this));
  
    promise.catch(function(error) {
      deferred.reject(error);
    });
  
    if (_.isFunction(callback)) {
      deferred.promise.nodeify(callback);
    }
  
    return deferred.promise;
  };
  
  module.exports = {
    ConfigurationList: ConfigurationList,
    ConfigurationPage: ConfigurationPage,
    ConfigurationInstance: ConfigurationInstance,
    ConfigurationContext: ConfigurationContext
  };
  