# meraki
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).

module Meraki
  # UpdateNetworkSecurityMalwareSettingsModel Model.
  class UpdateNetworkSecurityMalwareSettingsModel < BaseModel
    # Set mode to 'enabled' to enable malware prevention, otherwise 'disabled'
    # @return [String]
    attr_accessor :mode

    # The urls that should be permitted by the malware detection engine. If
    # omitted, the current config will remain unchanged. This is available only
    # if your network supports AMP whitelisting
    # @return [List of AllowedUrlModel]
    attr_accessor :allowed_urls

    # The sha256 digests of files that should be permitted by the malware
    # detection engine. If omitted, the current config will remain unchanged.
    # This is available only if your network supports AMP whitelisting
    # @return [List of AllowedFileModel]
    attr_accessor :allowed_files

    # A mapping from model property names to API property names.
    def self.names
      @_hash = {} if @_hash.nil?
      @_hash['mode'] = 'mode'
      @_hash['allowed_urls'] = 'allowedUrls'
      @_hash['allowed_files'] = 'allowedFiles'
      @_hash
    end

    def initialize(mode = nil,
                   allowed_urls = nil,
                   allowed_files = nil)
      @mode = mode
      @allowed_urls = allowed_urls
      @allowed_files = allowed_files
    end

    # Creates an instance of the object from a hash.
    def self.from_hash(hash)
      return nil unless hash

      # Extract variables from the hash.
      mode = hash['mode']
      # Parameter is an array, so we need to iterate through it
      allowed_urls = nil
      unless hash['allowedUrls'].nil?
        allowed_urls = []
        hash['allowedUrls'].each do |structure|
          allowed_urls << (AllowedUrlModel.from_hash(structure) if structure)
        end
      end
      # Parameter is an array, so we need to iterate through it
      allowed_files = nil
      unless hash['allowedFiles'].nil?
        allowed_files = []
        hash['allowedFiles'].each do |structure|
          allowed_files << (AllowedFileModel.from_hash(structure) if structure)
        end
      end

      # Create object from extracted values.
      UpdateNetworkSecurityMalwareSettingsModel.new(mode,
                                                    allowed_urls,
                                                    allowed_files)
    end
  end
end
