#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

require 'thrift'
require 'concourse/thrift/data_types'


module Concourse
  module Thrift
    module ComplexTObjectType
      SCALAR = 1
      MAP = 2
      LIST = 3
      SET = 4
      TOBJECT = 5
      TCRITERIA = 6
      VALUE_MAP = {1 => "SCALAR", 2 => "MAP", 3 => "LIST", 4 => "SET", 5 => "TOBJECT", 6 => "TCRITERIA"}
      VALID_VALUES = Set.new([SCALAR, MAP, LIST, SET, TOBJECT, TCRITERIA]).freeze
    end

    # A recursive structure that encodes one or more {@link TObject TObjects}.
# 
# <p>
# The most basic {@link ComplexTObject} is a
# {@link ComplexTObjectType#SCALAR scalar}, which is just a wrapped
# {@link TObject}. Beyond that, complex collections can be represented as a
# {@link Set}, {@link List} or {@link Map} of
# {@link ComplexTObject ComplexTObjects}.
# </p>
    class ComplexTObject
      include ::Thrift::Struct, ::Thrift::Struct_Union
      TYPE = 1
      TSCALAR = 2
      TMAP = 3
      TLIST = 4
      TSET = 5
      TOBJECT = 6
      TCRITERIA = 7

      FIELDS = {
        TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :enum_class => ::Concourse::Thrift::ComplexTObjectType},
        TSCALAR => {:type => ::Thrift::Types::STRUCT, :name => 'tscalar', :class => ::Concourse::Thrift::TObject, :optional => true},
        TMAP => {:type => ::Thrift::Types::MAP, :name => 'tmap', :key => {:type => ::Thrift::Types::STRUCT, :class => ::Concourse::Thrift::ComplexTObject}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::Concourse::Thrift::ComplexTObject}, :optional => true},
        TLIST => {:type => ::Thrift::Types::LIST, :name => 'tlist', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Concourse::Thrift::ComplexTObject}, :optional => true},
        TSET => {:type => ::Thrift::Types::SET, :name => 'tset', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Concourse::Thrift::ComplexTObject}, :optional => true},
        TOBJECT => {:type => ::Thrift::Types::STRUCT, :name => 'tobject', :class => ::Concourse::Thrift::TObject, :optional => true},
        TCRITERIA => {:type => ::Thrift::Types::STRUCT, :name => 'tcriteria', :class => ::Concourse::Thrift::TCriteria, :optional => true}
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field type is unset!') unless @type
        unless @type.nil? || ::Concourse::Thrift::ComplexTObjectType::VALID_VALUES.include?(@type)
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
        end
      end

      ::Thrift::Struct.generate_accessors self
    end

  end
end
