# 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.V1beta.Model.GoogleAnalyticsAdminV1betaCustomMetric do
  @moduledoc """
  A definition for a custom metric.

  ## Attributes

  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. Description for this custom dimension. Max length of 150 characters.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets.
  *   `measurementUnit` (*type:* `String.t`, *default:* `nil`) - Required. The type for the custom metric's value.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
  *   `parameterName` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics.
  *   `restrictedMetricType` (*type:* `list(String.t)`, *default:* `nil`) - Optional. Types of restricted data that this metric may contain. Required for metrics with CURRENCY measurement unit. Must be empty for metrics with a non-CURRENCY measurement unit.
  *   `scope` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. The scope of this custom metric.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :measurementUnit => String.t() | nil,
          :name => String.t() | nil,
          :parameterName => String.t() | nil,
          :restrictedMetricType => list(String.t()) | nil,
          :scope => String.t() | nil
        }

  field(:description)
  field(:displayName)
  field(:measurementUnit)
  field(:name)
  field(:parameterName)
  field(:restrictedMetricType, type: :list)
  field(:scope)
end

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

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