=begin
#BitMEX API

### REST API for the BitMEX Trading Platform  _If you are building automated tools, please subscribe to the_ _[BitMEX API RSS Feed](https://blog.bitmex.com/api_announcement/feed/) for changes. The feed will be updated_ _regularly and is the most reliable way to get downtime and update announcements._  [View Changelog](/app/apiChangelog)  -  #### Getting Started  Base URI: [https://www.bitmex.com/api/v1](/api/v1)  ##### Fetching Data  All REST endpoints are documented below. You can try out any query right from this interface.  Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first.  Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](/app/restAPI).  _All_ table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits.  ##### Return Types  By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data.  ##### Trade Data Queries  _This is only a small subset of what is available, to get you started._  Fill in the parameters and click the `Try it out!` button to try any of these queries.  - [Pricing Data](#!/Quote/Quote_get)  - [Trade Data](#!/Trade/Trade_get)  - [OrderBook Data](#!/OrderBook/OrderBook_getL2)  - [Settlement Data](#!/Settlement/Settlement_get)  - [Exchange Statistics](#!/Stats/Stats_history)  Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available.  ##### Swagger Specification  [⇩ Download Swagger JSON](swagger.json)  -  ## All API Endpoints  Click to expand a section. 

OpenAPI spec version: 1.2.0
Contact: support@bitmex.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.42-SNAPSHOT

=end

require 'date'

