Source: node_modules/kurento-client-elements/lib/complexTypes/DtlsConnection.js

/* Autogenerated with Kurento Idl */

/*
 * (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
 *
 * 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 inherits = require('inherits');

var kurentoClient = require('kurento-client');

var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;

var ComplexType = require('kurento-client-core').complexTypes.ComplexType;


/**
 * The DTLS connection state for a certain stream and component.
 *
 * @constructor module:elements/complexTypes.DtlsConnection
 *
 * @property {external:String} streamId
 *  The ID of the stream
 * @property {external:String} componentId
 *  The ID of the component
 * @property {external:String} connectionId
 *  The ID of the underlying DTLS connection
 * @property {module:elements/complexTypes.DtlsConnectionState} state
 *  The state of the component
 */
function DtlsConnection(dtlsConnectionDict){
  if(!(this instanceof DtlsConnection))
    return new DtlsConnection(dtlsConnectionDict)

  dtlsConnectionDict = dtlsConnectionDict || {}

  // Check dtlsConnectionDict has the required fields
  // 
  // checkType('String', 'dtlsConnectionDict.streamId', dtlsConnectionDict.streamId, {required: true});
  //  
  // checkType('String', 'dtlsConnectionDict.componentId', dtlsConnectionDict.componentId, {required: true});
  //  
  // checkType('String', 'dtlsConnectionDict.connectionId', dtlsConnectionDict.connectionId, {required: true});
  //  
  // checkType('DtlsConnectionState', 'dtlsConnectionDict.state', dtlsConnectionDict.state, {required: true});
  //  

  // Init parent class
  DtlsConnection.super_.call(this, dtlsConnectionDict)

  // Set object properties
  Object.defineProperties(this, {
    streamId: {
      writable: true,
      enumerable: true,
      value: dtlsConnectionDict.streamId
    },
    componentId: {
      writable: true,
      enumerable: true,
      value: dtlsConnectionDict.componentId
    },
    connectionId: {
      writable: true,
      enumerable: true,
      value: dtlsConnectionDict.connectionId
    },
    state: {
      writable: true,
      enumerable: true,
      value: dtlsConnectionDict.state
    }
  })
}
inherits(DtlsConnection, ComplexType)

// Private identifiers to allow re-construction of the complexType on the server
// They need to be enumerable so JSON.stringify() can access to them
Object.defineProperties(DtlsConnection.prototype, {
  __module__: {
    enumerable: true,
    value: "kurento"
  },
  __type__: {
    enumerable: true,
    value: "DtlsConnection"
  }
})

/**
 * Checker for {@link module:elements/complexTypes.DtlsConnection}
 *
 * @memberof module:elements/complexTypes
 *
 * @param {external:String} key
 * @param {module:elements/complexTypes.DtlsConnection} value
 */
function checkDtlsConnection(key, value)
{
  if(!(value instanceof DtlsConnection))
    throw ChecktypeError(key, DtlsConnection, value);
};


module.exports = DtlsConnection;

DtlsConnection.check = checkDtlsConnection;