# 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.CloudSearch.V1.Model.Context do
  @moduledoc """


  ## Attributes

  *   `app` (*type:* `list(String.t)`, *default:* `nil`) - [Optional] App where the card should be shown. If missing, the card will be shown in TOPAZ.
  *   `dayOfWeek` (*type:* `list(integer())`, *default:* `nil`) - [Optional] Day of week when the card should be shown, where 0 is Monday.
  *   `endDateSec` (*type:* `String.t`, *default:* `nil`) - [Optional] Date (in seconds since epoch) when the card should stop being shown. If missing, end_date_sec will be set to Jan 1st, 2100.
  *   `endDayOffsetSec` (*type:* `String.t`, *default:* `nil`) - [Optional] End time in seconds, within a day, when the card should stop being shown if it's within [start_date_sec, end_date_sec]. If missing, this is set to 86400 (24 hours x 3600 sec/hour), i.e., midnight next day.
  *   `locale` (*type:* `list(String.t)`, *default:* `nil`) - [Optional] The locales for which the card should be triggered (e.g., en_US and en_CA). If missing, the card is going to show to clients regardless of their locale.
  *   `location` (*type:* `list(String.t)`, *default:* `nil`) - [Optional] Text-free locations where the card should be shown. This is expected to match the user's location in focus. If no location is specified, the card will be shown for any location.
  *   `query` (*type:* `list(String.t)`, *default:* `nil`) - [Required only for Answer and RHS cards - will be ignored for Homepage] cards. It's the exact case-insensitive queries that will trigger the Answer or RHS card.
  *   `startDateSec` (*type:* `String.t`, *default:* `nil`) - [Optional] Date (in seconds since epoch) when the card should start being shown. If missing, start_date_sec will be Jan 1st, 1970 UTC.
  *   `startDayOffsetSec` (*type:* `String.t`, *default:* `nil`) - [Optional] Start time in seconds, within a day, when the card should be shown if it's within [start_date_sec, end_date_sec]. If 0, the card will be shown from 12:00am on.
  *   `surface` (*type:* `list(String.t)`, *default:* `nil`) - [Optional] Surface where the card should be shown in. If missing, the card will be shown in any surface.
  *   `type` (*type:* `list(String.t)`, *default:* `nil`) - [Required] Type of the card (homepage, Answer or RHS).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :app => list(String.t()) | nil,
          :dayOfWeek => list(integer()) | nil,
          :endDateSec => String.t() | nil,
          :endDayOffsetSec => String.t() | nil,
          :locale => list(String.t()) | nil,
          :location => list(String.t()) | nil,
          :query => list(String.t()) | nil,
          :startDateSec => String.t() | nil,
          :startDayOffsetSec => String.t() | nil,
          :surface => list(String.t()) | nil,
          :type => list(String.t()) | nil
        }

  field(:app, type: :list)
  field(:dayOfWeek, type: :list)
  field(:endDateSec)
  field(:endDayOffsetSec)
  field(:locale, type: :list)
  field(:location, type: :list)
  field(:query, type: :list)
  field(:startDateSec)
  field(:startDayOffsetSec)
  field(:surface, type: :list)
  field(:type, type: :list)
end

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

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