# 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.AnalyticsReporting.V4.Model.Activity do
  @moduledoc """
  An Activity represents data for an activity of a user. Note that an Activity is different from a hit. A hit might result in multiple Activity's. For example, if a hit includes a transaction and a goal completion, there will be two Activity protos for this hit, one for ECOMMERCE and one for GOAL. Conversely, multiple hits can also construct one Activity. In classic e-commerce, data for one transaction might be sent through multiple hits. These hits will be merged into one ECOMMERCE Activity.

  ## Attributes

  *   `activityTime` (*type:* `DateTime.t`, *default:* `nil`) - Timestamp of the activity. If activities for a visit cross midnight and occur in two separate dates, then two sessions (one per date) share the session identifier. For example, say session ID 113472 has activity within 2019-08-20, and session ID 243742 has activity within 2019-08-25 and 2019-08-26. Session ID 113472 is one session, and session ID 243742 is two sessions.
  *   `activityType` (*type:* `String.t`, *default:* `nil`) - Type of this activity.
  *   `appview` (*type:* `GoogleApi.AnalyticsReporting.V4.Model.ScreenviewData.t`, *default:* `nil`) - This will be set if `activity_type` equals `SCREEN_VIEW`.
  *   `campaign` (*type:* `String.t`, *default:* `nil`) - For manual campaign tracking, it is the value of the utm_campaign campaign tracking parameter. For AdWords autotagging, it is the name(s) of the online ad campaign(s) you use for the property. If you use neither, its value is (not set).
  *   `channelGrouping` (*type:* `String.t`, *default:* `nil`) - The Channel Group associated with an end user's session for this View (defined by the View's Channel Groupings).
  *   `customDimension` (*type:* `list(GoogleApi.AnalyticsReporting.V4.Model.CustomDimension.t)`, *default:* `nil`) - A list of all custom dimensions associated with this activity.
  *   `ecommerce` (*type:* `GoogleApi.AnalyticsReporting.V4.Model.EcommerceData.t`, *default:* `nil`) - This will be set if `activity_type` equals `ECOMMERCE`.
  *   `event` (*type:* `GoogleApi.AnalyticsReporting.V4.Model.EventData.t`, *default:* `nil`) - This field contains all the details pertaining to an event and will be set if `activity_type` equals `EVENT`.
  *   `goals` (*type:* `GoogleApi.AnalyticsReporting.V4.Model.GoalSetData.t`, *default:* `nil`) - This field contains a list of all the goals that were reached in this activity when `activity_type` equals `GOAL`.
  *   `hostname` (*type:* `String.t`, *default:* `nil`) - The hostname from which the tracking request was made.
  *   `keyword` (*type:* `String.t`, *default:* `nil`) - For manual campaign tracking, it is the value of the utm_term campaign tracking parameter. For AdWords traffic, it contains the best matching targeting criteria. For the display network, where multiple targeting criteria could have caused the ad to show up, it returns the best matching targeting criteria as selected by Ads. This could be display_keyword, site placement, boomuserlist, user_interest, age, or gender. Otherwise its value is (not set).
  *   `landingPagePath` (*type:* `String.t`, *default:* `nil`) - The first page in users' sessions, or the landing page.
  *   `medium` (*type:* `String.t`, *default:* `nil`) - The type of referrals. For manual campaign tracking, it is the value of the utm_medium campaign tracking parameter. For AdWords autotagging, it is cpc. If users came from a search engine detected by Google Analytics, it is organic. If the referrer is not a search engine, it is referral. If users came directly to the property and document.referrer is empty, its value is (none).
  *   `pageview` (*type:* `GoogleApi.AnalyticsReporting.V4.Model.PageviewData.t`, *default:* `nil`) - This will be set if `activity_type` equals `PAGEVIEW`. This field contains all the details about the visitor and the page that was visited.
  *   `source` (*type:* `String.t`, *default:* `nil`) - The source of referrals. For manual campaign tracking, it is the value of the utm_source campaign tracking parameter. For AdWords autotagging, it is google. If you use neither, it is the domain of the source (e.g., document.referrer) referring the users. It may also contain a port address. If users arrived without a referrer, its value is (direct).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :activityTime => DateTime.t() | nil,
          :activityType => String.t() | nil,
          :appview => GoogleApi.AnalyticsReporting.V4.Model.ScreenviewData.t() | nil,
          :campaign => String.t() | nil,
          :channelGrouping => String.t() | nil,
          :customDimension =>
            list(GoogleApi.AnalyticsReporting.V4.Model.CustomDimension.t()) | nil,
          :ecommerce => GoogleApi.AnalyticsReporting.V4.Model.EcommerceData.t() | nil,
          :event => GoogleApi.AnalyticsReporting.V4.Model.EventData.t() | nil,
          :goals => GoogleApi.AnalyticsReporting.V4.Model.GoalSetData.t() | nil,
          :hostname => String.t() | nil,
          :keyword => String.t() | nil,
          :landingPagePath => String.t() | nil,
          :medium => String.t() | nil,
          :pageview => GoogleApi.AnalyticsReporting.V4.Model.PageviewData.t() | nil,
          :source => String.t() | nil
        }

  field(:activityTime, as: DateTime)
  field(:activityType)
  field(:appview, as: GoogleApi.AnalyticsReporting.V4.Model.ScreenviewData)
  field(:campaign)
  field(:channelGrouping)
  field(:customDimension, as: GoogleApi.AnalyticsReporting.V4.Model.CustomDimension, type: :list)
  field(:ecommerce, as: GoogleApi.AnalyticsReporting.V4.Model.EcommerceData)
  field(:event, as: GoogleApi.AnalyticsReporting.V4.Model.EventData)
  field(:goals, as: GoogleApi.AnalyticsReporting.V4.Model.GoalSetData)
  field(:hostname)
  field(:keyword)
  field(:landingPagePath)
  field(:medium)
  field(:pageview, as: GoogleApi.AnalyticsReporting.V4.Model.PageviewData)
  field(:source)
end

defimpl Poison.Decoder, for: GoogleApi.AnalyticsReporting.V4.Model.Activity do
  def decode(value, options) do
    GoogleApi.AnalyticsReporting.V4.Model.Activity.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AnalyticsReporting.V4.Model.Activity do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
