# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

require_relative '../arm/module_definition'
require_relative './module_definition'

module Azure::ARM::NotificationHubs
    #
    # Model object.
    #
    class NotificationHubsPropertiesMpnsCredential0 < Azure::ARM::TypeBase

      # @return [String]
      # Microsoft.NotificationHubs/namespaces/notificationHubs: A certificate
      # (in base 64 format) uploaded to the Windows Phone portal
      attr_accessor :mpns_certificate

      # @return [String]
      # Microsoft.NotificationHubs/namespaces/notificationHubs: The
      # Certificate Key provided by the Windows Phone Portal when registering
      # the application
      attr_accessor :certificate_key

      #
      # Validate the object. Throws ValidationError if validation fails.
      #
      def validate
        # Nothing to validate
      end

      #
      # Serializes given Model object into Ruby Hash.
      # @param object Model object to serialize.
      # @return [Hash] Serialized object in form of Ruby Hash.
      #
      def self.serialize_object(output_object, object)
        Azure::ARM::TypeBase.serialize_object(output_object, object)
        object.validate

        serialized_property = object.mpns_certificate
        output_object[:mpnsCertificate] = serialized_property unless serialized_property.nil?

        serialized_property = object.certificate_key
        output_object[:certificateKey] = serialized_property unless serialized_property.nil?

        output_object
      end

      def to_h
        hash = {}
        NotificationHubsPropertiesMpnsCredential0.serialize_object(hash,self)
        hash
      end

      def self.ds_properties
        result = Array.new 
        result.push :mpns_certificate
        result.push :certificate_key
        result
      end

      #
      # Deserializes given Ruby Hash into Model object.
      # @param object [Hash] Ruby Hash object to deserialize.
      # @return [NotificationHubsPropertiesMpnsCredential0] Deserialized
      # object.
      #
      def self.deserialize_object(output_object, object)
        return if object.nil?
        conf = Configurator.new
        conf.parent = output_object

        if object.key?(:mpns_certificate)
          conf.mpns_certificate object[:mpns_certificate]
          object.delete :mpns_certificate
        end

        if object.key?(:certificate_key)
          conf.certificate_key object[:certificate_key]
          object.delete :certificate_key
        end

        output_object
      end

      def get_name_template
        'nhpmc'
        end

      def initialize(parent, init)
        super(parent)
        if init.is_a? Hash
          NotificationHubsPropertiesMpnsCredential0.deserialize_object self, init.clone
        end
      end

      # Configuration code
      class Configurator < Azure::ARM::ResourceConfigurator
        attr_accessor :parent
        # @param mpns_certificate
        #        String
        def mpns_certificate(props)
          if props.is_a? String or props.is_a? Azure::ARM::Expression
            @parent.mpns_certificate = props
            return
          end
          @parent.mpns_certificate
        end
        # @param certificate_key
        #        String
        def certificate_key(props)
          if props.is_a? String or props.is_a? Azure::ARM::Expression
            @parent.certificate_key = props
            return
          end
          @parent.certificate_key
        end
        def create(init=nil,&block)
          @parent = NotificationHubsPropertiesMpnsCredential0.new nil, init
          self.instance_exec(@parent,&block) if block
          @parent
        end
      end
      def configure(&block)
        conf = Configurator.new
        conf.parent = self
        conf.instance_exec(self,&block) if block
        self
      end
    end
end
