# 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.SafeBrowsing.V4.Model.GoogleSecuritySafebrowsingV4RawHashes do
  @moduledoc """
  The uncompressed threat entries in hash format of a particular prefix length. Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 bytes, but some hashes are lengthened if they collide with the hash of a popular URL. Used for sending ThreatEntrySet to clients that do not support compression, or when sending non-4-byte hashes to clients that do support compression.

  ## Attributes

  *   `prefixSize` (*type:* `integer()`, *default:* `nil`) - The number of bytes for each prefix encoded below. This field can be anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
  *   `rawHashes` (*type:* `String.t`, *default:* `nil`) - The hashes, in binary format, concatenated into one long string. Hashes are sorted in lexicographic order. For JSON API users, hashes are base64-encoded.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :prefixSize => integer() | nil,
          :rawHashes => String.t() | nil
        }

  field(:prefixSize)
  field(:rawHashes)
end

defimpl Poison.Decoder, for: GoogleApi.SafeBrowsing.V4.Model.GoogleSecuritySafebrowsingV4RawHashes do
  def decode(value, options) do
    GoogleApi.SafeBrowsing.V4.Model.GoogleSecuritySafebrowsingV4RawHashes.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.SafeBrowsing.V4.Model.GoogleSecuritySafebrowsingV4RawHashes do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
