# 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.V1.Model.FhirStore do
  @moduledoc """
  Represents a FHIR store.

  ## Attributes

  *   `complexDataTypeReferenceParsing` (*type:* `String.t`, *default:* `nil`) - Optional. Enable parsing of references within complex FHIR data types such as Extensions. If this value is set to ENABLED, then features like referential integrity and Bundle reference rewriting apply to all references. If this flag has not been specified the behavior of the FHIR store will not change, references in complex data types will not be parsed. New stores will have this value set to ENABLED after a notification period. Warning: turning on this flag causes processing existing resources to fail if they contain references to non-existent resources.
  *   `defaultSearchHandlingStrict` (*type:* `boolean()`, *default:* `nil`) - Optional. If true, overrides the default search behavior for this FHIR store to `handling=strict` which returns an error for unrecognized search parameters. If false, uses the FHIR specification default `handling=lenient` which ignores unrecognized search parameters. The handling can always be changed from the default on an individual API call by setting the HTTP header `Prefer: handling=strict` or `Prefer: handling=lenient`. Defaults to false.
  *   `disableReferentialIntegrity` (*type:* `boolean()`, *default:* `nil`) - Immutable. Whether to disable referential integrity in this FHIR store. This field is immutable after FHIR store creation. The default value is false, meaning that the API enforces referential integrity and fails the requests that result in inconsistent state in the FHIR store. When this field is set to true, the API skips referential integrity checks. Consequently, operations that rely on references, such as GetPatientEverything, do not return all the results if broken references exist.
  *   `disableResourceVersioning` (*type:* `boolean()`, *default:* `nil`) - Immutable. Whether to disable resource versioning for this FHIR store. This field can not be changed after the creation of FHIR store. If set to false, all write operations cause historical versions to be recorded automatically. The historical versions can be fetched through the history APIs, but cannot be updated. If set to true, no historical versions are kept. The server sends errors for attempts to read the historical versions. Defaults to false.
  *   `enableUpdateCreate` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether this FHIR store has the [updateCreate capability](https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.rest.resource.updateCreate). This determines if the client can use an Update operation to create a new resource with a client-specified ID. If false, all IDs are server-assigned through the Create operation and attempts to update a non-existent resource return errors. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud audit logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. Defaults to false.
  *   `labels` (*type:* `map()`, *default:* `nil`) - User-supplied key-value pairs used to organize FHIR stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \\p{Ll}\\p{Lo}{0,62} Label values are optional, must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\\p{Ll}\\p{Lo}\\p{N}_-]{0,63} No more than 64 labels can be associated with a given store.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Identifier. Resource name of the FHIR store, of the form `projects/{project_id}/locations/{location}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
  *   `notificationConfig` (*type:* `GoogleApi.HealthCare.V1.Model.NotificationConfig.t`, *default:* `nil`) - Deprecated. Use `notification_configs` instead. If non-empty, publish all resource modifications of this FHIR store to this destination. The Pub/Sub message attributes contain a map with a string describing the action that has triggered the notification. For example, "action":"CreateResource".
  *   `notificationConfigs` (*type:* `list(GoogleApi.HealthCare.V1.Model.FhirNotificationConfig.t)`, *default:* `nil`) - Optional. Specifies where and whether to send notifications upon changes to a FHIR store.
  *   `streamConfigs` (*type:* `list(GoogleApi.HealthCare.V1.Model.StreamConfig.t)`, *default:* `nil`) - Optional. A list of streaming configs that configure the destinations of streaming export for every resource mutation in this FHIR store. Each store is allowed to have up to 10 streaming configs. After a new config is added, the next resource mutation is streamed to the new location in addition to the existing ones. When a location is removed from the list, the server stops streaming to that location. Before adding a new config, you must add the required [`bigquery.dataEditor`](https://cloud.google.com/bigquery/docs/access-control#bigquery.dataEditor) role to your project's **Cloud Healthcare Service Agent** [service account](https://cloud.google.com/iam/docs/service-accounts). Some lag (typically on the order of dozens of seconds) is expected before the results show up in the streaming destination.
  *   `validationConfig` (*type:* `GoogleApi.HealthCare.V1.Model.ValidationConfig.t`, *default:* `nil`) - Optional. Configuration for how to validate incoming FHIR resources against configured profiles.
  *   `version` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. The FHIR specification version that this FHIR store supports natively. This field is immutable after store creation. Requests are rejected if they contain FHIR resources of a different version. Version is required for every FHIR store.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :complexDataTypeReferenceParsing => String.t() | nil,
          :defaultSearchHandlingStrict => boolean() | nil,
          :disableReferentialIntegrity => boolean() | nil,
          :disableResourceVersioning => boolean() | nil,
          :enableUpdateCreate => boolean() | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :notificationConfig => GoogleApi.HealthCare.V1.Model.NotificationConfig.t() | nil,
          :notificationConfigs =>
            list(GoogleApi.HealthCare.V1.Model.FhirNotificationConfig.t()) | nil,
          :streamConfigs => list(GoogleApi.HealthCare.V1.Model.StreamConfig.t()) | nil,
          :validationConfig => GoogleApi.HealthCare.V1.Model.ValidationConfig.t() | nil,
          :version => String.t() | nil
        }

  field(:complexDataTypeReferenceParsing)
  field(:defaultSearchHandlingStrict)
  field(:disableReferentialIntegrity)
  field(:disableResourceVersioning)
  field(:enableUpdateCreate)
  field(:labels, type: :map)
  field(:name)
  field(:notificationConfig, as: GoogleApi.HealthCare.V1.Model.NotificationConfig)

  field(:notificationConfigs,
    as: GoogleApi.HealthCare.V1.Model.FhirNotificationConfig,
    type: :list
  )

  field(:streamConfigs, as: GoogleApi.HealthCare.V1.Model.StreamConfig, type: :list)
  field(:validationConfig, as: GoogleApi.HealthCare.V1.Model.ValidationConfig)
  field(:version)
end

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

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