=begin
#Pinterest REST API

#Pinterest's REST API

The version of the OpenAPI document: 5.3.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.4.0

=end

require 'date'
require 'time'

module PinterestSdkClient
  # Pin media source.
  module PinMediaSource
    class << self
      # List of class defined in oneOf (OpenAPI v3)
      def openapi_one_of
        [
          :'PinMediaSourceImageBase64',
          :'PinMediaSourceImageURL',
          :'PinMediaSourceVideoID'
        ]
      end

      # Discriminator's property name (OpenAPI v3)
      def openapi_discriminator_name
        :'source_type'
      end

      # Discriminator's mapping (OpenAPI v3)
      def openapi_discriminator_mapping
        {
          :'image_base64' => :'PinMediaSourceImageBase64',
          :'image_url' => :'PinMediaSourceImageURL',
          :'video_id' => :'PinMediaSourceVideoID'
        }
      end

      # Builds the object
      # @param [Mixed] Data to be matched against the list of oneOf items
      # @return [Object] Returns the model or the data itself
      def build(data)
        discriminator_value = data[openapi_discriminator_name]
        return nil unless discriminator_value

        klass = openapi_discriminator_mapping[discriminator_value.to_sym]
        return nil unless klass

        PinterestSdkClient.const_get(klass).build_from_hash(data)
      end
    end
  end

end