# 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/dataproc/property/workflowtemplate_parameters_validation'
require 'google/dataproc/property/workflowtemplate_parameters_validation_regex'
require 'google/dataproc/property/workflowtemplate_parameters_validation_values'
module GoogleInSpec
  module Dataproc
    module Property
      class WorkflowTemplateParameters
        attr_reader :name

        attr_reader :fields

        attr_reader :description

        attr_reader :validation

        def initialize(args = nil, parent_identifier = nil)
          return if args.nil?
          @parent_identifier = parent_identifier
          @name = args['name']
          @fields = args['fields']
          @description = args['description']
          @validation = GoogleInSpec::Dataproc::Property::WorkflowTemplateParametersValidation.new(args['validation'], to_s)
        end

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

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