{-# LANGUAGE DataKinds          #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE FlexibleInstances  #-}
{-# LANGUAGE NoImplicitPrelude  #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}
{-# LANGUAGE TypeFamilies       #-}
{-# LANGUAGE TypeOperators      #-}

{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds      #-}
{-# OPTIONS_GHC -fno-warn-unused-imports    #-}

-- |
-- Module      : Network.Google.Resource.Healthcare.Projects.Locations.DataSets.FhirStores.Fhir.PatientEverything
-- Copyright   : (c) 2015-2016 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a Patient resource and resources related to that patient.
-- Implements the FHIR extended operation Patient-everything
-- ([DSTU2](http:\/\/hl7.org\/implement\/standards\/fhir\/DSTU2\/patient-operations.html#everything),
-- [STU3](http:\/\/hl7.org\/implement\/standards\/fhir\/STU3\/patient-operations.html#everything),
-- [R4](http:\/\/hl7.org\/implement\/standards\/fhir\/R4\/patient-operations.html#everything)).
-- On success, the response body contains a JSON-encoded representation of
-- a \`Bundle\` resource of type \`searchset\`, containing the results of
-- the operation. Errors generated by the FHIR store contain a JSON-encoded
-- \`OperationOutcome\` resource describing the reason for the error. If
-- the request cannot be mapped to a valid API method on a FHIR store, a
-- generic GCP error might be returned instead. The resources in scope for
-- the response are: * The patient resource itself. * All the resources
-- directly referenced by the patient resource. * Resources directly
-- referencing the patient resource that meet the inclusion criteria. The
-- inclusion criteria are based on the membership rules in the patient
-- compartment definition
-- ([DSTU2](http:\/\/hl7.org\/fhir\/DSTU2\/compartment-patient.html),
-- [STU3](http:\/\/www.hl7.org\/fhir\/stu3\/compartmentdefinition-patient.html),
-- [R4](http:\/\/hl7.org\/fhir\/R4\/compartmentdefinition-patient.html)),
-- which details the eligible resource types and referencing search
-- parameters. For samples that show how to call \`Patient-everything\`,
-- see [Getting all patient compartment
-- resources](\/healthcare\/docs\/how-tos\/fhir-resources#getting_all_patient_compartment_resources).
--
-- /See:/ <https://cloud.google.com/healthcare Cloud Healthcare API Reference> for @healthcare.projects.locations.datasets.fhirStores.fhir.Patient-everything@.
module Network.Google.Resource.Healthcare.Projects.Locations.DataSets.FhirStores.Fhir.PatientEverything
    (
    -- * REST Resource
      ProjectsLocationsDataSetsFhirStoresFhirPatientEverythingResource

    -- * Creating a Request
    , projectsLocationsDataSetsFhirStoresFhirPatientEverything
    , ProjectsLocationsDataSetsFhirStoresFhirPatientEverything

    -- * Request Lenses
    , pldsfsfpeXgafv
    , pldsfsfpeCount
    , pldsfsfpeType
    , pldsfsfpeUploadProtocol
    , pldsfsfpeAccessToken
    , pldsfsfpeStart
    , pldsfsfpeUploadType
    , pldsfsfpeName
    , pldsfsfpeEnd
    , pldsfsfpeSince
    , pldsfsfpePageToken
    , pldsfsfpeCallback
    ) where

import Network.Google.Healthcare.Types
import Network.Google.Prelude

-- | A resource alias for @healthcare.projects.locations.datasets.fhirStores.fhir.Patient-everything@ method which the
-- 'ProjectsLocationsDataSetsFhirStoresFhirPatientEverything' request conforms to.
type ProjectsLocationsDataSetsFhirStoresFhirPatientEverythingResource
     =
     "v1" :>
       Capture "name" Text :>
         "$everything" :>
           QueryParam "$.xgafv" Xgafv :>
             QueryParam "_count" (Textual Int32) :>
               QueryParam "_type" Text :>
                 QueryParam "upload_protocol" Text :>
                   QueryParam "access_token" Text :>
                     QueryParam "start" Text :>
                       QueryParam "uploadType" Text :>
                         QueryParam "end" Text :>
                           QueryParam "_since" Text :>
                             QueryParam "_page_token" Text :>
                               QueryParam "callback" Text :>
                                 QueryParam "alt" AltJSON :>
                                   Get '[JSON] HTTPBody

-- | Retrieves a Patient resource and resources related to that patient.
-- Implements the FHIR extended operation Patient-everything
-- ([DSTU2](http:\/\/hl7.org\/implement\/standards\/fhir\/DSTU2\/patient-operations.html#everything),
-- [STU3](http:\/\/hl7.org\/implement\/standards\/fhir\/STU3\/patient-operations.html#everything),
-- [R4](http:\/\/hl7.org\/implement\/standards\/fhir\/R4\/patient-operations.html#everything)).
-- On success, the response body contains a JSON-encoded representation of
-- a \`Bundle\` resource of type \`searchset\`, containing the results of
-- the operation. Errors generated by the FHIR store contain a JSON-encoded
-- \`OperationOutcome\` resource describing the reason for the error. If
-- the request cannot be mapped to a valid API method on a FHIR store, a
-- generic GCP error might be returned instead. The resources in scope for
-- the response are: * The patient resource itself. * All the resources
-- directly referenced by the patient resource. * Resources directly
-- referencing the patient resource that meet the inclusion criteria. The
-- inclusion criteria are based on the membership rules in the patient
-- compartment definition
-- ([DSTU2](http:\/\/hl7.org\/fhir\/DSTU2\/compartment-patient.html),
-- [STU3](http:\/\/www.hl7.org\/fhir\/stu3\/compartmentdefinition-patient.html),
-- [R4](http:\/\/hl7.org\/fhir\/R4\/compartmentdefinition-patient.html)),
-- which details the eligible resource types and referencing search
-- parameters. For samples that show how to call \`Patient-everything\`,
-- see [Getting all patient compartment
-- resources](\/healthcare\/docs\/how-tos\/fhir-resources#getting_all_patient_compartment_resources).
--
-- /See:/ 'projectsLocationsDataSetsFhirStoresFhirPatientEverything' smart constructor.
data ProjectsLocationsDataSetsFhirStoresFhirPatientEverything =
  ProjectsLocationsDataSetsFhirStoresFhirPatientEverything'
    { _pldsfsfpeXgafv :: !(Maybe Xgafv)
    , _pldsfsfpeCount :: !(Maybe (Textual Int32))
    , _pldsfsfpeType :: !(Maybe Text)
    , _pldsfsfpeUploadProtocol :: !(Maybe Text)
    , _pldsfsfpeAccessToken :: !(Maybe Text)
    , _pldsfsfpeStart :: !(Maybe Text)
    , _pldsfsfpeUploadType :: !(Maybe Text)
    , _pldsfsfpeName :: !Text
    , _pldsfsfpeEnd :: !(Maybe Text)
    , _pldsfsfpeSince :: !(Maybe Text)
    , _pldsfsfpePageToken :: !(Maybe Text)
    , _pldsfsfpeCallback :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ProjectsLocationsDataSetsFhirStoresFhirPatientEverything' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pldsfsfpeXgafv'
--
-- * 'pldsfsfpeCount'
--
-- * 'pldsfsfpeType'
--
-- * 'pldsfsfpeUploadProtocol'
--
-- * 'pldsfsfpeAccessToken'
--
-- * 'pldsfsfpeStart'
--
-- * 'pldsfsfpeUploadType'
--
-- * 'pldsfsfpeName'
--
-- * 'pldsfsfpeEnd'
--
-- * 'pldsfsfpeSince'
--
-- * 'pldsfsfpePageToken'
--
-- * 'pldsfsfpeCallback'
projectsLocationsDataSetsFhirStoresFhirPatientEverything
    :: Text -- ^ 'pldsfsfpeName'
    -> ProjectsLocationsDataSetsFhirStoresFhirPatientEverything
projectsLocationsDataSetsFhirStoresFhirPatientEverything pPldsfsfpeName_ =
  ProjectsLocationsDataSetsFhirStoresFhirPatientEverything'
    { _pldsfsfpeXgafv = Nothing
    , _pldsfsfpeCount = Nothing
    , _pldsfsfpeType = Nothing
    , _pldsfsfpeUploadProtocol = Nothing
    , _pldsfsfpeAccessToken = Nothing
    , _pldsfsfpeStart = Nothing
    , _pldsfsfpeUploadType = Nothing
    , _pldsfsfpeName = pPldsfsfpeName_
    , _pldsfsfpeEnd = Nothing
    , _pldsfsfpeSince = Nothing
    , _pldsfsfpePageToken = Nothing
    , _pldsfsfpeCallback = Nothing
    }


-- | V1 error format.
pldsfsfpeXgafv :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Xgafv)
pldsfsfpeXgafv
  = lens _pldsfsfpeXgafv
      (\ s a -> s{_pldsfsfpeXgafv = a})

-- | Maximum number of resources in a page. If not specified, 100 is used.
-- May not be larger than 1000.
pldsfsfpeCount :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Int32)
pldsfsfpeCount
  = lens _pldsfsfpeCount
      (\ s a -> s{_pldsfsfpeCount = a})
      . mapping _Coerce

-- | String of comma-delimited FHIR resource types. If provided, only
-- resources of the specified resource type(s) are returned.
pldsfsfpeType :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeType
  = lens _pldsfsfpeType
      (\ s a -> s{_pldsfsfpeType = a})

-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pldsfsfpeUploadProtocol :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeUploadProtocol
  = lens _pldsfsfpeUploadProtocol
      (\ s a -> s{_pldsfsfpeUploadProtocol = a})

-- | OAuth access token.
pldsfsfpeAccessToken :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeAccessToken
  = lens _pldsfsfpeAccessToken
      (\ s a -> s{_pldsfsfpeAccessToken = a})

-- | The response includes records subsequent to the start date. If no start
-- date is provided, all records prior to the end date are in scope.
pldsfsfpeStart :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeStart
  = lens _pldsfsfpeStart
      (\ s a -> s{_pldsfsfpeStart = a})

-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pldsfsfpeUploadType :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeUploadType
  = lens _pldsfsfpeUploadType
      (\ s a -> s{_pldsfsfpeUploadType = a})

-- | Name of the \`Patient\` resource for which the information is required.
pldsfsfpeName :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything Text
pldsfsfpeName
  = lens _pldsfsfpeName
      (\ s a -> s{_pldsfsfpeName = a})

-- | The response includes records prior to the end date. If no end date is
-- provided, all records subsequent to the start date are in scope.
pldsfsfpeEnd :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeEnd
  = lens _pldsfsfpeEnd (\ s a -> s{_pldsfsfpeEnd = a})

-- | If provided, only resources updated after this time are returned. 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.
pldsfsfpeSince :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeSince
  = lens _pldsfsfpeSince
      (\ s a -> s{_pldsfsfpeSince = a})

-- | Used to retrieve the next or previous page of results when using
-- pagination. Set \`_page_token\` to the value of _page_token set in next
-- or previous page links\' url. Next and previous page are returned in the
-- response bundle\'s links field, where \`link.relation\` is \"previous\"
-- or \"next\". Omit \`_page_token\` if no previous request has been made.
pldsfsfpePageToken :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpePageToken
  = lens _pldsfsfpePageToken
      (\ s a -> s{_pldsfsfpePageToken = a})

-- | JSONP
pldsfsfpeCallback :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatientEverything (Maybe Text)
pldsfsfpeCallback
  = lens _pldsfsfpeCallback
      (\ s a -> s{_pldsfsfpeCallback = a})

instance GoogleRequest
           ProjectsLocationsDataSetsFhirStoresFhirPatientEverything
         where
        type Rs
               ProjectsLocationsDataSetsFhirStoresFhirPatientEverything
             = HTTPBody
        type Scopes
               ProjectsLocationsDataSetsFhirStoresFhirPatientEverything
             = '["https://www.googleapis.com/auth/cloud-platform"]
        requestClient
          ProjectsLocationsDataSetsFhirStoresFhirPatientEverything'{..}
          = go _pldsfsfpeName _pldsfsfpeXgafv _pldsfsfpeCount
              _pldsfsfpeType
              _pldsfsfpeUploadProtocol
              _pldsfsfpeAccessToken
              _pldsfsfpeStart
              _pldsfsfpeUploadType
              _pldsfsfpeEnd
              _pldsfsfpeSince
              _pldsfsfpePageToken
              _pldsfsfpeCallback
              (Just AltJSON)
              healthcareService
          where go
                  = buildClient
                      (Proxy ::
                         Proxy
                           ProjectsLocationsDataSetsFhirStoresFhirPatientEverythingResource)
                      mempty
