# 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.Vault.V1.Model.Hold do
  @moduledoc """
  A hold. A hold prevents the specified Google Workspace service from purging data for specific accounts or all members of an organizational unit. To work with Vault resources, the account must have the [required Vault privileges] (https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.

  ## Attributes

  *   `accounts` (*type:* `list(GoogleApi.Vault.V1.Model.HeldAccount.t)`, *default:* `nil`) - If set, the hold applies to the specified accounts and **orgUnit** must be empty.
  *   `corpus` (*type:* `String.t`, *default:* `nil`) - The service to be searched.
  *   `holdId` (*type:* `String.t`, *default:* `nil`) - The unique immutable ID of the hold. Assigned during creation.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the hold.
  *   `orgUnit` (*type:* `GoogleApi.Vault.V1.Model.HeldOrgUnit.t`, *default:* `nil`) - If set, the hold applies to all members of the organizational unit and **accounts** must be empty. This property is mutable. For Groups holds, set **accounts**.
  *   `query` (*type:* `GoogleApi.Vault.V1.Model.CorpusQuery.t`, *default:* `nil`) - Service-specific options. If set, **CorpusQuery** must match **CorpusType**.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - The last time this hold was modified.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accounts => list(GoogleApi.Vault.V1.Model.HeldAccount.t()) | nil,
          :corpus => String.t() | nil,
          :holdId => String.t() | nil,
          :name => String.t() | nil,
          :orgUnit => GoogleApi.Vault.V1.Model.HeldOrgUnit.t() | nil,
          :query => GoogleApi.Vault.V1.Model.CorpusQuery.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:accounts, as: GoogleApi.Vault.V1.Model.HeldAccount, type: :list)
  field(:corpus)
  field(:holdId)
  field(:name)
  field(:orgUnit, as: GoogleApi.Vault.V1.Model.HeldOrgUnit)
  field(:query, as: GoogleApi.Vault.V1.Model.CorpusQuery)
  field(:updateTime, as: DateTime)
end

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

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