# 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/regionurlmap_path_matchers_default_custom_error_response_policy'
require 'google/compute/property/regionurlmap_path_matchers_default_custom_error_response_policy_error_response_rules'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_cors_policy'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_fault_injection_policy'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_fault_injection_policy_abort'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_fault_injection_policy_delay'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_fault_injection_policy_delay_fixed_delay'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_max_stream_duration'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_request_mirror_policy'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_retry_policy'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_retry_policy_per_try_timeout'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_timeout'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_url_rewrite'
require 'google/compute/property/regionurlmap_path_matchers_default_route_action_weighted_backend_services'
require 'google/compute/property/regionurlmap_path_matchers_default_url_redirect'
require 'google/compute/property/regionurlmap_path_matchers_header_action'
require 'google/compute/property/regionurlmap_path_matchers_header_action_request_headers_to_add'
require 'google/compute/property/regionurlmap_path_matchers_header_action_response_headers_to_add'
require 'google/compute/property/regionurlmap_path_matchers_path_rules'
require 'google/compute/property/regionurlmap_path_matchers_route_rules'
module GoogleInSpec
  module Compute
    module Property
      class RegionUrlMapPathMatchers
        attr_reader :name

        attr_reader :description

        attr_reader :default_service

        attr_reader :default_route_action

        attr_reader :default_url_redirect

        attr_reader :path_rules

        attr_reader :route_rules

        attr_reader :header_action

        attr_reader :default_custom_error_response_policy

        def initialize(args = nil, parent_identifier = nil)
          return if args.nil?
          @parent_identifier = parent_identifier
          @name = args['name']
          @description = args['description']
          @default_service = args['defaultService']
          @default_route_action = GoogleInSpec::Compute::Property::RegionUrlMapPathMatchersDefaultRouteAction.new(args['defaultRouteAction'], to_s)
          @default_url_redirect = GoogleInSpec::Compute::Property::RegionUrlMapPathMatchersDefaultUrlRedirect.new(args['defaultUrlRedirect'], to_s)
          @path_rules = GoogleInSpec::Compute::Property::RegionUrlMapPathMatchersPathRulesArray.parse(args['pathRules'], to_s)
          @route_rules = GoogleInSpec::Compute::Property::RegionUrlMapPathMatchersRouteRulesArray.parse(args['routeRules'], to_s)
          @header_action = GoogleInSpec::Compute::Property::RegionUrlMapPathMatchersHeaderAction.new(args['headerAction'], to_s)
          @default_custom_error_response_policy = GoogleInSpec::Compute::Property::RegionUrlMapPathMatchersDefaultCustomErrorResponsePolicy.new(args['defaultCustomErrorResponsePolicy'], to_s)
        end

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

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