<?php
namespace Airavata\Model\Workflow;

/**
 * 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 ApplicationState {
  const CREATED = 0;
  const VALIDATED = 1;
  const SCHEDULED = 2;
  const LAUNCHED = 3;
  const EXECUTING = 4;
  const CANCELING = 5;
  const CANCELED = 6;
  const COMPLETED = 7;
  const FAILED = 8;
  static public $__names = array(
    0 => 'CREATED',
    1 => 'VALIDATED',
    2 => 'SCHEDULED',
    3 => 'LAUNCHED',
    4 => 'EXECUTING',
    5 => 'CANCELING',
    6 => 'CANCELED',
    7 => 'COMPLETED',
    8 => 'FAILED',
  );
}

final class ComponentType {
  const APPLICATION = 0;
  const HANDLER = 1;
  static public $__names = array(
    0 => 'APPLICATION',
    1 => 'HANDLER',
  );
}

final class HandlerType {
  const FLOW_STARTER = 0;
  const FLOW_TERMINATOR = 1;
  static public $__names = array(
    0 => 'FLOW_STARTER',
    1 => 'FLOW_TERMINATOR',
  );
}

final class HandlerState {
  const CREATED = 0;
  const VALIDATED = 1;
  const SCHEDULED = 2;
  const LAUNCHED = 3;
  const EXECUTING = 4;
  const CANCELING = 5;
  const CANCELED = 6;
  const COMPLETED = 7;
  const FAILED = 8;
  static public $__names = array(
    0 => 'CREATED',
    1 => 'VALIDATED',
    2 => 'SCHEDULED',
    3 => 'LAUNCHED',
    4 => 'EXECUTING',
    5 => 'CANCELING',
    6 => 'CANCELED',
    7 => 'COMPLETED',
    8 => 'FAILED',
  );
}

final class WorkflowState {
  const CREATED = 0;
  const VALIDATED = 1;
  const SCHEDULED = 2;
  const LAUNCHED = 3;
  const EXECUTING = 4;
  const PAUSING = 5;
  const PAUSED = 6;
  const RESTARTING = 7;
  const CANCELING = 8;
  const CANCELED = 9;
  const COMPLETED = 10;
  const FAILED = 11;
  static public $__names = array(
    0 => 'CREATED',
    1 => 'VALIDATED',
    2 => 'SCHEDULED',
    3 => 'LAUNCHED',
    4 => 'EXECUTING',
    5 => 'PAUSING',
    6 => 'PAUSED',
    7 => 'RESTARTING',
    8 => 'CANCELING',
    9 => 'CANCELED',
    10 => 'COMPLETED',
    11 => 'FAILED',
  );
}

class ApplicationStatus {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var int
   */
  public $state = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var int
   */
  public $updatedAt = null;

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

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

  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::I32) {
            $xfer += $input->readI32($this->state);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('ApplicationStatus');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::I32, 2);
      $xfer += $output->writeI32($this->state);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 3);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 4);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class WorkflowApplication {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $processId = null;
  /**
   * @var string
   */
  public $applicationInterfaceId = null;
  /**
   * @var string
   */
  public $computeResourceId = null;
  /**
   * @var string
   */
  public $queueName = null;
  /**
   * @var int
   */
  public $nodeCount = null;
  /**
   * @var int
   */
  public $coreCount = null;
  /**
   * @var int
   */
  public $wallTimeLimit = null;
  /**
   * @var int
   */
  public $physicalMemory = null;
  /**
   * @var \Airavata\Model\Workflow\ApplicationStatus[]
   */
  public $statuses = null;
  /**
   * @var \Airavata\Model\Commons\ErrorModel[]
   */
  public $errors = null;
  /**
   * @var int
   */
  public $createdAt = null;
  /**
   * @var int
   */
  public $updatedAt = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'processId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'applicationInterfaceId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'computeResourceId',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'queueName',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'nodeCount',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'coreCount',
          'type' => TType::I32,
          ),
        8 => array(
          'var' => 'wallTimeLimit',
          'type' => TType::I32,
          ),
        9 => array(
          'var' => 'physicalMemory',
          'type' => TType::I32,
          ),
        10 => array(
          'var' => 'statuses',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Workflow\ApplicationStatus',
            ),
          ),
        11 => array(
          'var' => 'errors',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Commons\ErrorModel',
            ),
          ),
        12 => array(
          'var' => 'createdAt',
          'type' => TType::I64,
          ),
        13 => array(
          'var' => 'updatedAt',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['processId'])) {
        $this->processId = $vals['processId'];
      }
      if (isset($vals['applicationInterfaceId'])) {
        $this->applicationInterfaceId = $vals['applicationInterfaceId'];
      }
      if (isset($vals['computeResourceId'])) {
        $this->computeResourceId = $vals['computeResourceId'];
      }
      if (isset($vals['queueName'])) {
        $this->queueName = $vals['queueName'];
      }
      if (isset($vals['nodeCount'])) {
        $this->nodeCount = $vals['nodeCount'];
      }
      if (isset($vals['coreCount'])) {
        $this->coreCount = $vals['coreCount'];
      }
      if (isset($vals['wallTimeLimit'])) {
        $this->wallTimeLimit = $vals['wallTimeLimit'];
      }
      if (isset($vals['physicalMemory'])) {
        $this->physicalMemory = $vals['physicalMemory'];
      }
      if (isset($vals['statuses'])) {
        $this->statuses = $vals['statuses'];
      }
      if (isset($vals['errors'])) {
        $this->errors = $vals['errors'];
      }
      if (isset($vals['createdAt'])) {
        $this->createdAt = $vals['createdAt'];
      }
      if (isset($vals['updatedAt'])) {
        $this->updatedAt = $vals['updatedAt'];
      }
    }
  }

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

  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->processId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->applicationInterfaceId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->computeResourceId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->queueName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->nodeCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->coreCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->wallTimeLimit);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->physicalMemory);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::LST) {
            $this->statuses = array();
            $_size0 = 0;
            $_etype3 = 0;
            $xfer += $input->readListBegin($_etype3, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $elem5 = null;
              $elem5 = new \Airavata\Model\Workflow\ApplicationStatus();
              $xfer += $elem5->read($input);
              $this->statuses []= $elem5;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::LST) {
            $this->errors = array();
            $_size6 = 0;
            $_etype9 = 0;
            $xfer += $input->readListBegin($_etype9, $_size6);
            for ($_i10 = 0; $_i10 < $_size6; ++$_i10)
            {
              $elem11 = null;
              $elem11 = new \Airavata\Model\Commons\ErrorModel();
              $xfer += $elem11->read($input);
              $this->errors []= $elem11;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdAt);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 13:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('WorkflowApplication');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->processId !== null) {
      $xfer += $output->writeFieldBegin('processId', TType::STRING, 2);
      $xfer += $output->writeString($this->processId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->applicationInterfaceId !== null) {
      $xfer += $output->writeFieldBegin('applicationInterfaceId', TType::STRING, 3);
      $xfer += $output->writeString($this->applicationInterfaceId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->computeResourceId !== null) {
      $xfer += $output->writeFieldBegin('computeResourceId', TType::STRING, 4);
      $xfer += $output->writeString($this->computeResourceId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->queueName !== null) {
      $xfer += $output->writeFieldBegin('queueName', TType::STRING, 5);
      $xfer += $output->writeString($this->queueName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nodeCount !== null) {
      $xfer += $output->writeFieldBegin('nodeCount', TType::I32, 6);
      $xfer += $output->writeI32($this->nodeCount);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->coreCount !== null) {
      $xfer += $output->writeFieldBegin('coreCount', TType::I32, 7);
      $xfer += $output->writeI32($this->coreCount);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->wallTimeLimit !== null) {
      $xfer += $output->writeFieldBegin('wallTimeLimit', TType::I32, 8);
      $xfer += $output->writeI32($this->wallTimeLimit);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->physicalMemory !== null) {
      $xfer += $output->writeFieldBegin('physicalMemory', TType::I32, 9);
      $xfer += $output->writeI32($this->physicalMemory);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->statuses !== null) {
      if (!is_array($this->statuses)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('statuses', TType::LST, 10);
      {
        $output->writeListBegin(TType::STRUCT, count($this->statuses));
        {
          foreach ($this->statuses as $iter12)
          {
            $xfer += $iter12->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errors !== null) {
      if (!is_array($this->errors)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('errors', TType::LST, 11);
      {
        $output->writeListBegin(TType::STRUCT, count($this->errors));
        {
          foreach ($this->errors as $iter13)
          {
            $xfer += $iter13->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdAt !== null) {
      $xfer += $output->writeFieldBegin('createdAt', TType::I64, 12);
      $xfer += $output->writeI64($this->createdAt);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 13);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DataBlock {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var string
   */
  public $value = null;
  /**
   * @var int
   */
  public $type = null;
  /**
   * @var int
   */
  public $createdAt = null;
  /**
   * @var int
   */
  public $updatedAt = null;

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

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

  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->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdAt);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('DataBlock');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::STRING, 2);
      $xfer += $output->writeString($this->value);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 3);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdAt !== null) {
      $xfer += $output->writeFieldBegin('createdAt', TType::I64, 4);
      $xfer += $output->writeI64($this->createdAt);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 5);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class WorkflowConnection {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var \Airavata\Model\Workflow\DataBlock
   */
  public $dataBlock = null;
  /**
   * @var int
   */
  public $fromType = null;
  /**
   * @var string
   */
  public $fromId = null;
  /**
   * @var string
   */
  public $fromOutputName = null;
  /**
   * @var int
   */
  public $toType = null;
  /**
   * @var string
   */
  public $toId = null;
  /**
   * @var string
   */
  public $toInputName = null;
  /**
   * @var int
   */
  public $createdAt = null;
  /**
   * @var int
   */
  public $updatedAt = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'dataBlock',
          'type' => TType::STRUCT,
          'class' => '\Airavata\Model\Workflow\DataBlock',
          ),
        3 => array(
          'var' => 'fromType',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'fromId',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'fromOutputName',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'toType',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'toId',
          'type' => TType::STRING,
          ),
        8 => array(
          'var' => 'toInputName',
          'type' => TType::STRING,
          ),
        9 => array(
          'var' => 'createdAt',
          'type' => TType::I64,
          ),
        10 => array(
          'var' => 'updatedAt',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['dataBlock'])) {
        $this->dataBlock = $vals['dataBlock'];
      }
      if (isset($vals['fromType'])) {
        $this->fromType = $vals['fromType'];
      }
      if (isset($vals['fromId'])) {
        $this->fromId = $vals['fromId'];
      }
      if (isset($vals['fromOutputName'])) {
        $this->fromOutputName = $vals['fromOutputName'];
      }
      if (isset($vals['toType'])) {
        $this->toType = $vals['toType'];
      }
      if (isset($vals['toId'])) {
        $this->toId = $vals['toId'];
      }
      if (isset($vals['toInputName'])) {
        $this->toInputName = $vals['toInputName'];
      }
      if (isset($vals['createdAt'])) {
        $this->createdAt = $vals['createdAt'];
      }
      if (isset($vals['updatedAt'])) {
        $this->updatedAt = $vals['updatedAt'];
      }
    }
  }

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

  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::STRUCT) {
            $this->dataBlock = new \Airavata\Model\Workflow\DataBlock();
            $xfer += $this->dataBlock->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->fromType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->fromId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->fromOutputName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->toType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->toId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->toInputName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdAt);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('WorkflowConnection');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dataBlock !== null) {
      if (!is_object($this->dataBlock)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('dataBlock', TType::STRUCT, 2);
      $xfer += $this->dataBlock->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->fromType !== null) {
      $xfer += $output->writeFieldBegin('fromType', TType::I32, 3);
      $xfer += $output->writeI32($this->fromType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->fromId !== null) {
      $xfer += $output->writeFieldBegin('fromId', TType::STRING, 4);
      $xfer += $output->writeString($this->fromId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->fromOutputName !== null) {
      $xfer += $output->writeFieldBegin('fromOutputName', TType::STRING, 5);
      $xfer += $output->writeString($this->fromOutputName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->toType !== null) {
      $xfer += $output->writeFieldBegin('toType', TType::I32, 6);
      $xfer += $output->writeI32($this->toType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->toId !== null) {
      $xfer += $output->writeFieldBegin('toId', TType::STRING, 7);
      $xfer += $output->writeString($this->toId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->toInputName !== null) {
      $xfer += $output->writeFieldBegin('toInputName', TType::STRING, 8);
      $xfer += $output->writeString($this->toInputName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdAt !== null) {
      $xfer += $output->writeFieldBegin('createdAt', TType::I64, 9);
      $xfer += $output->writeI64($this->createdAt);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 10);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class HandlerStatus {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var int
   */
  public $state = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var int
   */
  public $updatedAt = null;

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

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

  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::I32) {
            $xfer += $input->readI32($this->state);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('HandlerStatus');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::I32, 2);
      $xfer += $output->writeI32($this->state);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 3);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 4);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class WorkflowHandler {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var int
   */
  public $type = null;
  /**
   * @var \Airavata\Model\Application\Io\InputDataObjectType[]
   */
  public $inputs = null;
  /**
   * @var \Airavata\Model\Application\Io\OutputDataObjectType[]
   */
  public $outputs = null;
  /**
   * @var \Airavata\Model\Workflow\HandlerStatus[]
   */
  public $statuses = null;
  /**
   * @var \Airavata\Model\Commons\ErrorModel[]
   */
  public $errors = null;
  /**
   * @var int
   */
  public $createdAt = null;
  /**
   * @var int
   */
  public $updatedAt = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'inputs',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Application\Io\InputDataObjectType',
            ),
          ),
        4 => array(
          'var' => 'outputs',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Application\Io\OutputDataObjectType',
            ),
          ),
        5 => array(
          'var' => 'statuses',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Workflow\HandlerStatus',
            ),
          ),
        6 => array(
          'var' => 'errors',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Commons\ErrorModel',
            ),
          ),
        7 => array(
          'var' => 'createdAt',
          'type' => TType::I64,
          ),
        8 => array(
          'var' => 'updatedAt',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
      if (isset($vals['inputs'])) {
        $this->inputs = $vals['inputs'];
      }
      if (isset($vals['outputs'])) {
        $this->outputs = $vals['outputs'];
      }
      if (isset($vals['statuses'])) {
        $this->statuses = $vals['statuses'];
      }
      if (isset($vals['errors'])) {
        $this->errors = $vals['errors'];
      }
      if (isset($vals['createdAt'])) {
        $this->createdAt = $vals['createdAt'];
      }
      if (isset($vals['updatedAt'])) {
        $this->updatedAt = $vals['updatedAt'];
      }
    }
  }

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

  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::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->inputs = array();
            $_size14 = 0;
            $_etype17 = 0;
            $xfer += $input->readListBegin($_etype17, $_size14);
            for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
            {
              $elem19 = null;
              $elem19 = new \Airavata\Model\Application\Io\InputDataObjectType();
              $xfer += $elem19->read($input);
              $this->inputs []= $elem19;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->outputs = array();
            $_size20 = 0;
            $_etype23 = 0;
            $xfer += $input->readListBegin($_etype23, $_size20);
            for ($_i24 = 0; $_i24 < $_size20; ++$_i24)
            {
              $elem25 = null;
              $elem25 = new \Airavata\Model\Application\Io\OutputDataObjectType();
              $xfer += $elem25->read($input);
              $this->outputs []= $elem25;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::LST) {
            $this->statuses = array();
            $_size26 = 0;
            $_etype29 = 0;
            $xfer += $input->readListBegin($_etype29, $_size26);
            for ($_i30 = 0; $_i30 < $_size26; ++$_i30)
            {
              $elem31 = null;
              $elem31 = new \Airavata\Model\Workflow\HandlerStatus();
              $xfer += $elem31->read($input);
              $this->statuses []= $elem31;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::LST) {
            $this->errors = array();
            $_size32 = 0;
            $_etype35 = 0;
            $xfer += $input->readListBegin($_etype35, $_size32);
            for ($_i36 = 0; $_i36 < $_size32; ++$_i36)
            {
              $elem37 = null;
              $elem37 = new \Airavata\Model\Commons\ErrorModel();
              $xfer += $elem37->read($input);
              $this->errors []= $elem37;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdAt);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('WorkflowHandler');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 2);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->inputs !== null) {
      if (!is_array($this->inputs)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('inputs', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRUCT, count($this->inputs));
        {
          foreach ($this->inputs as $iter38)
          {
            $xfer += $iter38->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->outputs !== null) {
      if (!is_array($this->outputs)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('outputs', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRUCT, count($this->outputs));
        {
          foreach ($this->outputs as $iter39)
          {
            $xfer += $iter39->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->statuses !== null) {
      if (!is_array($this->statuses)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('statuses', TType::LST, 5);
      {
        $output->writeListBegin(TType::STRUCT, count($this->statuses));
        {
          foreach ($this->statuses as $iter40)
          {
            $xfer += $iter40->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errors !== null) {
      if (!is_array($this->errors)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('errors', TType::LST, 6);
      {
        $output->writeListBegin(TType::STRUCT, count($this->errors));
        {
          foreach ($this->errors as $iter41)
          {
            $xfer += $iter41->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdAt !== null) {
      $xfer += $output->writeFieldBegin('createdAt', TType::I64, 7);
      $xfer += $output->writeI64($this->createdAt);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 8);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class WorkflowStatus {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = null;
  /**
   * @var int
   */
  public $state = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var int
   */
  public $updatedAt = null;

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

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

  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::I32) {
            $xfer += $input->readI32($this->state);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('WorkflowStatus');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::I32, 2);
      $xfer += $output->writeI32($this->state);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 3);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 4);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AiravataWorkflow {
  static $_TSPEC;

  /**
   * @var string
   */
  public $id = "DO_NOT_SET_AT_CLIENTS";
  /**
   * @var string
   */
  public $experimentId = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var \Airavata\Model\Workflow\WorkflowApplication[]
   */
  public $applications = null;
  /**
   * @var \Airavata\Model\Workflow\WorkflowHandler[]
   */
  public $handlers = null;
  /**
   * @var \Airavata\Model\Workflow\WorkflowConnection[]
   */
  public $connections = null;
  /**
   * @var \Airavata\Model\Workflow\WorkflowStatus[]
   */
  public $statuses = null;
  /**
   * @var \Airavata\Model\Commons\ErrorModel[]
   */
  public $errors = null;
  /**
   * @var int
   */
  public $createdAt = null;
  /**
   * @var int
   */
  public $updatedAt = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'experimentId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'applications',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Workflow\WorkflowApplication',
            ),
          ),
        5 => array(
          'var' => 'handlers',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Workflow\WorkflowHandler',
            ),
          ),
        6 => array(
          'var' => 'connections',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Workflow\WorkflowConnection',
            ),
          ),
        7 => array(
          'var' => 'statuses',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Workflow\WorkflowStatus',
            ),
          ),
        8 => array(
          'var' => 'errors',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Commons\ErrorModel',
            ),
          ),
        9 => array(
          'var' => 'createdAt',
          'type' => TType::I64,
          ),
        10 => array(
          'var' => 'updatedAt',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['experimentId'])) {
        $this->experimentId = $vals['experimentId'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['applications'])) {
        $this->applications = $vals['applications'];
      }
      if (isset($vals['handlers'])) {
        $this->handlers = $vals['handlers'];
      }
      if (isset($vals['connections'])) {
        $this->connections = $vals['connections'];
      }
      if (isset($vals['statuses'])) {
        $this->statuses = $vals['statuses'];
      }
      if (isset($vals['errors'])) {
        $this->errors = $vals['errors'];
      }
      if (isset($vals['createdAt'])) {
        $this->createdAt = $vals['createdAt'];
      }
      if (isset($vals['updatedAt'])) {
        $this->updatedAt = $vals['updatedAt'];
      }
    }
  }

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

  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->experimentId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->applications = array();
            $_size42 = 0;
            $_etype45 = 0;
            $xfer += $input->readListBegin($_etype45, $_size42);
            for ($_i46 = 0; $_i46 < $_size42; ++$_i46)
            {
              $elem47 = null;
              $elem47 = new \Airavata\Model\Workflow\WorkflowApplication();
              $xfer += $elem47->read($input);
              $this->applications []= $elem47;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::LST) {
            $this->handlers = array();
            $_size48 = 0;
            $_etype51 = 0;
            $xfer += $input->readListBegin($_etype51, $_size48);
            for ($_i52 = 0; $_i52 < $_size48; ++$_i52)
            {
              $elem53 = null;
              $elem53 = new \Airavata\Model\Workflow\WorkflowHandler();
              $xfer += $elem53->read($input);
              $this->handlers []= $elem53;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::LST) {
            $this->connections = array();
            $_size54 = 0;
            $_etype57 = 0;
            $xfer += $input->readListBegin($_etype57, $_size54);
            for ($_i58 = 0; $_i58 < $_size54; ++$_i58)
            {
              $elem59 = null;
              $elem59 = new \Airavata\Model\Workflow\WorkflowConnection();
              $xfer += $elem59->read($input);
              $this->connections []= $elem59;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::LST) {
            $this->statuses = array();
            $_size60 = 0;
            $_etype63 = 0;
            $xfer += $input->readListBegin($_etype63, $_size60);
            for ($_i64 = 0; $_i64 < $_size60; ++$_i64)
            {
              $elem65 = null;
              $elem65 = new \Airavata\Model\Workflow\WorkflowStatus();
              $xfer += $elem65->read($input);
              $this->statuses []= $elem65;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::LST) {
            $this->errors = array();
            $_size66 = 0;
            $_etype69 = 0;
            $xfer += $input->readListBegin($_etype69, $_size66);
            for ($_i70 = 0; $_i70 < $_size66; ++$_i70)
            {
              $elem71 = null;
              $elem71 = new \Airavata\Model\Commons\ErrorModel();
              $xfer += $elem71->read($input);
              $this->errors []= $elem71;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdAt);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedAt);
          } 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('AiravataWorkflow');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::STRING, 1);
      $xfer += $output->writeString($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->experimentId !== null) {
      $xfer += $output->writeFieldBegin('experimentId', TType::STRING, 2);
      $xfer += $output->writeString($this->experimentId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 3);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->applications !== null) {
      if (!is_array($this->applications)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('applications', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRUCT, count($this->applications));
        {
          foreach ($this->applications as $iter72)
          {
            $xfer += $iter72->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->handlers !== null) {
      if (!is_array($this->handlers)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('handlers', TType::LST, 5);
      {
        $output->writeListBegin(TType::STRUCT, count($this->handlers));
        {
          foreach ($this->handlers as $iter73)
          {
            $xfer += $iter73->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->connections !== null) {
      if (!is_array($this->connections)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('connections', TType::LST, 6);
      {
        $output->writeListBegin(TType::STRUCT, count($this->connections));
        {
          foreach ($this->connections as $iter74)
          {
            $xfer += $iter74->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->statuses !== null) {
      if (!is_array($this->statuses)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('statuses', TType::LST, 7);
      {
        $output->writeListBegin(TType::STRUCT, count($this->statuses));
        {
          foreach ($this->statuses as $iter75)
          {
            $xfer += $iter75->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errors !== null) {
      if (!is_array($this->errors)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('errors', TType::LST, 8);
      {
        $output->writeListBegin(TType::STRUCT, count($this->errors));
        {
          foreach ($this->errors as $iter76)
          {
            $xfer += $iter76->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdAt !== null) {
      $xfer += $output->writeFieldBegin('createdAt', TType::I64, 9);
      $xfer += $output->writeI64($this->createdAt);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedAt !== null) {
      $xfer += $output->writeFieldBegin('updatedAt', TType::I64, 10);
      $xfer += $output->writeI64($this->updatedAt);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}


