<?php
namespace metastore;

/**
 * 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 FireEventRequest
{
    static public $isValidate = false;

    static public $_TSPEC = array(
        1 => array(
            'var' => 'successful',
            'isRequired' => true,
            'type' => TType::BOOL,
        ),
        2 => array(
            'var' => 'data',
            'isRequired' => true,
            'type' => TType::STRUCT,
            'class' => '\metastore\FireEventRequestData',
        ),
        3 => array(
            'var' => 'dbName',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        4 => array(
            'var' => 'tableName',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        5 => array(
            'var' => 'partitionVals',
            'isRequired' => false,
            'type' => TType::LST,
            'etype' => TType::STRING,
            'elem' => array(
                'type' => TType::STRING,
                ),
        ),
        6 => array(
            'var' => 'catName',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        7 => array(
            'var' => 'tblParams',
            'isRequired' => false,
            'type' => TType::MAP,
            'ktype' => TType::STRING,
            'vtype' => TType::STRING,
            'key' => array(
                'type' => TType::STRING,
            ),
            'val' => array(
                'type' => TType::STRING,
                ),
        ),
        8 => array(
            'var' => 'batchPartitionValsForRefresh',
            'isRequired' => false,
            'type' => TType::LST,
            'etype' => TType::LST,
            'elem' => array(
                'type' => TType::LST,
                'etype' => TType::STRING,
                'elem' => array(
                    'type' => TType::STRING,
                    ),
                ),
        ),
    );

    /**
     * @var bool
     */
    public $successful = null;
    /**
     * @var \metastore\FireEventRequestData
     */
    public $data = null;
    /**
     * @var string
     */
    public $dbName = null;
    /**
     * @var string
     */
    public $tableName = null;
    /**
     * @var string[]
     */
    public $partitionVals = null;
    /**
     * @var string
     */
    public $catName = null;
    /**
     * @var array
     */
    public $tblParams = null;
    /**
     * @var (string[])[]
     */
    public $batchPartitionValsForRefresh = null;

    public function __construct($vals = null)
    {
        if (is_array($vals)) {
            if (isset($vals['successful'])) {
                $this->successful = $vals['successful'];
            }
            if (isset($vals['data'])) {
                $this->data = $vals['data'];
            }
            if (isset($vals['dbName'])) {
                $this->dbName = $vals['dbName'];
            }
            if (isset($vals['tableName'])) {
                $this->tableName = $vals['tableName'];
            }
            if (isset($vals['partitionVals'])) {
                $this->partitionVals = $vals['partitionVals'];
            }
            if (isset($vals['catName'])) {
                $this->catName = $vals['catName'];
            }
            if (isset($vals['tblParams'])) {
                $this->tblParams = $vals['tblParams'];
            }
            if (isset($vals['batchPartitionValsForRefresh'])) {
                $this->batchPartitionValsForRefresh = $vals['batchPartitionValsForRefresh'];
            }
        }
    }

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


    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::BOOL) {
                        $xfer += $input->readBool($this->successful);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 2:
                    if ($ftype == TType::STRUCT) {
                        $this->data = new \metastore\FireEventRequestData();
                        $xfer += $this->data->read($input);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 3:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->dbName);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 4:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->tableName);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 5:
                    if ($ftype == TType::LST) {
                        $this->partitionVals = array();
                        $_size939 = 0;
                        $_etype942 = 0;
                        $xfer += $input->readListBegin($_etype942, $_size939);
                        for ($_i943 = 0; $_i943 < $_size939; ++$_i943) {
                            $elem944 = null;
                            $xfer += $input->readString($elem944);
                            $this->partitionVals []= $elem944;
                        }
                        $xfer += $input->readListEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 6:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->catName);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 7:
                    if ($ftype == TType::MAP) {
                        $this->tblParams = array();
                        $_size945 = 0;
                        $_ktype946 = 0;
                        $_vtype947 = 0;
                        $xfer += $input->readMapBegin($_ktype946, $_vtype947, $_size945);
                        for ($_i949 = 0; $_i949 < $_size945; ++$_i949) {
                            $key950 = '';
                            $val951 = '';
                            $xfer += $input->readString($key950);
                            $xfer += $input->readString($val951);
                            $this->tblParams[$key950] = $val951;
                        }
                        $xfer += $input->readMapEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 8:
                    if ($ftype == TType::LST) {
                        $this->batchPartitionValsForRefresh = array();
                        $_size952 = 0;
                        $_etype955 = 0;
                        $xfer += $input->readListBegin($_etype955, $_size952);
                        for ($_i956 = 0; $_i956 < $_size952; ++$_i956) {
                            $elem957 = null;
                            $elem957 = array();
                            $_size958 = 0;
                            $_etype961 = 0;
                            $xfer += $input->readListBegin($_etype961, $_size958);
                            for ($_i962 = 0; $_i962 < $_size958; ++$_i962) {
                                $elem963 = null;
                                $xfer += $input->readString($elem963);
                                $elem957 []= $elem963;
                            }
                            $xfer += $input->readListEnd();
                            $this->batchPartitionValsForRefresh []= $elem957;
                        }
                        $xfer += $input->readListEnd();
                    } 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('FireEventRequest');
        if ($this->successful !== null) {
            $xfer += $output->writeFieldBegin('successful', TType::BOOL, 1);
            $xfer += $output->writeBool($this->successful);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->data !== null) {
            if (!is_object($this->data)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('data', TType::STRUCT, 2);
            $xfer += $this->data->write($output);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->dbName !== null) {
            $xfer += $output->writeFieldBegin('dbName', TType::STRING, 3);
            $xfer += $output->writeString($this->dbName);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->tableName !== null) {
            $xfer += $output->writeFieldBegin('tableName', TType::STRING, 4);
            $xfer += $output->writeString($this->tableName);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->partitionVals !== null) {
            if (!is_array($this->partitionVals)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('partitionVals', TType::LST, 5);
            $output->writeListBegin(TType::STRING, count($this->partitionVals));
            foreach ($this->partitionVals as $iter964) {
                $xfer += $output->writeString($iter964);
            }
            $output->writeListEnd();
            $xfer += $output->writeFieldEnd();
        }
        if ($this->catName !== null) {
            $xfer += $output->writeFieldBegin('catName', TType::STRING, 6);
            $xfer += $output->writeString($this->catName);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->tblParams !== null) {
            if (!is_array($this->tblParams)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('tblParams', TType::MAP, 7);
            $output->writeMapBegin(TType::STRING, TType::STRING, count($this->tblParams));
            foreach ($this->tblParams as $kiter965 => $viter966) {
                $xfer += $output->writeString($kiter965);
                $xfer += $output->writeString($viter966);
            }
            $output->writeMapEnd();
            $xfer += $output->writeFieldEnd();
        }
        if ($this->batchPartitionValsForRefresh !== null) {
            if (!is_array($this->batchPartitionValsForRefresh)) {
                throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
            }
            $xfer += $output->writeFieldBegin('batchPartitionValsForRefresh', TType::LST, 8);
            $output->writeListBegin(TType::LST, count($this->batchPartitionValsForRefresh));
            foreach ($this->batchPartitionValsForRefresh as $iter967) {
                $output->writeListBegin(TType::STRING, count($iter967));
                foreach ($iter967 as $iter968) {
                    $xfer += $output->writeString($iter968);
                }
                $output->writeListEnd();
            }
            $output->writeListEnd();
            $xfer += $output->writeFieldEnd();
        }
        $xfer += $output->writeFieldStop();
        $xfer += $output->writeStructEnd();
        return $xfer;
    }
}
