# 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/bigquery/property/dataset_access_view'
module GoogleInSpec
  module BigQuery
    module Property
      class DatasetAccess
        attr_reader :domain

        attr_reader :group_by_email

        attr_reader :role

        attr_reader :special_group

        attr_reader :user_by_email

        attr_reader :iam_member

        attr_reader :view

        def initialize(args = nil, parent_identifier = nil)
          return if args.nil?
          @parent_identifier = parent_identifier
          @domain = args['domain']
          @group_by_email = args['groupByEmail']
          @role = args['role']
          @special_group = args['specialGroup']
          @user_by_email = args['userByEmail']
          @iam_member = args['iamMember']
          @view = GoogleInSpec::BigQuery::Property::DatasetAccessView.new(args['view'], to_s)
        end

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

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