<?php
/**
 * Autogenerated by Thrift Compiler (0.16.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;

class TProgressUpdateResp
{
    static public $isValidate = false;

    static public $_TSPEC = array(
        1 => array(
            'var' => 'headerNames',
            'isRequired' => true,
            'type' => TType::LST,
            'etype' => TType::STRING,
            'elem' => array(
                'type' => TType::STRING,
                ),
        ),
        2 => array(
            'var' => 'rows',
            'isRequired' => true,
            'type' => TType::LST,
            'etype' => TType::LST,
            'elem' => array(
                'type' => TType::LST,
                'etype' => TType::STRING,
                'elem' => array(
                    'type' => TType::STRING,
                    ),
                ),
        ),
        3 => array(
            'var' => 'progressedPercentage',
            'isRequired' => true,
            'type' => TType::DOUBLE,
        ),
        4 => array(
            'var' => 'status',
            'isRequired' => true,
            'type' => TType::I32,
            'class' => '\TJobExecutionStatus',
        ),
        5 => array(
            'var' => 'footerSummary',
            'isRequired' => true,
            'type' => TType::STRING,
        ),
        6 => array(
            'var' => 'startTime',
            'isRequired' => true,
            'type' => TType::I64,
        ),
    );

    /**
     * @var string[]
     */
    public $headerNames = null;
    /**
     * @var (string[])[]
     */
    public $rows = null;
    /**
     * @var double
     */
    public $progressedPercentage = null;
    /**
     * @var int
     */
    public $status = null;
    /**
     * @var string
     */
    public $footerSummary = null;
    /**
     * @var int
     */
    public $startTime = null;

    public function __construct($vals = null)
    {
        if (is_array($vals)) {
            if (isset($vals['headerNames'])) {
                $this->headerNames = $vals['headerNames'];
            }
            if (isset($vals['rows'])) {
                $this->rows = $vals['rows'];
            }
            if (isset($vals['progressedPercentage'])) {
                $this->progressedPercentage = $vals['progressedPercentage'];
            }
            if (isset($vals['status'])) {
                $this->status = $vals['status'];
            }
            if (isset($vals['footerSummary'])) {
                $this->footerSummary = $vals['footerSummary'];
            }
            if (isset($vals['startTime'])) {
                $this->startTime = $vals['startTime'];
            }
        }
    }

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


    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::LST) {
                        $this->headerNames = array();
                        $_size177 = 0;
                        $_etype180 = 0;
                        $xfer += $input->readListBegin($_etype180, $_size177);
                        for ($_i181 = 0; $_i181 < $_size177; ++$_i181) {
                            $elem182 = null;
                            $xfer += $input->readString($elem182);
                            $this->headerNames []= $elem182;
                        }
                        $xfer += $input->readListEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 2:
                    if ($ftype == TType::LST) {
                        $this->rows = array();
                        $_size183 = 0;
                        $_etype186 = 0;
                        $xfer += $input->readListBegin($_etype186, $_size183);
                        for ($_i187 = 0; $_i187 < $_size183; ++$_i187) {
                            $elem188 = null;
                            $elem188 = array();
                            $_size189 = 0;
                            $_etype192 = 0;
                            $xfer += $input->readListBegin($_etype192, $_size189);
                            for ($_i193 = 0; $_i193 < $_size189; ++$_i193) {
                                $elem194 = null;
                                $xfer += $input->readString($elem194);
                                $elem188 []= $elem194;
                            }
                            $xfer += $input->readListEnd();
                            $this->rows []= $elem188;
                        }
                        $xfer += $input->readListEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 3:
                    if ($ftype == TType::DOUBLE) {
                        $xfer += $input->readDouble($this->progressedPercentage);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 4:
                    if ($ftype == TType::I32) {
                        $xfer += $input->readI32($this->status);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 5:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->footerSummary);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 6:
                    if ($ftype == TType::I64) {
                        $xfer += $input->readI64($this->startTime);
                    } 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('TProgressUpdateResp');
        if ($this->headerNames !== null) {
            if (!is_array($this->headerNames)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('headerNames', TType::LST, 1);
            $output->writeListBegin(TType::STRING, count($this->headerNames));
            foreach ($this->headerNames as $iter195) {
                $xfer += $output->writeString($iter195);
            }
            $output->writeListEnd();
            $xfer += $output->writeFieldEnd();
        }
        if ($this->rows !== null) {
            if (!is_array($this->rows)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('rows', TType::LST, 2);
            $output->writeListBegin(TType::LST, count($this->rows));
            foreach ($this->rows as $iter196) {
                $output->writeListBegin(TType::STRING, count($iter196));
                foreach ($iter196 as $iter197) {
                    $xfer += $output->writeString($iter197);
                }
                $output->writeListEnd();
            }
            $output->writeListEnd();
            $xfer += $output->writeFieldEnd();
        }
        if ($this->progressedPercentage !== null) {
            $xfer += $output->writeFieldBegin('progressedPercentage', TType::DOUBLE, 3);
            $xfer += $output->writeDouble($this->progressedPercentage);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->status !== null) {
            $xfer += $output->writeFieldBegin('status', TType::I32, 4);
            $xfer += $output->writeI32($this->status);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->footerSummary !== null) {
            $xfer += $output->writeFieldBegin('footerSummary', TType::STRING, 5);
            $xfer += $output->writeString($this->footerSummary);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->startTime !== null) {
            $xfer += $output->writeFieldBegin('startTime', TType::I64, 6);
            $xfer += $output->writeI64($this->startTime);
            $xfer += $output->writeFieldEnd();
        }
        $xfer += $output->writeFieldStop();
        $xfer += $output->writeStructEnd();
        return $xfer;
    }
}
