// Copyright 2016, University of Colorado Boulder

/**
 * IO type for Vector2
 *
 * @author Sam Reid (PhET Interactive Simulations)
 * @author Andrew Adare (PhET Interactive Simulations)
 */
define( function( require ) {
  'use strict';

  // modules
  var dot = require( 'DOT/dot' );
  var ObjectIO = require( 'TANDEM/types/ObjectIO' );
  var phetioInherit = require( 'TANDEM/phetioInherit' );
  var Vector2 = require( 'DOT/Vector2' );

  // ifphetio
  var assertInstanceOf = require( 'ifphetio!PHET_IO/assertInstanceOf' );

  /**
   * @param {Vector2} vector2
   * @param {string} phetioID
   * @constructor
   */
  function Vector2IO( vector2, phetioID ) {
    assert && assertInstanceOf( vector2, Vector2 );
    ObjectIO.call( this, vector2, phetioID );
  }

  phetioInherit( ObjectIO, 'Vector2IO', Vector2IO, {}, {
    documentation: 'A numerical object with x and y properties, like {x:3,y:4}',

    /**
     * @override
     * @public
     * @param {*} instance
     * @returns {boolean}
     */
    isInstance: function( instance ) { return instance instanceof Vector2; },


    /**
     * Encodes a Vector2 instance to a state.
     * @param {Vector2} vector2
     * @returns {Object}
     */
    toStateObject: function( vector2 ) {
      assert && assertInstanceOf( vector2, Vector2 );
      return vector2.toStateObject();
    },

    /**
     * Decodes a state into a Vector2.
     * @param {Object} stateObject
     * @returns {Vector2}
     */
    fromStateObject: function( stateObject ) {
      return Vector2.fromStateObject( stateObject );
    }
  } );

  dot.register( 'Vector2IO', Vector2IO );

  return Vector2IO;
} );
@@ -945,136 +945,45 @@
    *
- @param %7B*%7D instance%0A     * @returns %7Bboolean%7D%0A     */%0A    isInstance: function( instance ) %7B return instance instanceof
+/%0A    validator: %7B valueType:
  Vector2
 ; %7D,
@@ -978,17 +978,16 @@
  Vector2
-;
  %7D,%0A%0A%0A  

use EmitterIO for validators in instrumented Emitters, https://github.com/phetsims/axon/issues/204