# 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.TagManager.V2.Model.Trigger do
  @moduledoc """
  Represents a Google Tag Manager Trigger

  ## Attributes

  *   `accountId` (*type:* `String.t`, *default:* `nil`) - GTM Account ID.
  *   `autoEventFilter` (*type:* `list(GoogleApi.TagManager.V2.Model.Condition.t)`, *default:* `nil`) - Used in the case of auto event tracking.
  *   `checkValidation` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Whether or not we should only fire tags if the form submit or link click event is not cancelled by some other event handler (e.g. because of validation). Only valid for Form Submission and Link Click triggers.
  *   `containerId` (*type:* `String.t`, *default:* `nil`) - GTM Container ID.
  *   `continuousTimeMinMilliseconds` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - A visibility trigger minimum continuous visible time (in milliseconds). Only valid for AMP Visibility trigger.
  *   `customEventFilter` (*type:* `list(GoogleApi.TagManager.V2.Model.Condition.t)`, *default:* `nil`) - Used in the case of custom event, which is fired iff all Conditions are true.
  *   `eventName` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Name of the GTM event that is fired. Only valid for Timer triggers.
  *   `filter` (*type:* `list(GoogleApi.TagManager.V2.Model.Condition.t)`, *default:* `nil`) - The trigger will only fire iff all Conditions are true.
  *   `fingerprint` (*type:* `String.t`, *default:* `nil`) - The fingerprint of the GTM Trigger as computed at storage time. This value is recomputed whenever the trigger is modified.
  *   `horizontalScrollPercentageList` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - List of integer percentage values for scroll triggers. The trigger will fire when each percentage is reached when the view is scrolled horizontally. Only valid for AMP scroll triggers.
  *   `interval` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Time between triggering recurring Timer Events (in milliseconds). Only valid for Timer triggers.
  *   `intervalSeconds` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Time between Timer Events to fire (in seconds). Only valid for AMP Timer trigger.
  *   `limit` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Limit of the number of GTM events this Timer Trigger will fire. If no limit is set, we will continue to fire GTM events until the user leaves the page. Only valid for Timer triggers.
  *   `maxTimerLengthSeconds` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Max time to fire Timer Events (in seconds). Only valid for AMP Timer trigger.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Trigger display name.
  *   `notes` (*type:* `String.t`, *default:* `nil`) - User notes on how to apply this trigger in the container.
  *   `parameter` (*type:* `list(GoogleApi.TagManager.V2.Model.Parameter.t)`, *default:* `nil`) - Additional parameters.
  *   `parentFolderId` (*type:* `String.t`, *default:* `nil`) - Parent folder id.
  *   `path` (*type:* `String.t`, *default:* `nil`) - GTM Trigger's API relative path.
  *   `selector` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - A click trigger CSS selector (i.e. "a", "button" etc.). Only valid for AMP Click trigger.
  *   `tagManagerUrl` (*type:* `String.t`, *default:* `nil`) - Auto generated link to the tag manager UI
  *   `totalTimeMinMilliseconds` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - A visibility trigger minimum total visible time (in milliseconds). Only valid for AMP Visibility trigger.
  *   `triggerId` (*type:* `String.t`, *default:* `nil`) - The Trigger ID uniquely identifies the GTM Trigger.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Defines the data layer event that causes this trigger.
  *   `uniqueTriggerId` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Globally unique id of the trigger that auto-generates this (a Form Submit, Link Click or Timer listener) if any. Used to make incompatible auto-events work together with trigger filtering based on trigger ids. This value is populated during output generation since the tags implied by triggers don't exist until then. Only valid for Form Submit, Link Click and Timer triggers.
  *   `verticalScrollPercentageList` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - List of integer percentage values for scroll triggers. The trigger will fire when each percentage is reached when the view is scrolled vertically. Only valid for AMP scroll triggers.
  *   `visibilitySelector` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - A visibility trigger CSS selector (i.e. "#id"). Only valid for AMP Visibility trigger.
  *   `visiblePercentageMax` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - A visibility trigger maximum percent visibility. Only valid for AMP Visibility trigger.
  *   `visiblePercentageMin` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - A visibility trigger minimum percent visibility. Only valid for AMP Visibility trigger.
  *   `waitForTags` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - Whether or not we should delay the form submissions or link opening until all of the tags have fired (by preventing the default action and later simulating the default action). Only valid for Form Submission and Link Click triggers.
  *   `waitForTagsTimeout` (*type:* `GoogleApi.TagManager.V2.Model.Parameter.t`, *default:* `nil`) - How long to wait (in milliseconds) for tags to fire when 'waits_for_tags' above evaluates to true. Only valid for Form Submission and Link Click triggers.
  *   `workspaceId` (*type:* `String.t`, *default:* `nil`) - GTM Workspace ID.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accountId => String.t() | nil,
          :autoEventFilter => list(GoogleApi.TagManager.V2.Model.Condition.t()) | nil,
          :checkValidation => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :containerId => String.t() | nil,
          :continuousTimeMinMilliseconds => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :customEventFilter => list(GoogleApi.TagManager.V2.Model.Condition.t()) | nil,
          :eventName => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :filter => list(GoogleApi.TagManager.V2.Model.Condition.t()) | nil,
          :fingerprint => String.t() | nil,
          :horizontalScrollPercentageList => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :interval => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :intervalSeconds => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :limit => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :maxTimerLengthSeconds => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :name => String.t() | nil,
          :notes => String.t() | nil,
          :parameter => list(GoogleApi.TagManager.V2.Model.Parameter.t()) | nil,
          :parentFolderId => String.t() | nil,
          :path => String.t() | nil,
          :selector => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :tagManagerUrl => String.t() | nil,
          :totalTimeMinMilliseconds => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :triggerId => String.t() | nil,
          :type => String.t() | nil,
          :uniqueTriggerId => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :verticalScrollPercentageList => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :visibilitySelector => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :visiblePercentageMax => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :visiblePercentageMin => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :waitForTags => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :waitForTagsTimeout => GoogleApi.TagManager.V2.Model.Parameter.t() | nil,
          :workspaceId => String.t() | nil
        }

  field(:accountId)
  field(:autoEventFilter, as: GoogleApi.TagManager.V2.Model.Condition, type: :list)
  field(:checkValidation, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:containerId)
  field(:continuousTimeMinMilliseconds, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:customEventFilter, as: GoogleApi.TagManager.V2.Model.Condition, type: :list)
  field(:eventName, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:filter, as: GoogleApi.TagManager.V2.Model.Condition, type: :list)
  field(:fingerprint)
  field(:horizontalScrollPercentageList, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:interval, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:intervalSeconds, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:limit, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:maxTimerLengthSeconds, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:name)
  field(:notes)
  field(:parameter, as: GoogleApi.TagManager.V2.Model.Parameter, type: :list)
  field(:parentFolderId)
  field(:path)
  field(:selector, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:tagManagerUrl)
  field(:totalTimeMinMilliseconds, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:triggerId)
  field(:type)
  field(:uniqueTriggerId, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:verticalScrollPercentageList, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:visibilitySelector, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:visiblePercentageMax, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:visiblePercentageMin, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:waitForTags, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:waitForTagsTimeout, as: GoogleApi.TagManager.V2.Model.Parameter)
  field(:workspaceId)
end

defimpl Poison.Decoder, for: GoogleApi.TagManager.V2.Model.Trigger do
  def decode(value, options) do
    GoogleApi.TagManager.V2.Model.Trigger.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.TagManager.V2.Model.Trigger do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
