# 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.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnalysisRule do
  @moduledoc """
  The CCAI Insights project wide analysis rule. This rule will be applied to all conversations that match the filter defined in the rule. For a conversation matches the filter, the annotators specified in the rule will be run. If a conversation matches multiple rules, a union of all the annotators will be run. One project can have multiple analysis rules.

  ## Attributes

  *   `active` (*type:* `boolean()`, *default:* `nil`) - If true, apply this rule to conversations. Otherwise, this rule is inactive and saved as a draft.
  *   `analysisPercentage` (*type:* `float()`, *default:* `nil`) - Percentage of conversations that we should apply this analysis setting automatically, between [0, 1]. For example, 0.1 means 10%. Conversations are sampled in a determenestic way. The original runtime_percentage & upload percentage will be replaced by defining filters on the conversation.
  *   `annotatorSelector` (*type:* `GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnnotatorSelector.t`, *default:* `nil`) - Selector of annotators to run and the phrase matchers to use for conversations that matches the conversation_filter. If not specified, NO annotators will be run.
  *   `conversationFilter` (*type:* `String.t`, *default:* `nil`) - Filter for the conversations that should apply this analysis rule. An empty filter means this analysis rule applies to all conversations.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which this analysis rule was created.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Display Name of the analysis rule.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. The resource name of the analysis rule. Format: projects/{project}/locations/{location}/analysisRules/{analysis_rule}
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The most recent time at which this analysis rule was updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :active => boolean() | nil,
          :analysisPercentage => float() | nil,
          :annotatorSelector =>
            GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnnotatorSelector.t()
            | nil,
          :conversationFilter => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :displayName => String.t() | nil,
          :name => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:active)
  field(:analysisPercentage)

  field(:annotatorSelector,
    as:
      GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnnotatorSelector
  )

  field(:conversationFilter)
  field(:createTime, as: DateTime)
  field(:displayName)
  field(:name)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder,
  for: GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnalysisRule do
  def decode(value, options) do
    GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnalysisRule.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1AnalysisRule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
