# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaChannelGroup do
  @moduledoc """
  A resource message representing a Channel Group.

  ## Attributes

  *   `description` (*type:* `String.t`, *default:* `nil`) - The description of the Channel Group. Max length of 256 characters.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. The display name of the Channel Group. Max length of 80 characters.
  *   `groupingRule` (*type:* `list(GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaGroupingRule.t)`, *default:* `nil`) - Required. The grouping rules of channels. Maximum number of rules is 50.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The resource name for this Channel Group resource. Format: properties/{property}/channelGroups/{channel_group}
  *   `primary` (*type:* `boolean()`, *default:* `nil`) - Optional. If true, this channel group will be used as the default channel group for reports. Only one channel group can be set as `primary` at any time. If the `primary` field gets set on a channel group, it will get unset on the previous primary channel group. The Google Analytics predefined channel group is the primary by default.
  *   `systemDefined` (*type:* `boolean()`, *default:* `nil`) - Output only. If true, then this channel group is the Default Channel Group predefined by Google Analytics. Display name and grouping rules cannot be updated for this channel group.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :groupingRule =>
            list(
              GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaGroupingRule.t()
            )
            | nil,
          :name => String.t() | nil,
          :primary => boolean() | nil,
          :systemDefined => boolean() | nil
        }

  field(:description)
  field(:displayName)

  field(:groupingRule,
    as: GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaGroupingRule,
    type: :list
  )

  field(:name)
  field(:primary)
  field(:systemDefined)
end

defimpl Poison.Decoder,
  for: GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaChannelGroup do
  def decode(value, options) do
    GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaChannelGroup.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaChannelGroup do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
