# 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.HealthCare.V1beta1.Model.ConsentConfig do
  @moduledoc """
  Configures whether to enforce consent for the FHIR store and which consent enforcement version is being used.

  ## Attributes

  *   `accessDeterminationLogConfig` (*type:* `GoogleApi.HealthCare.V1beta1.Model.AccessDeterminationLogConfig.t`, *default:* `nil`) - Optional. Specifies how the server logs the consent-aware requests. If not specified, the `AccessDeterminationLogConfig.LogLevel.MINIMUM` option is used.
  *   `accessEnforced` (*type:* `boolean()`, *default:* `nil`) - Optional. The default value is false. If set to true, when accessing FHIR resources, the consent headers will be verified against consents given by patients. See the ConsentEnforcementVersion for the supported consent headers.
  *   `consentHeaderHandling` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ConsentHeaderHandling.t`, *default:* `nil`) - Optional. Different options to configure the behaviour of the server when handling the `X-Consent-Scope` header.
  *   `enforcedAdminConsents` (*type:* `list(String.t)`, *default:* `nil`) - The versioned names of the enforced admin Consent resource(s), in the format `projects/{project_id}/locations/{location}/datasets/{dataset_id}/fhirStores/{fhir_store_id}/fhir/Consent/{resource_id}/_history/{version_id}`. For FHIR stores with `disable_resource_versioning=true`, the format is `projects/{project_id}/locations/{location}/datasets/{dataset_id}/fhirStores/{fhir_store_id}/fhir/Consent/{resource_id}`. This field can only be updated using ApplyAdminConsents.
  *   `version` (*type:* `String.t`, *default:* `nil`) - Required. Specifies which consent enforcement version is being used for this FHIR store. This field can only be set once by either CreateFhirStore or UpdateFhirStore. After that, you must call ApplyConsents to change the version.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accessDeterminationLogConfig =>
            GoogleApi.HealthCare.V1beta1.Model.AccessDeterminationLogConfig.t() | nil,
          :accessEnforced => boolean() | nil,
          :consentHeaderHandling =>
            GoogleApi.HealthCare.V1beta1.Model.ConsentHeaderHandling.t() | nil,
          :enforcedAdminConsents => list(String.t()) | nil,
          :version => String.t() | nil
        }

  field(:accessDeterminationLogConfig,
    as: GoogleApi.HealthCare.V1beta1.Model.AccessDeterminationLogConfig
  )

  field(:accessEnforced)
  field(:consentHeaderHandling, as: GoogleApi.HealthCare.V1beta1.Model.ConsentHeaderHandling)
  field(:enforcedAdminConsents, type: :list)
  field(:version)
end

defimpl Poison.Decoder, for: GoogleApi.HealthCare.V1beta1.Model.ConsentConfig do
  def decode(value, options) do
    GoogleApi.HealthCare.V1beta1.Model.ConsentConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.HealthCare.V1beta1.Model.ConsentConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
