<?php
namespace Airavata\Model\AppCatalog\Parser;

/**
 * Autogenerated by Thrift Compiler (0.10.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;


final class IOType {
  const FILE = 0;
  const PROPERTY = 1;
  static public $__names = array(
    0 => 'FILE',
    1 => 'PROPERTY',
  );
}

class ParserInput {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var bool
   */
  public $requiredInput = null;
  /**
   * @var string
   */
  public $parserId = null;
  /**
   * @var int
   */
  public $type = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'requiredInput',
          'type' => TType::BOOL,
          ),
        4 => array(
          'var' => 'parserId',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['requiredInput'])) {
        $this->requiredInput = $vals['requiredInput'];
      }
      if (isset($vals['parserId'])) {
        $this->parserId = $vals['parserId'];
      }
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
    }
  }

  public function getName() {
    return 'ParserInput';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->requiredInput);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parserId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ParserInput');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->requiredInput !== null) {
      $xfer += $output->writeFieldBegin('requiredInput', TType::BOOL, 3);
      $xfer += $output->writeBool($this->requiredInput);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parserId !== null) {
      $xfer += $output->writeFieldBegin('parserId', TType::STRING, 4);
      $xfer += $output->writeString($this->parserId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 5);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ParserOutput {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var bool
   */
  public $requiredOutput = null;
  /**
   * @var string
   */
  public $parserId = null;
  /**
   * @var int
   */
  public $type = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'requiredOutput',
          'type' => TType::BOOL,
          ),
        4 => array(
          'var' => 'parserId',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['requiredOutput'])) {
        $this->requiredOutput = $vals['requiredOutput'];
      }
      if (isset($vals['parserId'])) {
        $this->parserId = $vals['parserId'];
      }
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
    }
  }

  public function getName() {
    return 'ParserOutput';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->requiredOutput);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parserId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ParserOutput');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->requiredOutput !== null) {
      $xfer += $output->writeFieldBegin('requiredOutput', TType::BOOL, 3);
      $xfer += $output->writeBool($this->requiredOutput);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parserId !== null) {
      $xfer += $output->writeFieldBegin('parserId', TType::STRING, 4);
      $xfer += $output->writeString($this->parserId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 5);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Parser {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $imageName = null;
  /**
   * @var string
   */
  public $outputDirPath = null;
  /**
   * @var string
   */
  public $inputDirPath = null;
  /**
   * @var string
   */
  public $executionCommand = null;
  /**
   * @var \Airavata\Model\AppCatalog\Parser\ParserInput[]
   */
  public $inputFiles = null;
  /**
   * @var \Airavata\Model\AppCatalog\Parser\ParserOutput[]
   */
  public $outputFiles = null;
  /**
   * @var string
   */
  public $gatewayId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'imageName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'outputDirPath',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'inputDirPath',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'executionCommand',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'inputFiles',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\Parser\ParserInput',
            ),
          ),
        7 => array(
          'var' => 'outputFiles',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\Parser\ParserOutput',
            ),
          ),
        8 => array(
          'var' => 'gatewayId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['imageName'])) {
        $this->imageName = $vals['imageName'];
      }
      if (isset($vals['outputDirPath'])) {
        $this->outputDirPath = $vals['outputDirPath'];
      }
      if (isset($vals['inputDirPath'])) {
        $this->inputDirPath = $vals['inputDirPath'];
      }
      if (isset($vals['executionCommand'])) {
        $this->executionCommand = $vals['executionCommand'];
      }
      if (isset($vals['inputFiles'])) {
        $this->inputFiles = $vals['inputFiles'];
      }
      if (isset($vals['outputFiles'])) {
        $this->outputFiles = $vals['outputFiles'];
      }
      if (isset($vals['gatewayId'])) {
        $this->gatewayId = $vals['gatewayId'];
      }
    }
  }

  public function getName() {
    return 'Parser';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->imageName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->outputDirPath);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->inputDirPath);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->executionCommand);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::LST) {
            $this->inputFiles = array();
            $_size0 = 0;
            $_etype3 = 0;
            $xfer += $input->readListBegin($_etype3, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $elem5 = null;
              $elem5 = new \Airavata\Model\AppCatalog\Parser\ParserInput();
              $xfer += $elem5->read($input);
              $this->inputFiles []= $elem5;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::LST) {
            $this->outputFiles = array();
            $_size6 = 0;
            $_etype9 = 0;
            $xfer += $input->readListBegin($_etype9, $_size6);
            for ($_i10 = 0; $_i10 < $_size6; ++$_i10)
            {
              $elem11 = null;
              $elem11 = new \Airavata\Model\AppCatalog\Parser\ParserOutput();
              $xfer += $elem11->read($input);
              $this->outputFiles []= $elem11;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->gatewayId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('Parser');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->imageName !== null) {
      $xfer += $output->writeFieldBegin('imageName', TType::STRING, 2);
      $xfer += $output->writeString($this->imageName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->outputDirPath !== null) {
      $xfer += $output->writeFieldBegin('outputDirPath', TType::STRING, 3);
      $xfer += $output->writeString($this->outputDirPath);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->inputDirPath !== null) {
      $xfer += $output->writeFieldBegin('inputDirPath', TType::STRING, 4);
      $xfer += $output->writeString($this->inputDirPath);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->executionCommand !== null) {
      $xfer += $output->writeFieldBegin('executionCommand', TType::STRING, 5);
      $xfer += $output->writeString($this->executionCommand);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->inputFiles !== null) {
      if (!is_array($this->inputFiles)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('inputFiles', TType::LST, 6);
      {
        $output->writeListBegin(TType::STRUCT, count($this->inputFiles));
        {
          foreach ($this->inputFiles as $iter12)
          {
            $xfer += $iter12->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->outputFiles !== null) {
      if (!is_array($this->outputFiles)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('outputFiles', TType::LST, 7);
      {
        $output->writeListBegin(TType::STRUCT, count($this->outputFiles));
        {
          foreach ($this->outputFiles as $iter13)
          {
            $xfer += $iter13->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->gatewayId !== null) {
      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 8);
      $xfer += $output->writeString($this->gatewayId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ParserConnectorInput {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $inputId = null;
  /**
   * @var string
   */
  public $parentOutputId = null;
  /**
   * @var string
   */
  public $value = null;
  /**
   * @var string
   */
  public $parserConnectorId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'inputId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'parentOutputId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'value',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'parserConnectorId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['inputId'])) {
        $this->inputId = $vals['inputId'];
      }
      if (isset($vals['parentOutputId'])) {
        $this->parentOutputId = $vals['parentOutputId'];
      }
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
      if (isset($vals['parserConnectorId'])) {
        $this->parserConnectorId = $vals['parserConnectorId'];
      }
    }
  }

  public function getName() {
    return 'ParserConnectorInput';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->inputId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentOutputId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parserConnectorId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ParserConnectorInput');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->inputId !== null) {
      $xfer += $output->writeFieldBegin('inputId', TType::STRING, 2);
      $xfer += $output->writeString($this->inputId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parentOutputId !== null) {
      $xfer += $output->writeFieldBegin('parentOutputId', TType::STRING, 3);
      $xfer += $output->writeString($this->parentOutputId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::STRING, 4);
      $xfer += $output->writeString($this->value);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parserConnectorId !== null) {
      $xfer += $output->writeFieldBegin('parserConnectorId', TType::STRING, 5);
      $xfer += $output->writeString($this->parserConnectorId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ParserConnector {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $parentParserId = null;
  /**
   * @var string
   */
  public $childParserId = null;
  /**
   * @var \Airavata\Model\AppCatalog\Parser\ParserConnectorInput[]
   */
  public $connectorInputs = null;
  /**
   * @var string
   */
  public $parsingTemplateId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'parentParserId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'childParserId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'connectorInputs',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\Parser\ParserConnectorInput',
            ),
          ),
        5 => array(
          'var' => 'parsingTemplateId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['parentParserId'])) {
        $this->parentParserId = $vals['parentParserId'];
      }
      if (isset($vals['childParserId'])) {
        $this->childParserId = $vals['childParserId'];
      }
      if (isset($vals['connectorInputs'])) {
        $this->connectorInputs = $vals['connectorInputs'];
      }
      if (isset($vals['parsingTemplateId'])) {
        $this->parsingTemplateId = $vals['parsingTemplateId'];
      }
    }
  }

  public function getName() {
    return 'ParserConnector';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentParserId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->childParserId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->connectorInputs = array();
            $_size14 = 0;
            $_etype17 = 0;
            $xfer += $input->readListBegin($_etype17, $_size14);
            for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
            {
              $elem19 = null;
              $elem19 = new \Airavata\Model\AppCatalog\Parser\ParserConnectorInput();
              $xfer += $elem19->read($input);
              $this->connectorInputs []= $elem19;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parsingTemplateId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ParserConnector');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parentParserId !== null) {
      $xfer += $output->writeFieldBegin('parentParserId', TType::STRING, 2);
      $xfer += $output->writeString($this->parentParserId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->childParserId !== null) {
      $xfer += $output->writeFieldBegin('childParserId', TType::STRING, 3);
      $xfer += $output->writeString($this->childParserId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->connectorInputs !== null) {
      if (!is_array($this->connectorInputs)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('connectorInputs', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRUCT, count($this->connectorInputs));
        {
          foreach ($this->connectorInputs as $iter20)
          {
            $xfer += $iter20->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parsingTemplateId !== null) {
      $xfer += $output->writeFieldBegin('parsingTemplateId', TType::STRING, 5);
      $xfer += $output->writeString($this->parsingTemplateId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ParsingTemplateInput {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $targetInputId = null;
  /**
   * @var string
   */
  public $applicationOutputName = null;
  /**
   * @var string
   */
  public $value = null;
  /**
   * @var string
   */
  public $parsingTemplateId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'targetInputId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'applicationOutputName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'value',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'parsingTemplateId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['targetInputId'])) {
        $this->targetInputId = $vals['targetInputId'];
      }
      if (isset($vals['applicationOutputName'])) {
        $this->applicationOutputName = $vals['applicationOutputName'];
      }
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
      if (isset($vals['parsingTemplateId'])) {
        $this->parsingTemplateId = $vals['parsingTemplateId'];
      }
    }
  }

  public function getName() {
    return 'ParsingTemplateInput';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->targetInputId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->applicationOutputName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parsingTemplateId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ParsingTemplateInput');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->targetInputId !== null) {
      $xfer += $output->writeFieldBegin('targetInputId', TType::STRING, 2);
      $xfer += $output->writeString($this->targetInputId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->applicationOutputName !== null) {
      $xfer += $output->writeFieldBegin('applicationOutputName', TType::STRING, 3);
      $xfer += $output->writeString($this->applicationOutputName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::STRING, 4);
      $xfer += $output->writeString($this->value);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parsingTemplateId !== null) {
      $xfer += $output->writeFieldBegin('parsingTemplateId', TType::STRING, 5);
      $xfer += $output->writeString($this->parsingTemplateId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ParsingTemplate {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $applicationInterface = null;
  /**
   * @var \Airavata\Model\AppCatalog\Parser\ParsingTemplateInput[]
   */
  public $initialInputs = null;
  /**
   * @var \Airavata\Model\AppCatalog\Parser\ParserConnector[]
   */
  public $parserConnections = null;
  /**
   * @var string
   */
  public $gatewayId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'applicationInterface',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'initialInputs',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\Parser\ParsingTemplateInput',
            ),
          ),
        4 => array(
          'var' => 'parserConnections',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\AppCatalog\Parser\ParserConnector',
            ),
          ),
        5 => array(
          'var' => 'gatewayId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['applicationInterface'])) {
        $this->applicationInterface = $vals['applicationInterface'];
      }
      if (isset($vals['initialInputs'])) {
        $this->initialInputs = $vals['initialInputs'];
      }
      if (isset($vals['parserConnections'])) {
        $this->parserConnections = $vals['parserConnections'];
      }
      if (isset($vals['gatewayId'])) {
        $this->gatewayId = $vals['gatewayId'];
      }
    }
  }

  public function getName() {
    return 'ParsingTemplate';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->applicationInterface);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->initialInputs = array();
            $_size21 = 0;
            $_etype24 = 0;
            $xfer += $input->readListBegin($_etype24, $_size21);
            for ($_i25 = 0; $_i25 < $_size21; ++$_i25)
            {
              $elem26 = null;
              $elem26 = new \Airavata\Model\AppCatalog\Parser\ParsingTemplateInput();
              $xfer += $elem26->read($input);
              $this->initialInputs []= $elem26;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->parserConnections = array();
            $_size27 = 0;
            $_etype30 = 0;
            $xfer += $input->readListBegin($_etype30, $_size27);
            for ($_i31 = 0; $_i31 < $_size27; ++$_i31)
            {
              $elem32 = null;
              $elem32 = new \Airavata\Model\AppCatalog\Parser\ParserConnector();
              $xfer += $elem32->read($input);
              $this->parserConnections []= $elem32;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->gatewayId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ParsingTemplate');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->applicationInterface !== null) {
      $xfer += $output->writeFieldBegin('applicationInterface', TType::STRING, 2);
      $xfer += $output->writeString($this->applicationInterface);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->initialInputs !== null) {
      if (!is_array($this->initialInputs)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('initialInputs', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRUCT, count($this->initialInputs));
        {
          foreach ($this->initialInputs as $iter33)
          {
            $xfer += $iter33->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parserConnections !== null) {
      if (!is_array($this->parserConnections)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parserConnections', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRUCT, count($this->parserConnections));
        {
          foreach ($this->parserConnections as $iter34)
          {
            $xfer += $iter34->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->gatewayId !== null) {
      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 5);
      $xfer += $output->writeString($this->gatewayId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}


