# 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.DataSource do
  @moduledoc """
  Datasource is a logical namespace for items to be indexed. All items must belong to a datasource. This is the prerequisite before items can be indexed into Cloud Search. 

  ## Attributes

  *   `disableModifications` (*type:* `boolean()`, *default:* `nil`) - If true, sets the datasource to read-only mode. In read-only mode, the Indexing API rejects any requests to index or delete items in this source. Enabling read-only mode does not stop the processing of previously accepted data.
  *   `disableServing` (*type:* `boolean()`, *default:* `nil`) - Disable serving any search or assist results.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. Display name of the datasource The maximum length is 300 characters.
  *   `indexingServiceAccounts` (*type:* `list(String.t)`, *default:* `nil`) - List of service accounts that have indexing access.
  *   `itemsVisibility` (*type:* `list(GoogleApi.CloudSearch.V1.Model.GSuitePrincipal.t)`, *default:* `nil`) - This field restricts visibility to items at the datasource level. Items within the datasource are restricted to the union of users and groups included in this field. Note that, this does not ensure access to a specific item, as users need to have ACL permissions on the contained items. This ensures a high level access on the entire datasource, and that the individual items are not shared outside this visibility.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the datasource resource. Format: datasources/{source_id}. The name is ignored when creating a datasource.
  *   `operationIds` (*type:* `list(String.t)`, *default:* `nil`) - IDs of the Long Running Operations (LROs) currently running for this schema.
  *   `returnThumbnailUrls` (*type:* `boolean()`, *default:* `nil`) - Can a user request to get thumbnail URI for Items indexed in this data source.
  *   `shortName` (*type:* `String.t`, *default:* `nil`) - A short name or alias for the source. This value will be used to match the 'source' operator. For example, if the short name is *<value>* then queries like *source:<value>* will only return results for this source. The value must be unique across all datasources. The value must only contain alphanumeric characters (a-zA-Z0-9). The value cannot start with 'google' and cannot be one of the following: mail, gmail, docs, drive, groups, sites, calendar, hangouts, gplus, keep, people, teams. Its maximum length is 32 characters.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :disableModifications => boolean() | nil,
          :disableServing => boolean() | nil,
          :displayName => String.t() | nil,
          :indexingServiceAccounts => list(String.t()) | nil,
          :itemsVisibility => list(GoogleApi.CloudSearch.V1.Model.GSuitePrincipal.t()) | nil,
          :name => String.t() | nil,
          :operationIds => list(String.t()) | nil,
          :returnThumbnailUrls => boolean() | nil,
          :shortName => String.t() | nil
        }

  field(:disableModifications)
  field(:disableServing)
  field(:displayName)
  field(:indexingServiceAccounts, type: :list)
  field(:itemsVisibility, as: GoogleApi.CloudSearch.V1.Model.GSuitePrincipal, type: :list)
  field(:name)
  field(:operationIds, type: :list)
  field(:returnThumbnailUrls)
  field(:shortName)
end

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

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