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

require 'thrift'
require 'jaeger/thrift/zipkin/zipkincore_types'

module Jaeger
  module Thrift
    module Zipkin
      module ZipkinCollector
        class Client
          include ::Thrift::Client

          def submitZipkinBatch(spans)
            send_submitZipkinBatch(spans)
            return recv_submitZipkinBatch()
          end

          def send_submitZipkinBatch(spans)
            send_message('submitZipkinBatch', SubmitZipkinBatch_args, :spans => spans)
          end

          def recv_submitZipkinBatch()
            result = receive_message(SubmitZipkinBatch_result)
            return result.success unless result.success.nil?
            raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'submitZipkinBatch failed: unknown result')
          end

        end

        class Processor
          include ::Thrift::Processor

          def process_submitZipkinBatch(seqid, iprot, oprot)
            args = read_args(iprot, SubmitZipkinBatch_args)
            result = SubmitZipkinBatch_result.new()
            result.success = @handler.submitZipkinBatch(args.spans)
            write_result(result, oprot, 'submitZipkinBatch', seqid)
          end

        end

        # HELPER FUNCTIONS AND STRUCTURES

        class SubmitZipkinBatch_args
          include ::Thrift::Struct, ::Thrift::Struct_Union
          SPANS = 1

          FIELDS = {
            SPANS => {:type => ::Thrift::Types::LIST, :name => 'spans', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Span}}
          }

          def struct_fields; FIELDS; end

          def validate
          end

          ::Thrift::Struct.generate_accessors self
        end

        class SubmitZipkinBatch_result
          include ::Thrift::Struct, ::Thrift::Struct_Union
          SUCCESS = 0

          FIELDS = {
            SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Jaeger::Thrift::Zipkin::Response}}
          }

          def struct_fields; FIELDS; end

          def validate
          end

          ::Thrift::Struct.generate_accessors self
        end

      end

    end
  end
end
