# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
#     ***     AUTO GENERATED CODE    ***    Type: MMv1     ***
#
# ----------------------------------------------------------------------------
#
#     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/compute/property/networkfirewallpolicy_rules_match'
require 'google/compute/property/networkfirewallpolicy_rules_match_layer4_configs'
require 'google/compute/property/networkfirewallpolicy_rules_match_src_secure_tags'
require 'google/compute/property/networkfirewallpolicy_rules_target_secure_tags'
module GoogleInSpec
  module Compute
    module Property
      class NetworkFirewallPolicyRules
        attr_reader :kind

        attr_reader :rule_name

        attr_reader :description

        attr_reader :priority

        attr_reader :match

        attr_reader :action

        attr_reader :direction

        attr_reader :target_resources

        attr_reader :enable_logging

        attr_reader :rule_tuple_count

        attr_reader :target_service_accounts

        attr_reader :target_secure_tags

        attr_reader :disabled

        def initialize(args = nil, parent_identifier = nil)
          return if args.nil?
          @parent_identifier = parent_identifier
          @kind = args['kind']
          @rule_name = args['ruleName']
          @description = args['description']
          @priority = args['priority']
          @match = GoogleInSpec::Compute::Property::NetworkFirewallPolicyRulesMatch.new(args['match'], to_s)
          @action = args['action']
          @direction = args['direction']
          @target_resources = args['targetResources']
          @enable_logging = args['enableLogging']
          @rule_tuple_count = args['ruleTupleCount']
          @target_service_accounts = args['targetServiceAccounts']
          @target_secure_tags = GoogleInSpec::Compute::Property::NetworkFirewallPolicyRulesTargetSecureTagsArray.parse(args['targetSecureTags'], to_s)
          @disabled = args['disabled']
        end

        def to_s
          "#{@parent_identifier} NetworkFirewallPolicyRules"
        end
      end

      class NetworkFirewallPolicyRulesArray
        def self.parse(value, parent_identifier)
          return if value.nil?
          return NetworkFirewallPolicyRules.new(value, parent_identifier) unless value.is_a?(::Array)
          value.map { |v| NetworkFirewallPolicyRules.new(v, parent_identifier) }
        end
      end
    end
  end
end
