content: {-# LANGUAGE DataKinds #-}
  {-# LANGUAGE DerivingStrategies #-}
  {-# LANGUAGE DuplicateRecordFields #-}
  {-# LANGUAGE ImportQualifiedPost #-}
  {-# LANGUAGE LambdaCase #-}
  {-# LANGUAGE OverloadedStrings #-}
  {-# LANGUAGE PatternSynonyms #-}
  {-# LANGUAGE RecordWildCards #-}
  {-# LANGUAGE StrictData #-}
  {-# LANGUAGE TypeFamilies #-}
  {-# LANGUAGE NoImplicitPrelude #-}
  {-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
  {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
  {-# OPTIONS_GHC -fno-warn-unused-binds #-}
  {-# OPTIONS_GHC -fno-warn-unused-imports #-}
  {-# OPTIONS_GHC -fno-warn-unused-matches #-}
  
  -- |
  -- Module      : Gogol.Healthcare.Projects.Locations.Datasets.FhirStores.Fhir.Bulkexport
  -- Copyright   : (c) 2015-2025 Brendan Hay
  -- License     : Mozilla Public License, v. 2.0.
  -- Maintainer  : Brendan Hay <brendan.g.hay+gogol@gmail.com>
  --               Toni Cebrián <toni@tonicebrian.com>
  -- Stability   : auto-generated
  -- Portability : non-portable (GHC extensions)
  --
  -- Bulk exports all resources from the FHIR store to the specified destination. Implements the FHIR implementation guide [system level $export](https:\/\/build.fhir.org\/ig\/HL7\/bulk-data\/export.html#endpoint---system-level-export. The following headers must be set in the request: * @Accept@: specifies the format of the @OperationOutcome@ response. Only @application\/fhir+json@ is supported. * @Prefer@: specifies whether the response is immediate or asynchronous. Must be to @respond-async@ because only asynchronous responses are supported. Specify the destination for the server to write result files by setting the Cloud Storage location bulk/export/gcs/destination on the FHIR store. URI of an existing Cloud Storage directory where the server writes result files, in the format gs:\/\/{bucket-id}\/{path\/to\/destination\/dir}. If there is no trailing slash, the service appends one when composing the object path. The user is responsible for creating the Cloud Storage bucket referenced. Supports the following
  -- query parameters: * @_type@: string of comma-delimited FHIR resource types. If provided, only the resources of the specified type(s) are exported. * @_since@: if provided, only the resources that are updated after the specified time are exported. * @_outputFormat@: optional, specify ndjson to export data in NDJSON format. Exported file names use the format: {export/id}/{resource/type}.ndjson. On success, the @Content-Location@ header of the response is set to a URL that the user can use to query the status of the export. The URL is in the format: @projects\/{project_id}\/locations\/{location_id}\/datasets\/{dataset_id}\/fhirStores\/{fhir_store_id}\/operations\/{export_id}@. See get-fhir-operation-status for more information. Errors generated by the FHIR store contain a JSON-encoded @OperationOutcome@ resource describing the reason for the error.
  --
  -- /See:/ <https://cloud.google.com/healthcare Cloud Healthcare API Reference> for @healthcare.projects.locations.datasets.fhirStores.fhir.bulkexport@.
  module Gogol.Healthcare.Projects.Locations.Datasets.FhirStores.Fhir.Bulkexport
    ( -- * Resource
      HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexportResource,
  
      -- ** Constructing a Request
      HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport (..),
      newHealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport,
    )
  where
  
  import Gogol.Healthcare.Types
  import Gogol.Prelude qualified as Core
  
  -- | A resource alias for @healthcare.projects.locations.datasets.fhirStores.fhir.bulkexport@ method which the
  -- 'HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport' request conforms to.
  type HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexportResource =
    "v1"
      Core.:> Core.Capture "name" Core.Text
      Core.:> "fhir"
      Core.:> "$export"
      Core.:> Core.QueryParam "$.xgafv" Xgafv
      Core.:> Core.QueryParam "_since" Core.Text
      Core.:> Core.QueryParam "_type" Core.Text
      Core.:> Core.QueryParam "access_token" Core.Text
      Core.:> Core.QueryParam "callback" Core.Text
      Core.:> Core.QueryParam "outputFormat" Core.Text
      Core.:> Core.QueryParam "uploadType" Core.Text
      Core.:> Core.QueryParam "upload_protocol" Core.Text
      Core.:> Core.QueryParam "alt" Core.AltJSON
      Core.:> Core.Get '[Core.JSON] HttpBody
  
  -- | Bulk exports all resources from the FHIR store to the specified destination. Implements the FHIR implementation guide [system level $export](https:\/\/build.fhir.org\/ig\/HL7\/bulk-data\/export.html#endpoint---system-level-export. The following headers must be set in the request: * @Accept@: specifies the format of the @OperationOutcome@ response. Only @application\/fhir+json@ is supported. * @Prefer@: specifies whether the response is immediate or asynchronous. Must be to @respond-async@ because only asynchronous responses are supported. Specify the destination for the server to write result files by setting the Cloud Storage location bulk/export/gcs/destination on the FHIR store. URI of an existing Cloud Storage directory where the server writes result files, in the format gs:\/\/{bucket-id}\/{path\/to\/destination\/dir}. If there is no trailing slash, the service appends one when composing the object path. The user is responsible for creating the Cloud Storage bucket referenced. Supports the following
  -- query parameters: * @_type@: string of comma-delimited FHIR resource types. If provided, only the resources of the specified type(s) are exported. * @_since@: if provided, only the resources that are updated after the specified time are exported. * @_outputFormat@: optional, specify ndjson to export data in NDJSON format. Exported file names use the format: {export/id}/{resource/type}.ndjson. On success, the @Content-Location@ header of the response is set to a URL that the user can use to query the status of the export. The URL is in the format: @projects\/{project_id}\/locations\/{location_id}\/datasets\/{dataset_id}\/fhirStores\/{fhir_store_id}\/operations\/{export_id}@. See get-fhir-operation-status for more information. Errors generated by the FHIR store contain a JSON-encoded @OperationOutcome@ resource describing the reason for the error.
  --
  -- /See:/ 'newHealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport' smart constructor.
  data HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport = HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport
    { -- | V1 error format.
      xgafv :: (Core.Maybe Xgafv),
      -- | Optional. If provided, only resources updated after this time are exported. The time uses the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. For example, @2015-02-07T13:28:17.239+02:00@ or @2017-01-01T00:00:00Z@. The time must be specified to the second and include a time zone.
      since :: (Core.Maybe Core.Text),
      -- | Optional. String of comma-delimited FHIR resource types. If provided, only resources of the specified resource type(s) are exported.
      type' :: (Core.Maybe Core.Text),
      -- | OAuth access token.
      accessToken :: (Core.Maybe Core.Text),
      -- | JSONP
      callback :: (Core.Maybe Core.Text),
      -- | Required. The name of the FHIR store to export resources from, in the format @projects\/{project_id}\/locations\/{location_id}\/datasets\/{dataset_id}\/fhirStores\/{fhir_store_id}@.
      name :: Core.Text,
      -- | Optional. Output format of the export. This field is optional and only @application\/fhir+ndjson@ is supported.
      outputFormat :: (Core.Maybe Core.Text),
      -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
      uploadType :: (Core.Maybe Core.Text),
      -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
      uploadProtocol :: (Core.Maybe Core.Text)
    }
    deriving (Core.Eq, Core.Show, Core.Generic)
  
  -- | Creates a value of 'HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport' with the minimum fields required to make a request.
  newHealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport ::
    -- |  Required. The name of the FHIR store to export resources from, in the format @projects\/{project_id}\/locations\/{location_id}\/datasets\/{dataset_id}\/fhirStores\/{fhir_store_id}@. See 'name'.
    Core.Text ->
    HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport
  newHealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport name =
    HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport
      { xgafv =
          Core.Nothing,
        since = Core.Nothing,
        type' = Core.Nothing,
        accessToken = Core.Nothing,
        callback = Core.Nothing,
        name = name,
        outputFormat = Core.Nothing,
        uploadType = Core.Nothing,
        uploadProtocol = Core.Nothing
      }
  
  instance
    Core.GoogleRequest
      HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport
    where
    type
      Rs HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport =
        HttpBody
    type
      Scopes
        HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport =
        '[CloudHealthcare'FullControl, CloudPlatform'FullControl]
    requestClient
      HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexport {..} =
        go
          name
          xgafv
          since
          type'
          accessToken
          callback
          outputFormat
          uploadType
          uploadProtocol
          (Core.Just Core.AltJSON)
          healthcareService
        where
          go =
            Core.buildClient
              ( Core.Proxy ::
                  Core.Proxy
                    HealthcareProjectsLocationsDatasetsFhirStoresFhirBulkexportResource
              )
              Core.mempty
  