# 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.AnalyticsData.V1beta.Model.AudienceExport do
  @moduledoc """
  An audience export is a list of users in an audience at the time of the list's creation. One audience may have multiple audience exports created for different days.

  ## Attributes

  *   `audience` (*type:* `String.t`, *default:* `nil`) - Required. The audience resource name. This resource name identifies the audience being listed and is shared between the Analytics Data & Admin APIs. Format: `properties/{property}/audiences/{audience}`
  *   `audienceDisplayName` (*type:* `String.t`, *default:* `nil`) - Output only. The descriptive display name for this audience. For example, "Purchasers".
  *   `beginCreatingTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when CreateAudienceExport was called and the AudienceExport began the `CREATING` state.
  *   `creationQuotaTokensCharged` (*type:* `integer()`, *default:* `nil`) - Output only. The total quota tokens charged during creation of the AudienceExport. Because this token count is based on activity from the `CREATING` state, this tokens charged will be fixed once an AudienceExport enters the `ACTIVE` or `FAILED` states.
  *   `dimensions` (*type:* `list(GoogleApi.AnalyticsData.V1beta.Model.V1betaAudienceDimension.t)`, *default:* `nil`) - Required. The dimensions requested and displayed in the query response.
  *   `errorMessage` (*type:* `String.t`, *default:* `nil`) - Output only. Error message is populated when an audience export fails during creation. A common reason for such a failure is quota exhaustion.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Identifier. The audience export resource name assigned during creation. This resource name identifies this `AudienceExport`. Format: `properties/{property}/audienceExports/{audience_export}`
  *   `percentageCompleted` (*type:* `float()`, *default:* `nil`) - Output only. The percentage completed for this audience export ranging between 0 to 100.
  *   `rowCount` (*type:* `integer()`, *default:* `nil`) - Output only. The total number of rows in the AudienceExport result.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The current state for this AudienceExport.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :audience => String.t() | nil,
          :audienceDisplayName => String.t() | nil,
          :beginCreatingTime => DateTime.t() | nil,
          :creationQuotaTokensCharged => integer() | nil,
          :dimensions =>
            list(GoogleApi.AnalyticsData.V1beta.Model.V1betaAudienceDimension.t()) | nil,
          :errorMessage => String.t() | nil,
          :name => String.t() | nil,
          :percentageCompleted => float() | nil,
          :rowCount => integer() | nil,
          :state => String.t() | nil
        }

  field(:audience)
  field(:audienceDisplayName)
  field(:beginCreatingTime, as: DateTime)
  field(:creationQuotaTokensCharged)

  field(:dimensions, as: GoogleApi.AnalyticsData.V1beta.Model.V1betaAudienceDimension, type: :list)

  field(:errorMessage)
  field(:name)
  field(:percentageCompleted)
  field(:rowCount)
  field(:state)
end

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

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