# 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.PropertyDefinition do
  @moduledoc """
  The definition of a property within an object.

  ## Attributes

  *   `booleanPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.BooleanPropertyOptions.t`, *default:* `nil`) - 
  *   `datePropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.DatePropertyOptions.t`, *default:* `nil`) - 
  *   `displayOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.PropertyDisplayOptions.t`, *default:* `nil`) - The options that determine how the property is displayed in the Cloud Search results page if it's specified to be displayed in the object's display options.
  *   `doublePropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.DoublePropertyOptions.t`, *default:* `nil`) - 
  *   `enumPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.EnumPropertyOptions.t`, *default:* `nil`) - 
  *   `htmlPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.HtmlPropertyOptions.t`, *default:* `nil`) - 
  *   `integerPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.IntegerPropertyOptions.t`, *default:* `nil`) - 
  *   `isFacetable` (*type:* `boolean()`, *default:* `nil`) - Indicates that the property can be used for generating facets. Cannot be true for properties whose type is object. IsReturnable must be true to set this option. Only supported for boolean, enum, integer, and text properties.
  *   `isRepeatable` (*type:* `boolean()`, *default:* `nil`) - Indicates that multiple values are allowed for the property. For example, a document only has one description but can have multiple comments. Cannot be true for properties whose type is a boolean. If set to false, properties that contain more than one value cause the indexing request for that item to be rejected.
  *   `isReturnable` (*type:* `boolean()`, *default:* `nil`) - Indicates that the property identifies data that should be returned in search results via the Query API. If set to *true*, indicates that Query API users can use matching property fields in results. However, storing fields requires more space allocation and uses more bandwidth for search queries, which impacts performance over large datasets. Set to *true* here only if the field is needed for search results. Cannot be true for properties whose type is an object.
  *   `isSortable` (*type:* `boolean()`, *default:* `nil`) - Indicates that the property can be used for sorting. Cannot be true for properties that are repeatable. Cannot be true for properties whose type is object. IsReturnable must be true to set this option. Only supported for boolean, date, double, integer, and timestamp properties.
  *   `isSuggestable` (*type:* `boolean()`, *default:* `nil`) - Indicates that the property can be used for generating query suggestions.
  *   `isWildcardSearchable` (*type:* `boolean()`, *default:* `nil`) - Indicates that users can perform wildcard search for this property. Only supported for Text properties. IsReturnable must be true to set this option. In a given datasource maximum of 5 properties can be marked as is_wildcard_searchable. For more details, see [Define object properties](https://developers.google.com/cloud-search/docs/guides/schema-guide#properties)
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the property. Item indexing requests sent to the Indexing API should set the property name equal to this value. For example, if name is *subject_line*, then indexing requests for document items with subject fields should set the name for that field equal to *subject_line*. Use the name as the identifier for the object property. Once registered as a property for an object, you cannot re-use this name for another property within that object. The name must start with a letter and can only contain letters (A-Z, a-z) or numbers (0-9). The maximum length is 256 characters.
  *   `objectPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.ObjectPropertyOptions.t`, *default:* `nil`) - 
  *   `textPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.TextPropertyOptions.t`, *default:* `nil`) - 
  *   `timestampPropertyOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.TimestampPropertyOptions.t`, *default:* `nil`) - 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :booleanPropertyOptions =>
            GoogleApi.CloudSearch.V1.Model.BooleanPropertyOptions.t() | nil,
          :datePropertyOptions => GoogleApi.CloudSearch.V1.Model.DatePropertyOptions.t() | nil,
          :displayOptions => GoogleApi.CloudSearch.V1.Model.PropertyDisplayOptions.t() | nil,
          :doublePropertyOptions =>
            GoogleApi.CloudSearch.V1.Model.DoublePropertyOptions.t() | nil,
          :enumPropertyOptions => GoogleApi.CloudSearch.V1.Model.EnumPropertyOptions.t() | nil,
          :htmlPropertyOptions => GoogleApi.CloudSearch.V1.Model.HtmlPropertyOptions.t() | nil,
          :integerPropertyOptions =>
            GoogleApi.CloudSearch.V1.Model.IntegerPropertyOptions.t() | nil,
          :isFacetable => boolean() | nil,
          :isRepeatable => boolean() | nil,
          :isReturnable => boolean() | nil,
          :isSortable => boolean() | nil,
          :isSuggestable => boolean() | nil,
          :isWildcardSearchable => boolean() | nil,
          :name => String.t() | nil,
          :objectPropertyOptions =>
            GoogleApi.CloudSearch.V1.Model.ObjectPropertyOptions.t() | nil,
          :textPropertyOptions => GoogleApi.CloudSearch.V1.Model.TextPropertyOptions.t() | nil,
          :timestampPropertyOptions =>
            GoogleApi.CloudSearch.V1.Model.TimestampPropertyOptions.t() | nil
        }

  field(:booleanPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.BooleanPropertyOptions)
  field(:datePropertyOptions, as: GoogleApi.CloudSearch.V1.Model.DatePropertyOptions)
  field(:displayOptions, as: GoogleApi.CloudSearch.V1.Model.PropertyDisplayOptions)
  field(:doublePropertyOptions, as: GoogleApi.CloudSearch.V1.Model.DoublePropertyOptions)
  field(:enumPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.EnumPropertyOptions)
  field(:htmlPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.HtmlPropertyOptions)
  field(:integerPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.IntegerPropertyOptions)
  field(:isFacetable)
  field(:isRepeatable)
  field(:isReturnable)
  field(:isSortable)
  field(:isSuggestable)
  field(:isWildcardSearchable)
  field(:name)
  field(:objectPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.ObjectPropertyOptions)
  field(:textPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.TextPropertyOptions)
  field(:timestampPropertyOptions, as: GoogleApi.CloudSearch.V1.Model.TimestampPropertyOptions)
end

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

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