module SwaggerClient
  class UserPreferences
    attr_accessor :alert_on_liquidations

    attr_accessor :animations_enabled

    attr_accessor :announcements_last_seen

    attr_accessor :chat_channel_id

    attr_accessor :color_theme

    attr_accessor :currency

    attr_accessor :debug

    attr_accessor :disable_emails

    attr_accessor :disable_push

    attr_accessor :display_corp_enroll_upsell

    attr_accessor :equivalent_currency

    attr_accessor :features

    attr_accessor :favourites

    attr_accessor :favourites_assets

    attr_accessor :favourites_ordered

    attr_accessor :favourite_bots

    attr_accessor :has_set_trading_currencies

    attr_accessor :hide_confirm_dialogs

    attr_accessor :hide_connection_modal

    attr_accessor :hide_from_leaderboard

    attr_accessor :hide_name_from_leaderboard

    attr_accessor :hide_pnl_in_guilds

    attr_accessor :hide_roi_in_guilds

    attr_accessor :hide_notifications

    attr_accessor :hide_phone_confirm

    attr_accessor :is_sensitive_info_visible

    attr_accessor :is_wallet_zero_balance_hidden

    attr_accessor :locale

    attr_accessor :locale_set_time

    attr_accessor :margin_pnl_row

    attr_accessor :margin_pnl_row_kind

    attr_accessor :mobile_locale

    attr_accessor :msgs_seen

    attr_accessor :notifications

    attr_accessor :options_beta

    attr_accessor :order_book_binning

    attr_accessor :order_book_type

    attr_accessor :order_clear_immediate

    attr_accessor :order_controls_plus_minus

    attr_accessor :platform_layout

    attr_accessor :selected_fiat_currency

    attr_accessor :show_chart_bottom_toolbar

    attr_accessor :show_locale_numbers

    attr_accessor :sounds

    attr_accessor :spacing_preference

    attr_accessor :strict_ip_check

    attr_accessor :strict_timeout

    attr_accessor :ticker_group

    attr_accessor :ticker_pinned

    attr_accessor :trade_layout

    attr_accessor :user_color

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'alert_on_liquidations' => :'alertOnLiquidations',
        :'animations_enabled' => :'animationsEnabled',
        :'announcements_last_seen' => :'announcementsLastSeen',
        :'chat_channel_id' => :'chatChannelID',
        :'color_theme' => :'colorTheme',
        :'currency' => :'currency',
        :'debug' => :'debug',
        :'disable_emails' => :'disableEmails',
        :'disable_push' => :'disablePush',
        :'display_corp_enroll_upsell' => :'displayCorpEnrollUpsell',
        :'equivalent_currency' => :'equivalentCurrency',
        :'features' => :'features',
        :'favourites' => :'favourites',
        :'favourites_assets' => :'favouritesAssets',
        :'favourites_ordered' => :'favouritesOrdered',
        :'favourite_bots' => :'favouriteBots',
        :'has_set_trading_currencies' => :'hasSetTradingCurrencies',
        :'hide_confirm_dialogs' => :'hideConfirmDialogs',
        :'hide_connection_modal' => :'hideConnectionModal',
        :'hide_from_leaderboard' => :'hideFromLeaderboard',
        :'hide_name_from_leaderboard' => :'hideNameFromLeaderboard',
        :'hide_pnl_in_guilds' => :'hidePnlInGuilds',
        :'hide_roi_in_guilds' => :'hideRoiInGuilds',
        :'hide_notifications' => :'hideNotifications',
        :'hide_phone_confirm' => :'hidePhoneConfirm',
        :'is_sensitive_info_visible' => :'isSensitiveInfoVisible',
        :'is_wallet_zero_balance_hidden' => :'isWalletZeroBalanceHidden',
        :'locale' => :'locale',
        :'locale_set_time' => :'localeSetTime',
        :'margin_pnl_row' => :'marginPnlRow',
        :'margin_pnl_row_kind' => :'marginPnlRowKind',
        :'mobile_locale' => :'mobileLocale',
        :'msgs_seen' => :'msgsSeen',
        :'notifications' => :'notifications',
        :'options_beta' => :'optionsBeta',
        :'order_book_binning' => :'orderBookBinning',
        :'order_book_type' => :'orderBookType',
        :'order_clear_immediate' => :'orderClearImmediate',
        :'order_controls_plus_minus' => :'orderControlsPlusMinus',
        :'platform_layout' => :'platformLayout',
        :'selected_fiat_currency' => :'selectedFiatCurrency',
        :'show_chart_bottom_toolbar' => :'showChartBottomToolbar',
        :'show_locale_numbers' => :'showLocaleNumbers',
        :'sounds' => :'sounds',
        :'spacing_preference' => :'spacingPreference',
        :'strict_ip_check' => :'strictIPCheck',
        :'strict_timeout' => :'strictTimeout',
        :'ticker_group' => :'tickerGroup',
        :'ticker_pinned' => :'tickerPinned',
        :'trade_layout' => :'tradeLayout',
        :'user_color' => :'userColor'
      }
    end

    # Attribute type mapping.
    def self.swagger_types
      {
        :'alert_on_liquidations' => :'BOOLEAN',
        :'animations_enabled' => :'BOOLEAN',
        :'announcements_last_seen' => :'DateTime',
        :'chat_channel_id' => :'Float',
        :'color_theme' => :'String',
        :'currency' => :'String',
        :'debug' => :'BOOLEAN',
        :'disable_emails' => :'Array<String>',
        :'disable_push' => :'Array<String>',
        :'display_corp_enroll_upsell' => :'BOOLEAN',
        :'equivalent_currency' => :'String',
        :'features' => :'Array<String>',
        :'favourites' => :'Array<String>',
        :'favourites_assets' => :'Array<String>',
        :'favourites_ordered' => :'Array<String>',
        :'favourite_bots' => :'Array<String>',
        :'has_set_trading_currencies' => :'BOOLEAN',
        :'hide_confirm_dialogs' => :'Array<String>',
        :'hide_connection_modal' => :'BOOLEAN',
        :'hide_from_leaderboard' => :'BOOLEAN',
        :'hide_name_from_leaderboard' => :'BOOLEAN',
        :'hide_pnl_in_guilds' => :'BOOLEAN',
        :'hide_roi_in_guilds' => :'BOOLEAN',
        :'hide_notifications' => :'Array<String>',
        :'hide_phone_confirm' => :'BOOLEAN',
        :'is_sensitive_info_visible' => :'BOOLEAN',
        :'is_wallet_zero_balance_hidden' => :'BOOLEAN',
        :'locale' => :'String',
        :'locale_set_time' => :'Float',
        :'margin_pnl_row' => :'String',
        :'margin_pnl_row_kind' => :'String',
        :'mobile_locale' => :'String',
        :'msgs_seen' => :'Array<String>',
        :'notifications' => :'Object',
        :'options_beta' => :'BOOLEAN',
        :'order_book_binning' => :'Object',
        :'order_book_type' => :'String',
        :'order_clear_immediate' => :'BOOLEAN',
        :'order_controls_plus_minus' => :'BOOLEAN',
        :'platform_layout' => :'String',
        :'selected_fiat_currency' => :'String',
        :'show_chart_bottom_toolbar' => :'BOOLEAN',
        :'show_locale_numbers' => :'BOOLEAN',
        :'sounds' => :'Array<String>',
        :'spacing_preference' => :'String',
        :'strict_ip_check' => :'BOOLEAN',
        :'strict_timeout' => :'BOOLEAN',
        :'ticker_group' => :'String',
        :'ticker_pinned' => :'BOOLEAN',
        :'trade_layout' => :'String',
        :'user_color' => :'String'
      }
    end

    # Initializes the object
    # @param [Hash] attributes Model attributes in the form of hash
    def initialize(attributes = {})
      return unless attributes.is_a?(Hash)

      # convert string to symbol for hash key
      attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

      if attributes.has_key?(:'alertOnLiquidations')
        self.alert_on_liquidations = attributes[:'alertOnLiquidations']
      end

      if attributes.has_key?(:'animationsEnabled')
        self.animations_enabled = attributes[:'animationsEnabled']
      end

      if attributes.has_key?(:'announcementsLastSeen')
        self.announcements_last_seen = attributes[:'announcementsLastSeen']
      end

      if attributes.has_key?(:'chatChannelID')
        self.chat_channel_id = attributes[:'chatChannelID']
      end

      if attributes.has_key?(:'colorTheme')
        self.color_theme = attributes[:'colorTheme']
      end

      if attributes.has_key?(:'currency')
        self.currency = attributes[:'currency']
      end

      if attributes.has_key?(:'debug')
        self.debug = attributes[:'debug']
      end

      if attributes.has_key?(:'disableEmails')
        if (value = attributes[:'disableEmails']).is_a?(Array)
          self.disable_emails = value
        end
      end

      if attributes.has_key?(:'disablePush')
        if (value = attributes[:'disablePush']).is_a?(Array)
          self.disable_push = value
        end
      end

      if attributes.has_key?(:'displayCorpEnrollUpsell')
        self.display_corp_enroll_upsell = attributes[:'displayCorpEnrollUpsell']
      end

      if attributes.has_key?(:'equivalentCurrency')
        self.equivalent_currency = attributes[:'equivalentCurrency']
      end

      if attributes.has_key?(:'features')
        if (value = attributes[:'features']).is_a?(Array)
          self.features = value
        end
      end

      if attributes.has_key?(:'favourites')
        if (value = attributes[:'favourites']).is_a?(Array)
          self.favourites = value
        end
      end

      if attributes.has_key?(:'favouritesAssets')
        if (value = attributes[:'favouritesAssets']).is_a?(Array)
          self.favourites_assets = value
        end
      end

      if attributes.has_key?(:'favouritesOrdered')
        if (value = attributes[:'favouritesOrdered']).is_a?(Array)
          self.favourites_ordered = value
        end
      end

      if attributes.has_key?(:'favouriteBots')
        if (value = attributes[:'favouriteBots']).is_a?(Array)
          self.favourite_bots = value
        end
      end

      if attributes.has_key?(:'hasSetTradingCurrencies')
        self.has_set_trading_currencies = attributes[:'hasSetTradingCurrencies']
      end

      if attributes.has_key?(:'hideConfirmDialogs')
        if (value = attributes[:'hideConfirmDialogs']).is_a?(Array)
          self.hide_confirm_dialogs = value
        end
      end

      if attributes.has_key?(:'hideConnectionModal')
        self.hide_connection_modal = attributes[:'hideConnectionModal']
      end

      if attributes.has_key?(:'hideFromLeaderboard')
        self.hide_from_leaderboard = attributes[:'hideFromLeaderboard']
      else
        self.hide_from_leaderboard = false
      end

      if attributes.has_key?(:'hideNameFromLeaderboard')
        self.hide_name_from_leaderboard = attributes[:'hideNameFromLeaderboard']
      else
        self.hide_name_from_leaderboard = true
      end

      if attributes.has_key?(:'hidePnlInGuilds')
        self.hide_pnl_in_guilds = attributes[:'hidePnlInGuilds']
      else
        self.hide_pnl_in_guilds = false
      end

      if attributes.has_key?(:'hideRoiInGuilds')
        self.hide_roi_in_guilds = attributes[:'hideRoiInGuilds']
      else
        self.hide_roi_in_guilds = false
      end

      if attributes.has_key?(:'hideNotifications')
        if (value = attributes[:'hideNotifications']).is_a?(Array)
          self.hide_notifications = value
        end
      end

      if attributes.has_key?(:'hidePhoneConfirm')
        self.hide_phone_confirm = attributes[:'hidePhoneConfirm']
      else
        self.hide_phone_confirm = false
      end

      if attributes.has_key?(:'isSensitiveInfoVisible')
        self.is_sensitive_info_visible = attributes[:'isSensitiveInfoVisible']
      end

      if attributes.has_key?(:'isWalletZeroBalanceHidden')
        self.is_wallet_zero_balance_hidden = attributes[:'isWalletZeroBalanceHidden']
      end

      if attributes.has_key?(:'locale')
        self.locale = attributes[:'locale']
      else
        self.locale = 'en-US'
      end

      if attributes.has_key?(:'localeSetTime')
        self.locale_set_time = attributes[:'localeSetTime']
      end

      if attributes.has_key?(:'marginPnlRow')
        self.margin_pnl_row = attributes[:'marginPnlRow']
      end

      if attributes.has_key?(:'marginPnlRowKind')
        self.margin_pnl_row_kind = attributes[:'marginPnlRowKind']
      end

      if attributes.has_key?(:'mobileLocale')
        self.mobile_locale = attributes[:'mobileLocale']
      end

      if attributes.has_key?(:'msgsSeen')
        if (value = attributes[:'msgsSeen']).is_a?(Array)
          self.msgs_seen = value
        end
      end

      if attributes.has_key?(:'notifications')
        self.notifications = attributes[:'notifications']
      end

      if attributes.has_key?(:'optionsBeta')
        self.options_beta = attributes[:'optionsBeta']
      end

      if attributes.has_key?(:'orderBookBinning')
        self.order_book_binning = attributes[:'orderBookBinning']
      end

      if attributes.has_key?(:'orderBookType')
        self.order_book_type = attributes[:'orderBookType']
      end

      if attributes.has_key?(:'orderClearImmediate')
        self.order_clear_immediate = attributes[:'orderClearImmediate']
      else
        self.order_clear_immediate = false
      end

      if attributes.has_key?(:'orderControlsPlusMinus')
        self.order_controls_plus_minus = attributes[:'orderControlsPlusMinus']
      end

      if attributes.has_key?(:'platformLayout')
        self.platform_layout = attributes[:'platformLayout']
      end

      if attributes.has_key?(:'selectedFiatCurrency')
        self.selected_fiat_currency = attributes[:'selectedFiatCurrency']
      end

      if attributes.has_key?(:'showChartBottomToolbar')
        self.show_chart_bottom_toolbar = attributes[:'showChartBottomToolbar']
      end

      if attributes.has_key?(:'showLocaleNumbers')
        self.show_locale_numbers = attributes[:'showLocaleNumbers']
      else
        self.show_locale_numbers = true
      end

      if attributes.has_key?(:'sounds')
        if (value = attributes[:'sounds']).is_a?(Array)
          self.sounds = value
        end
      end

      if attributes.has_key?(:'spacingPreference')
        self.spacing_preference = attributes[:'spacingPreference']
      end

      if attributes.has_key?(:'strictIPCheck')
        self.strict_ip_check = attributes[:'strictIPCheck']
      else
        self.strict_ip_check = false
      end

      if attributes.has_key?(:'strictTimeout')
        self.strict_timeout = attributes[:'strictTimeout']
      else
        self.strict_timeout = true
      end

      if attributes.has_key?(:'tickerGroup')
        self.ticker_group = attributes[:'tickerGroup']
      end

      if attributes.has_key?(:'tickerPinned')
        self.ticker_pinned = attributes[:'tickerPinned']
      end

      if attributes.has_key?(:'tradeLayout')
        self.trade_layout = attributes[:'tradeLayout']
      end

      if attributes.has_key?(:'userColor')
        self.user_color = attributes[:'userColor']
      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 &&
          alert_on_liquidations == o.alert_on_liquidations &&
          animations_enabled == o.animations_enabled &&
          announcements_last_seen == o.announcements_last_seen &&
          chat_channel_id == o.chat_channel_id &&
          color_theme == o.color_theme &&
          currency == o.currency &&
          debug == o.debug &&
          disable_emails == o.disable_emails &&
          disable_push == o.disable_push &&
          display_corp_enroll_upsell == o.display_corp_enroll_upsell &&
          equivalent_currency == o.equivalent_currency &&
          features == o.features &&
          favourites == o.favourites &&
          favourites_assets == o.favourites_assets &&
          favourites_ordered == o.favourites_ordered &&
          favourite_bots == o.favourite_bots &&
          has_set_trading_currencies == o.has_set_trading_currencies &&
          hide_confirm_dialogs == o.hide_confirm_dialogs &&
          hide_connection_modal == o.hide_connection_modal &&
          hide_from_leaderboard == o.hide_from_leaderboard &&
          hide_name_from_leaderboard == o.hide_name_from_leaderboard &&
          hide_pnl_in_guilds == o.hide_pnl_in_guilds &&
          hide_roi_in_guilds == o.hide_roi_in_guilds &&
          hide_notifications == o.hide_notifications &&
          hide_phone_confirm == o.hide_phone_confirm &&
          is_sensitive_info_visible == o.is_sensitive_info_visible &&
          is_wallet_zero_balance_hidden == o.is_wallet_zero_balance_hidden &&
          locale == o.locale &&
          locale_set_time == o.locale_set_time &&
          margin_pnl_row == o.margin_pnl_row &&
          margin_pnl_row_kind == o.margin_pnl_row_kind &&
          mobile_locale == o.mobile_locale &&
          msgs_seen == o.msgs_seen &&
          notifications == o.notifications &&
          options_beta == o.options_beta &&
          order_book_binning == o.order_book_binning &&
          order_book_type == o.order_book_type &&
          order_clear_immediate == o.order_clear_immediate &&
          order_controls_plus_minus == o.order_controls_plus_minus &&
          platform_layout == o.platform_layout &&
          selected_fiat_currency == o.selected_fiat_currency &&
          show_chart_bottom_toolbar == o.show_chart_bottom_toolbar &&
          show_locale_numbers == o.show_locale_numbers &&
          sounds == o.sounds &&
          spacing_preference == o.spacing_preference &&
          strict_ip_check == o.strict_ip_check &&
          strict_timeout == o.strict_timeout &&
          ticker_group == o.ticker_group &&
          ticker_pinned == o.ticker_pinned &&
          trade_layout == o.trade_layout &&
          user_color == o.user_color
    end

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

    # Calculates hash code according to all attributes.
    # @return [Fixnum] Hash code
    def hash
      [alert_on_liquidations, animations_enabled, announcements_last_seen, chat_channel_id, color_theme, currency, debug, disable_emails, disable_push, display_corp_enroll_upsell, equivalent_currency, features, favourites, favourites_assets, favourites_ordered, favourite_bots, has_set_trading_currencies, hide_confirm_dialogs, hide_connection_modal, hide_from_leaderboard, hide_name_from_leaderboard, hide_pnl_in_guilds, hide_roi_in_guilds, hide_notifications, hide_phone_confirm, is_sensitive_info_visible, is_wallet_zero_balance_hidden, locale, locale_set_time, margin_pnl_row, margin_pnl_row_kind, mobile_locale, msgs_seen, notifications, options_beta, order_book_binning, order_book_type, order_clear_immediate, order_controls_plus_minus, platform_layout, selected_fiat_currency, show_chart_bottom_toolbar, show_locale_numbers, sounds, spacing_preference, strict_ip_check, strict_timeout, ticker_group, ticker_pinned, trade_layout, user_color].hash
    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.swagger_types.each_pair do |key, type|
        if 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 # or else data not found in attributes(hash), not an issue as the data can be optional
      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 :DateTime
        DateTime.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
        temp_model = SwaggerClient.const_get(type).new
        temp_model.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)
        next if value.nil?
        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
