<?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 ISchema
{
    static public $isValidate = false;

    static public $_TSPEC = array(
        1 => array(
            'var' => 'schemaType',
            'isRequired' => false,
            'type' => TType::I32,
            'class' => '\metastore\SchemaType',
        ),
        2 => array(
            'var' => 'name',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        3 => array(
            'var' => 'catName',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        4 => array(
            'var' => 'dbName',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        5 => array(
            'var' => 'compatibility',
            'isRequired' => false,
            'type' => TType::I32,
            'class' => '\metastore\SchemaCompatibility',
        ),
        6 => array(
            'var' => 'validationLevel',
            'isRequired' => false,
            'type' => TType::I32,
            'class' => '\metastore\SchemaValidation',
        ),
        7 => array(
            'var' => 'canEvolve',
            'isRequired' => false,
            'type' => TType::BOOL,
        ),
        8 => array(
            'var' => 'schemaGroup',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
        9 => array(
            'var' => 'description',
            'isRequired' => false,
            'type' => TType::STRING,
        ),
    );

    /**
     * @var int
     */
    public $schemaType = null;
    /**
     * @var string
     */
    public $name = null;
    /**
     * @var string
     */
    public $catName = null;
    /**
     * @var string
     */
    public $dbName = null;
    /**
     * @var int
     */
    public $compatibility = null;
    /**
     * @var int
     */
    public $validationLevel = null;
    /**
     * @var bool
     */
    public $canEvolve = null;
    /**
     * @var string
     */
    public $schemaGroup = null;
    /**
     * @var string
     */
    public $description = null;

    public function __construct($vals = null)
    {
        if (is_array($vals)) {
            if (isset($vals['schemaType'])) {
                $this->schemaType = $vals['schemaType'];
            }
            if (isset($vals['name'])) {
                $this->name = $vals['name'];
            }
            if (isset($vals['catName'])) {
                $this->catName = $vals['catName'];
            }
            if (isset($vals['dbName'])) {
                $this->dbName = $vals['dbName'];
            }
            if (isset($vals['compatibility'])) {
                $this->compatibility = $vals['compatibility'];
            }
            if (isset($vals['validationLevel'])) {
                $this->validationLevel = $vals['validationLevel'];
            }
            if (isset($vals['canEvolve'])) {
                $this->canEvolve = $vals['canEvolve'];
            }
            if (isset($vals['schemaGroup'])) {
                $this->schemaGroup = $vals['schemaGroup'];
            }
            if (isset($vals['description'])) {
                $this->description = $vals['description'];
            }
        }
    }

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


    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::I32) {
                        $xfer += $input->readI32($this->schemaType);
                    } 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::STRING) {
                        $xfer += $input->readString($this->catName);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 4:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->dbName);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 5:
                    if ($ftype == TType::I32) {
                        $xfer += $input->readI32($this->compatibility);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 6:
                    if ($ftype == TType::I32) {
                        $xfer += $input->readI32($this->validationLevel);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 7:
                    if ($ftype == TType::BOOL) {
                        $xfer += $input->readBool($this->canEvolve);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 8:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->schemaGroup);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 9:
                    if ($ftype == TType::STRING) {
                        $xfer += $input->readString($this->description);
                    } 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('ISchema');
        if ($this->schemaType !== null) {
            $xfer += $output->writeFieldBegin('schemaType', TType::I32, 1);
            $xfer += $output->writeI32($this->schemaType);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->name !== null) {
            $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
            $xfer += $output->writeString($this->name);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->catName !== null) {
            $xfer += $output->writeFieldBegin('catName', TType::STRING, 3);
            $xfer += $output->writeString($this->catName);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->dbName !== null) {
            $xfer += $output->writeFieldBegin('dbName', TType::STRING, 4);
            $xfer += $output->writeString($this->dbName);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->compatibility !== null) {
            $xfer += $output->writeFieldBegin('compatibility', TType::I32, 5);
            $xfer += $output->writeI32($this->compatibility);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->validationLevel !== null) {
            $xfer += $output->writeFieldBegin('validationLevel', TType::I32, 6);
            $xfer += $output->writeI32($this->validationLevel);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->canEvolve !== null) {
            $xfer += $output->writeFieldBegin('canEvolve', TType::BOOL, 7);
            $xfer += $output->writeBool($this->canEvolve);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->schemaGroup !== null) {
            $xfer += $output->writeFieldBegin('schemaGroup', TType::STRING, 8);
            $xfer += $output->writeString($this->schemaGroup);
            $xfer += $output->writeFieldEnd();
        }
        if ($this->description !== null) {
            $xfer += $output->writeFieldBegin('description', TType::STRING, 9);
            $xfer += $output->writeString($this->description);
            $xfer += $output->writeFieldEnd();
        }
        $xfer += $output->writeFieldStop();
        $xfer += $output->writeStructEnd();
        return $xfer;
    }
}
