=begin
#Pinterest REST API

#Pinterest's REST API

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

=end

require 'date'
require 'time'

module PinterestSdkClient
  class CatalogsFeedValidationErrors
    attr_accessor :fetch_error

    attr_accessor :fetch_inactive_feed_error

    attr_accessor :encoding_error

    attr_accessor :delimiter_error

    attr_accessor :required_columns_missing

    attr_accessor :image_link_invalid

    attr_accessor :itemid_missing

    attr_accessor :title_missing

    attr_accessor :description_missing

    attr_accessor :product_category_invalid

    attr_accessor :product_link_missing

    attr_accessor :image_link_missing

    attr_accessor :availability_invalid

    attr_accessor :product_price_invalid

    attr_accessor :link_format_invalid

    attr_accessor :parse_line_error

    attr_accessor :adwords_format_invalid

    attr_accessor :product_category_missing

    attr_accessor :internal_service_error

    attr_accessor :no_verified_domain

    attr_accessor :adult_invalid

    attr_accessor :invalid_domain

    attr_accessor :feed_length_too_long

    attr_accessor :link_length_too_long

    attr_accessor :malformed_xml

    attr_accessor :redirect_invalid

    attr_accessor :price_missing

    attr_accessor :feed_too_small

    attr_accessor :condition_invalid

    attr_accessor :shopify_no_products

    attr_accessor :max_items_per_item_group_exceeded

    attr_accessor :item_main_image_download_failure

    attr_accessor :pinjoin_content_unsafe

    attr_accessor :blocklisted_image_signature

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'fetch_error' => :'fetch_error',
        :'fetch_inactive_feed_error' => :'fetch_inactive_feed_error',
        :'encoding_error' => :'encoding_error',
        :'delimiter_error' => :'delimiter_error',
        :'required_columns_missing' => :'required_columns_missing',
        :'image_link_invalid' => :'image_link_invalid',
        :'itemid_missing' => :'itemid_missing',
        :'title_missing' => :'title_missing',
        :'description_missing' => :'description_missing',
        :'product_category_invalid' => :'product_category_invalid',
        :'product_link_missing' => :'product_link_missing',
        :'image_link_missing' => :'image_link_missing',
        :'availability_invalid' => :'availability_invalid',
        :'product_price_invalid' => :'product_price_invalid',
        :'link_format_invalid' => :'link_format_invalid',
        :'parse_line_error' => :'parse_line_error',
        :'adwords_format_invalid' => :'adwords_format_invalid',
        :'product_category_missing' => :'product_category_missing',
        :'internal_service_error' => :'internal_service_error',
        :'no_verified_domain' => :'no_verified_domain',
        :'adult_invalid' => :'adult_invalid',
        :'invalid_domain' => :'invalid_domain',
        :'feed_length_too_long' => :'feed_length_too_long',
        :'link_length_too_long' => :'link_length_too_long',
        :'malformed_xml' => :'malformed_xml',
        :'redirect_invalid' => :'redirect_invalid',
        :'price_missing' => :'price_missing',
        :'feed_too_small' => :'feed_too_small',
        :'condition_invalid' => :'condition_invalid',
        :'shopify_no_products' => :'shopify_no_products',
        :'max_items_per_item_group_exceeded' => :'max_items_per_item_group_exceeded',
        :'item_main_image_download_failure' => :'item_main_image_download_failure',
        :'pinjoin_content_unsafe' => :'pinjoin_content_unsafe',
        :'blocklisted_image_signature' => :'blocklisted_image_signature'
      }
    end

    # Returns all the JSON keys this model knows about
    def self.acceptable_attributes
      attribute_map.values
    end

    # Attribute type mapping.
    def self.openapi_types
      {
        :'fetch_error' => :'Integer',
        :'fetch_inactive_feed_error' => :'Integer',
        :'encoding_error' => :'Integer',
        :'delimiter_error' => :'Integer',
        :'required_columns_missing' => :'Integer',
        :'image_link_invalid' => :'Integer',
        :'itemid_missing' => :'Integer',
        :'title_missing' => :'Integer',
        :'description_missing' => :'Integer',
        :'product_category_invalid' => :'Integer',
        :'product_link_missing' => :'Integer',
        :'image_link_missing' => :'Integer',
        :'availability_invalid' => :'Integer',
        :'product_price_invalid' => :'Integer',
        :'link_format_invalid' => :'Integer',
        :'parse_line_error' => :'Integer',
        :'adwords_format_invalid' => :'Integer',
        :'product_category_missing' => :'Integer',
        :'internal_service_error' => :'Integer',
        :'no_verified_domain' => :'Integer',
        :'adult_invalid' => :'Integer',
        :'invalid_domain' => :'Integer',
        :'feed_length_too_long' => :'Integer',
        :'link_length_too_long' => :'Integer',
        :'malformed_xml' => :'Integer',
        :'redirect_invalid' => :'Integer',
        :'price_missing' => :'Integer',
        :'feed_too_small' => :'Integer',
        :'condition_invalid' => :'Integer',
        :'shopify_no_products' => :'Integer',
        :'max_items_per_item_group_exceeded' => :'Integer',
        :'item_main_image_download_failure' => :'Integer',
        :'pinjoin_content_unsafe' => :'Integer',
        :'blocklisted_image_signature' => :'Integer'
      }
    end

    # List of attributes with nullable: true
    def self.openapi_nullable
      Set.new([
      ])
    end

    # Initializes the object
    # @param [Hash] attributes Model attributes in the form of hash
    def initialize(attributes = {})
      if (!attributes.is_a?(Hash))
        fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::CatalogsFeedValidationErrors` initialize method"
      end

      # check to see if the attribute exists and convert string to symbol for hash key
      attributes = attributes.each_with_object({}) { |(k, v), h|
        if (!self.class.attribute_map.key?(k.to_sym))
          fail ArgumentError, "`#{k}` is not a valid attribute in `PinterestSdkClient::CatalogsFeedValidationErrors`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
        end
        h[k.to_sym] = v
      }

      if attributes.key?(:'fetch_error')
        self.fetch_error = attributes[:'fetch_error']
      end

      if attributes.key?(:'fetch_inactive_feed_error')
        self.fetch_inactive_feed_error = attributes[:'fetch_inactive_feed_error']
      end

      if attributes.key?(:'encoding_error')
        self.encoding_error = attributes[:'encoding_error']
      end

      if attributes.key?(:'delimiter_error')
        self.delimiter_error = attributes[:'delimiter_error']
      end

      if attributes.key?(:'required_columns_missing')
        self.required_columns_missing = attributes[:'required_columns_missing']
      end

      if attributes.key?(:'image_link_invalid')
        self.image_link_invalid = attributes[:'image_link_invalid']
      end

      if attributes.key?(:'itemid_missing')
        self.itemid_missing = attributes[:'itemid_missing']
      end

      if attributes.key?(:'title_missing')
        self.title_missing = attributes[:'title_missing']
      end

      if attributes.key?(:'description_missing')
        self.description_missing = attributes[:'description_missing']
      end

      if attributes.key?(:'product_category_invalid')
        self.product_category_invalid = attributes[:'product_category_invalid']
      end

      if attributes.key?(:'product_link_missing')
        self.product_link_missing = attributes[:'product_link_missing']
      end

      if attributes.key?(:'image_link_missing')
        self.image_link_missing = attributes[:'image_link_missing']
      end

      if attributes.key?(:'availability_invalid')
        self.availability_invalid = attributes[:'availability_invalid']
      end

      if attributes.key?(:'product_price_invalid')
        self.product_price_invalid = attributes[:'product_price_invalid']
      end

      if attributes.key?(:'link_format_invalid')
        self.link_format_invalid = attributes[:'link_format_invalid']
      end

      if attributes.key?(:'parse_line_error')
        self.parse_line_error = attributes[:'parse_line_error']
      end

      if attributes.key?(:'adwords_format_invalid')
        self.adwords_format_invalid = attributes[:'adwords_format_invalid']
      end

      if attributes.key?(:'product_category_missing')
        self.product_category_missing = attributes[:'product_category_missing']
      end

      if attributes.key?(:'internal_service_error')
        self.internal_service_error = attributes[:'internal_service_error']
      end

      if attributes.key?(:'no_verified_domain')
        self.no_verified_domain = attributes[:'no_verified_domain']
      end

      if attributes.key?(:'adult_invalid')
        self.adult_invalid = attributes[:'adult_invalid']
      end

      if attributes.key?(:'invalid_domain')
        self.invalid_domain = attributes[:'invalid_domain']
      end

      if attributes.key?(:'feed_length_too_long')
        self.feed_length_too_long = attributes[:'feed_length_too_long']
      end

      if attributes.key?(:'link_length_too_long')
        self.link_length_too_long = attributes[:'link_length_too_long']
      end

      if attributes.key?(:'malformed_xml')
        self.malformed_xml = attributes[:'malformed_xml']
      end

      if attributes.key?(:'redirect_invalid')
        self.redirect_invalid = attributes[:'redirect_invalid']
      end

      if attributes.key?(:'price_missing')
        self.price_missing = attributes[:'price_missing']
      end

      if attributes.key?(:'feed_too_small')
        self.feed_too_small = attributes[:'feed_too_small']
      end

      if attributes.key?(:'condition_invalid')
        self.condition_invalid = attributes[:'condition_invalid']
      end

      if attributes.key?(:'shopify_no_products')
        self.shopify_no_products = attributes[:'shopify_no_products']
      end

      if attributes.key?(:'max_items_per_item_group_exceeded')
        self.max_items_per_item_group_exceeded = attributes[:'max_items_per_item_group_exceeded']
      end

      if attributes.key?(:'item_main_image_download_failure')
        self.item_main_image_download_failure = attributes[:'item_main_image_download_failure']
      end

      if attributes.key?(:'pinjoin_content_unsafe')
        self.pinjoin_content_unsafe = attributes[:'pinjoin_content_unsafe']
      end

      if attributes.key?(:'blocklisted_image_signature')
        self.blocklisted_image_signature = attributes[:'blocklisted_image_signature']
      end
    end

    # Show invalid properties with the reasons. Usually used together with valid?
    # @return Array for valid properties with the reasons
    def list_invalid_properties
      invalid_properties = Array.new
      invalid_properties
    end

    # Check to see if the all the properties in the model are valid
    # @return true if the model is valid
    def valid?
      true
    end

    # Checks equality by comparing each attribute.
    # @param [Object] Object to be compared
    def ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          fetch_error == o.fetch_error &&
          fetch_inactive_feed_error == o.fetch_inactive_feed_error &&
          encoding_error == o.encoding_error &&
          delimiter_error == o.delimiter_error &&
          required_columns_missing == o.required_columns_missing &&
          image_link_invalid == o.image_link_invalid &&
          itemid_missing == o.itemid_missing &&
          title_missing == o.title_missing &&
          description_missing == o.description_missing &&
          product_category_invalid == o.product_category_invalid &&
          product_link_missing == o.product_link_missing &&
          image_link_missing == o.image_link_missing &&
          availability_invalid == o.availability_invalid &&
          product_price_invalid == o.product_price_invalid &&
          link_format_invalid == o.link_format_invalid &&
          parse_line_error == o.parse_line_error &&
          adwords_format_invalid == o.adwords_format_invalid &&
          product_category_missing == o.product_category_missing &&
          internal_service_error == o.internal_service_error &&
          no_verified_domain == o.no_verified_domain &&
          adult_invalid == o.adult_invalid &&
          invalid_domain == o.invalid_domain &&
          feed_length_too_long == o.feed_length_too_long &&
          link_length_too_long == o.link_length_too_long &&
          malformed_xml == o.malformed_xml &&
          redirect_invalid == o.redirect_invalid &&
          price_missing == o.price_missing &&
          feed_too_small == o.feed_too_small &&
          condition_invalid == o.condition_invalid &&
          shopify_no_products == o.shopify_no_products &&
          max_items_per_item_group_exceeded == o.max_items_per_item_group_exceeded &&
          item_main_image_download_failure == o.item_main_image_download_failure &&
          pinjoin_content_unsafe == o.pinjoin_content_unsafe &&
          blocklisted_image_signature == o.blocklisted_image_signature
    end

    # @see the `==` method
    # @param [Object] Object to be compared
    def eql?(o)
      self == o
    end

    # Calculates hash code according to all attributes.
    # @return [Integer] Hash code
    def hash
      [fetch_error, fetch_inactive_feed_error, encoding_error, delimiter_error, required_columns_missing, image_link_invalid, itemid_missing, title_missing, description_missing, product_category_invalid, product_link_missing, image_link_missing, availability_invalid, product_price_invalid, link_format_invalid, parse_line_error, adwords_format_invalid, product_category_missing, internal_service_error, no_verified_domain, adult_invalid, invalid_domain, feed_length_too_long, link_length_too_long, malformed_xml, redirect_invalid, price_missing, feed_too_small, condition_invalid, shopify_no_products, max_items_per_item_group_exceeded, item_main_image_download_failure, pinjoin_content_unsafe, blocklisted_image_signature].hash
    end

    # Builds the object from hash
    # @param [Hash] attributes Model attributes in the form of hash
    # @return [Object] Returns the model itself
    def self.build_from_hash(attributes)
      new.build_from_hash(attributes)
    end

    # Builds the object from hash
    # @param [Hash] attributes Model attributes in the form of hash
    # @return [Object] Returns the model itself
    def build_from_hash(attributes)
      return nil unless attributes.is_a?(Hash)
      self.class.openapi_types.each_pair do |key, type|
        if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
          self.send("#{key}=", nil)
        elsif type =~ /\AArray<(.*)>/i
          # check to ensure the input is an array given that the attribute
          # is documented as an array but the input is not
          if attributes[self.class.attribute_map[key]].is_a?(Array)
            self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
          end
        elsif !attributes[self.class.attribute_map[key]].nil?
          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
        end
      end

      self
    end

    # Deserializes the data based on type
    # @param string type Data type
    # @param string value Value to be deserialized
    # @return [Object] Deserialized data
    def _deserialize(type, value)
      case type.to_sym
      when :Time
        Time.parse(value)
      when :Date
        Date.parse(value)
      when :String
        value.to_s
      when :Integer
        value.to_i
      when :Float
        value.to_f
      when :Boolean
        if value.to_s =~ /\A(true|t|yes|y|1)\z/i
          true
        else
          false
        end
      when :Object
        # generic object (usually a Hash), return directly
        value
      when /\AArray<(?<inner_type>.+)>\z/
        inner_type = Regexp.last_match[:inner_type]
        value.map { |v| _deserialize(inner_type, v) }
      when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
        k_type = Regexp.last_match[:k_type]
        v_type = Regexp.last_match[:v_type]
        {}.tap do |hash|
          value.each do |k, v|
            hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
          end
        end
      else # model
        # models (e.g. Pet) or oneOf
        klass = PinterestSdkClient.const_get(type)
        klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
      end
    end

    # Returns the string representation of the object
    # @return [String] String presentation of the object
    def to_s
      to_hash.to_s
    end

    # to_body is an alias to to_hash (backward compatibility)
    # @return [Hash] Returns the object in the form of hash
    def to_body
      to_hash
    end

    # Returns the object in the form of hash
    # @return [Hash] Returns the object in the form of hash
    def to_hash
      hash = {}
      self.class.attribute_map.each_pair do |attr, param|
        value = self.send(attr)
        if value.nil?
          is_nullable = self.class.openapi_nullable.include?(attr)
          next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
        end

        hash[param] = _to_hash(value)
      end
      hash
    end

    # Outputs non-array value in the form of hash
    # For object, use to_hash. Otherwise, just return the value
    # @param [Object] value Any valid value
    # @return [Hash] Returns the value in the form of hash
    def _to_hash(value)
      if value.is_a?(Array)
        value.compact.map { |v| _to_hash(v) }
      elsif value.is_a?(Hash)
        {}.tap do |hash|
          value.each { |k, v| hash[k] = _to_hash(v) }
        end
      elsif value.respond_to? :to_hash
        value.to_hash
      else
        value
      end
    end

  end

end