# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
#     ***     AUTO GENERATED CODE    ***    AUTO GENERATED CODE     ***
#
# ----------------------------------------------------------------------------
#
#     This file is automatically generated by Magic Modules and manual
#     changes will be clobbered when the file is regenerated.
#
#     Please read more about how to change this file in README.md and
#     CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling'
require 'google/container/property/regionalcluster_addons_config_http_load_balancing'
require 'google/container/property/regionalcluster_addons_config_kubernetes_dashboard'
require 'google/container/property/regionalcluster_addons_config_network_policy_config'
module GoogleInSpec
  module Container
    module Property
      class RegionalClusterAddonsConfig
        attr_reader :arguments

        attr_reader :http_load_balancing

        attr_reader :horizontal_pod_autoscaling

        attr_reader :kubernetes_dashboard

        attr_reader :network_policy_config

        def initialize(arguments = nil, parent_identifier = nil)
          @arguments = arguments
          return if arguments.nil?
          @parent_identifier = parent_identifier
          @http_load_balancing = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHttpLoadBalancing.new(arguments['httpLoadBalancing'], to_s)
          @horizontal_pod_autoscaling = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHorizontalPodAutoscaling.new(arguments['horizontalPodAutoscaling'], to_s)
          @kubernetes_dashboard = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigKubernetesDashboard.new(arguments['kubernetesDashboard'], to_s)
          @network_policy_config = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigNetworkPolicyConfig.new(arguments['networkPolicyConfig'], to_s)
        end

        def to_s
          "#{@parent_identifier} RegionalClusterAddonsConfig"
        end

        def self.un_parse(item, current_path)
          return if item.nil?
          way_to_parse = {
            'http_load_balancing' => ->(x, path) { x.nil? ? [] : GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHttpLoadBalancing.un_parse(x, "#{path}.http_load_balancing") },
            'horizontal_pod_autoscaling' => ->(x, path) { x.nil? ? [] : GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHorizontalPodAutoscaling.un_parse(x, "#{path}.horizontal_pod_autoscaling") },
            'kubernetes_dashboard' => ->(x, path) { x.nil? ? [] : GoogleInSpec::Container::Property::RegionalClusterAddonsConfigKubernetesDashboard.un_parse(x, "#{path}.kubernetes_dashboard") },
            'network_policy_config' => ->(x, path) { x.nil? ? [] : GoogleInSpec::Container::Property::RegionalClusterAddonsConfigNetworkPolicyConfig.un_parse(x, "#{path}.network_policy_config") },
          }
          way_to_parse.map do |k, v|
            v.call(item.method(k).call, current_path)
          end
        end

        def to_json(*_args)
          @arguments.to_json
        end

        # other is a string representation of this object
        def ==(other)
          @arguments == JSON.parse(other)
        end
      end
    end
  end
end
