{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Transcribe.GetMedicalTranscriptionJob
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about a transcription job from Amazon Transcribe
-- Medical. To see the status of the job, check the
-- @TranscriptionJobStatus@ field. If the status is @COMPLETED@, the job is
-- finished. You find the results of the completed job in the
-- @TranscriptFileUri@ field.
module Amazonka.Transcribe.GetMedicalTranscriptionJob
  ( -- * Creating a Request
    GetMedicalTranscriptionJob (..),
    newGetMedicalTranscriptionJob,

    -- * Request Lenses
    getMedicalTranscriptionJob_medicalTranscriptionJobName,

    -- * Destructuring the Response
    GetMedicalTranscriptionJobResponse (..),
    newGetMedicalTranscriptionJobResponse,

    -- * Response Lenses
    getMedicalTranscriptionJobResponse_medicalTranscriptionJob,
    getMedicalTranscriptionJobResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transcribe.Types

-- | /See:/ 'newGetMedicalTranscriptionJob' smart constructor.
data GetMedicalTranscriptionJob = GetMedicalTranscriptionJob'
  { -- | The name of the medical transcription job.
    GetMedicalTranscriptionJob -> Text
medicalTranscriptionJobName :: Prelude.Text
  }
  deriving (GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool
(GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool)
-> (GetMedicalTranscriptionJob
    -> GetMedicalTranscriptionJob -> Bool)
-> Eq GetMedicalTranscriptionJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool
$c/= :: GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool
== :: GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool
$c== :: GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool
Prelude.Eq, ReadPrec [GetMedicalTranscriptionJob]
ReadPrec GetMedicalTranscriptionJob
Int -> ReadS GetMedicalTranscriptionJob
ReadS [GetMedicalTranscriptionJob]
(Int -> ReadS GetMedicalTranscriptionJob)
-> ReadS [GetMedicalTranscriptionJob]
-> ReadPrec GetMedicalTranscriptionJob
-> ReadPrec [GetMedicalTranscriptionJob]
-> Read GetMedicalTranscriptionJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMedicalTranscriptionJob]
$creadListPrec :: ReadPrec [GetMedicalTranscriptionJob]
readPrec :: ReadPrec GetMedicalTranscriptionJob
$creadPrec :: ReadPrec GetMedicalTranscriptionJob
readList :: ReadS [GetMedicalTranscriptionJob]
$creadList :: ReadS [GetMedicalTranscriptionJob]
readsPrec :: Int -> ReadS GetMedicalTranscriptionJob
$creadsPrec :: Int -> ReadS GetMedicalTranscriptionJob
Prelude.Read, Int -> GetMedicalTranscriptionJob -> ShowS
[GetMedicalTranscriptionJob] -> ShowS
GetMedicalTranscriptionJob -> String
(Int -> GetMedicalTranscriptionJob -> ShowS)
-> (GetMedicalTranscriptionJob -> String)
-> ([GetMedicalTranscriptionJob] -> ShowS)
-> Show GetMedicalTranscriptionJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMedicalTranscriptionJob] -> ShowS
$cshowList :: [GetMedicalTranscriptionJob] -> ShowS
show :: GetMedicalTranscriptionJob -> String
$cshow :: GetMedicalTranscriptionJob -> String
showsPrec :: Int -> GetMedicalTranscriptionJob -> ShowS
$cshowsPrec :: Int -> GetMedicalTranscriptionJob -> ShowS
Prelude.Show, (forall x.
 GetMedicalTranscriptionJob -> Rep GetMedicalTranscriptionJob x)
-> (forall x.
    Rep GetMedicalTranscriptionJob x -> GetMedicalTranscriptionJob)
-> Generic GetMedicalTranscriptionJob
forall x.
Rep GetMedicalTranscriptionJob x -> GetMedicalTranscriptionJob
forall x.
GetMedicalTranscriptionJob -> Rep GetMedicalTranscriptionJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMedicalTranscriptionJob x -> GetMedicalTranscriptionJob
$cfrom :: forall x.
GetMedicalTranscriptionJob -> Rep GetMedicalTranscriptionJob x
Prelude.Generic)

-- |
-- Create a value of 'GetMedicalTranscriptionJob' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'medicalTranscriptionJobName', 'getMedicalTranscriptionJob_medicalTranscriptionJobName' - The name of the medical transcription job.
newGetMedicalTranscriptionJob ::
  -- | 'medicalTranscriptionJobName'
  Prelude.Text ->
  GetMedicalTranscriptionJob
newGetMedicalTranscriptionJob :: Text -> GetMedicalTranscriptionJob
newGetMedicalTranscriptionJob
  Text
pMedicalTranscriptionJobName_ =
    GetMedicalTranscriptionJob' :: Text -> GetMedicalTranscriptionJob
GetMedicalTranscriptionJob'
      { $sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: Text
medicalTranscriptionJobName =
          Text
pMedicalTranscriptionJobName_
      }

-- | The name of the medical transcription job.
getMedicalTranscriptionJob_medicalTranscriptionJobName :: Lens.Lens' GetMedicalTranscriptionJob Prelude.Text
getMedicalTranscriptionJob_medicalTranscriptionJobName :: (Text -> f Text)
-> GetMedicalTranscriptionJob -> f GetMedicalTranscriptionJob
getMedicalTranscriptionJob_medicalTranscriptionJobName = (GetMedicalTranscriptionJob -> Text)
-> (GetMedicalTranscriptionJob
    -> Text -> GetMedicalTranscriptionJob)
-> Lens
     GetMedicalTranscriptionJob GetMedicalTranscriptionJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMedicalTranscriptionJob' {Text
medicalTranscriptionJobName :: Text
$sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: GetMedicalTranscriptionJob -> Text
medicalTranscriptionJobName} -> Text
medicalTranscriptionJobName) (\s :: GetMedicalTranscriptionJob
s@GetMedicalTranscriptionJob' {} Text
a -> GetMedicalTranscriptionJob
s {$sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: Text
medicalTranscriptionJobName = Text
a} :: GetMedicalTranscriptionJob)

instance Core.AWSRequest GetMedicalTranscriptionJob where
  type
    AWSResponse GetMedicalTranscriptionJob =
      GetMedicalTranscriptionJobResponse
  request :: GetMedicalTranscriptionJob -> Request GetMedicalTranscriptionJob
request = Service
-> GetMedicalTranscriptionJob -> Request GetMedicalTranscriptionJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetMedicalTranscriptionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMedicalTranscriptionJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetMedicalTranscriptionJob))
-> Logger
-> Service
-> Proxy GetMedicalTranscriptionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMedicalTranscriptionJob)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe MedicalTranscriptionJob
-> Int -> GetMedicalTranscriptionJobResponse
GetMedicalTranscriptionJobResponse'
            (Maybe MedicalTranscriptionJob
 -> Int -> GetMedicalTranscriptionJobResponse)
-> Either String (Maybe MedicalTranscriptionJob)
-> Either String (Int -> GetMedicalTranscriptionJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe MedicalTranscriptionJob)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MedicalTranscriptionJob")
            Either String (Int -> GetMedicalTranscriptionJobResponse)
-> Either String Int
-> Either String GetMedicalTranscriptionJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetMedicalTranscriptionJob

instance Prelude.NFData GetMedicalTranscriptionJob

instance Core.ToHeaders GetMedicalTranscriptionJob where
  toHeaders :: GetMedicalTranscriptionJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetMedicalTranscriptionJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Transcribe.GetMedicalTranscriptionJob" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetMedicalTranscriptionJob where
  toJSON :: GetMedicalTranscriptionJob -> Value
toJSON GetMedicalTranscriptionJob' {Text
medicalTranscriptionJobName :: Text
$sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: GetMedicalTranscriptionJob -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"MedicalTranscriptionJobName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
medicalTranscriptionJobName
              )
          ]
      )

instance Core.ToPath GetMedicalTranscriptionJob where
  toPath :: GetMedicalTranscriptionJob -> ByteString
toPath = ByteString -> GetMedicalTranscriptionJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery GetMedicalTranscriptionJob where
  toQuery :: GetMedicalTranscriptionJob -> QueryString
toQuery = QueryString -> GetMedicalTranscriptionJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetMedicalTranscriptionJobResponse' smart constructor.
data GetMedicalTranscriptionJobResponse = GetMedicalTranscriptionJobResponse'
  { -- | An object that contains the results of the medical transcription job.
    GetMedicalTranscriptionJobResponse -> Maybe MedicalTranscriptionJob
medicalTranscriptionJob :: Prelude.Maybe MedicalTranscriptionJob,
    -- | The response's http status code.
    GetMedicalTranscriptionJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMedicalTranscriptionJobResponse
-> GetMedicalTranscriptionJobResponse -> Bool
(GetMedicalTranscriptionJobResponse
 -> GetMedicalTranscriptionJobResponse -> Bool)
-> (GetMedicalTranscriptionJobResponse
    -> GetMedicalTranscriptionJobResponse -> Bool)
-> Eq GetMedicalTranscriptionJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMedicalTranscriptionJobResponse
-> GetMedicalTranscriptionJobResponse -> Bool
$c/= :: GetMedicalTranscriptionJobResponse
-> GetMedicalTranscriptionJobResponse -> Bool
== :: GetMedicalTranscriptionJobResponse
-> GetMedicalTranscriptionJobResponse -> Bool
$c== :: GetMedicalTranscriptionJobResponse
-> GetMedicalTranscriptionJobResponse -> Bool
Prelude.Eq, ReadPrec [GetMedicalTranscriptionJobResponse]
ReadPrec GetMedicalTranscriptionJobResponse
Int -> ReadS GetMedicalTranscriptionJobResponse
ReadS [GetMedicalTranscriptionJobResponse]
(Int -> ReadS GetMedicalTranscriptionJobResponse)
-> ReadS [GetMedicalTranscriptionJobResponse]
-> ReadPrec GetMedicalTranscriptionJobResponse
-> ReadPrec [GetMedicalTranscriptionJobResponse]
-> Read GetMedicalTranscriptionJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMedicalTranscriptionJobResponse]
$creadListPrec :: ReadPrec [GetMedicalTranscriptionJobResponse]
readPrec :: ReadPrec GetMedicalTranscriptionJobResponse
$creadPrec :: ReadPrec GetMedicalTranscriptionJobResponse
readList :: ReadS [GetMedicalTranscriptionJobResponse]
$creadList :: ReadS [GetMedicalTranscriptionJobResponse]
readsPrec :: Int -> ReadS GetMedicalTranscriptionJobResponse
$creadsPrec :: Int -> ReadS GetMedicalTranscriptionJobResponse
Prelude.Read, Int -> GetMedicalTranscriptionJobResponse -> ShowS
[GetMedicalTranscriptionJobResponse] -> ShowS
GetMedicalTranscriptionJobResponse -> String
(Int -> GetMedicalTranscriptionJobResponse -> ShowS)
-> (GetMedicalTranscriptionJobResponse -> String)
-> ([GetMedicalTranscriptionJobResponse] -> ShowS)
-> Show GetMedicalTranscriptionJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMedicalTranscriptionJobResponse] -> ShowS
$cshowList :: [GetMedicalTranscriptionJobResponse] -> ShowS
show :: GetMedicalTranscriptionJobResponse -> String
$cshow :: GetMedicalTranscriptionJobResponse -> String
showsPrec :: Int -> GetMedicalTranscriptionJobResponse -> ShowS
$cshowsPrec :: Int -> GetMedicalTranscriptionJobResponse -> ShowS
Prelude.Show, (forall x.
 GetMedicalTranscriptionJobResponse
 -> Rep GetMedicalTranscriptionJobResponse x)
-> (forall x.
    Rep GetMedicalTranscriptionJobResponse x
    -> GetMedicalTranscriptionJobResponse)
-> Generic GetMedicalTranscriptionJobResponse
forall x.
Rep GetMedicalTranscriptionJobResponse x
-> GetMedicalTranscriptionJobResponse
forall x.
GetMedicalTranscriptionJobResponse
-> Rep GetMedicalTranscriptionJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMedicalTranscriptionJobResponse x
-> GetMedicalTranscriptionJobResponse
$cfrom :: forall x.
GetMedicalTranscriptionJobResponse
-> Rep GetMedicalTranscriptionJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMedicalTranscriptionJobResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'medicalTranscriptionJob', 'getMedicalTranscriptionJobResponse_medicalTranscriptionJob' - An object that contains the results of the medical transcription job.
--
-- 'httpStatus', 'getMedicalTranscriptionJobResponse_httpStatus' - The response's http status code.
newGetMedicalTranscriptionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMedicalTranscriptionJobResponse
newGetMedicalTranscriptionJobResponse :: Int -> GetMedicalTranscriptionJobResponse
newGetMedicalTranscriptionJobResponse Int
pHttpStatus_ =
  GetMedicalTranscriptionJobResponse' :: Maybe MedicalTranscriptionJob
-> Int -> GetMedicalTranscriptionJobResponse
GetMedicalTranscriptionJobResponse'
    { $sel:medicalTranscriptionJob:GetMedicalTranscriptionJobResponse' :: Maybe MedicalTranscriptionJob
medicalTranscriptionJob =
        Maybe MedicalTranscriptionJob
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMedicalTranscriptionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains the results of the medical transcription job.
getMedicalTranscriptionJobResponse_medicalTranscriptionJob :: Lens.Lens' GetMedicalTranscriptionJobResponse (Prelude.Maybe MedicalTranscriptionJob)
getMedicalTranscriptionJobResponse_medicalTranscriptionJob :: (Maybe MedicalTranscriptionJob
 -> f (Maybe MedicalTranscriptionJob))
-> GetMedicalTranscriptionJobResponse
-> f GetMedicalTranscriptionJobResponse
getMedicalTranscriptionJobResponse_medicalTranscriptionJob = (GetMedicalTranscriptionJobResponse
 -> Maybe MedicalTranscriptionJob)
-> (GetMedicalTranscriptionJobResponse
    -> Maybe MedicalTranscriptionJob
    -> GetMedicalTranscriptionJobResponse)
-> Lens
     GetMedicalTranscriptionJobResponse
     GetMedicalTranscriptionJobResponse
     (Maybe MedicalTranscriptionJob)
     (Maybe MedicalTranscriptionJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMedicalTranscriptionJobResponse' {Maybe MedicalTranscriptionJob
medicalTranscriptionJob :: Maybe MedicalTranscriptionJob
$sel:medicalTranscriptionJob:GetMedicalTranscriptionJobResponse' :: GetMedicalTranscriptionJobResponse -> Maybe MedicalTranscriptionJob
medicalTranscriptionJob} -> Maybe MedicalTranscriptionJob
medicalTranscriptionJob) (\s :: GetMedicalTranscriptionJobResponse
s@GetMedicalTranscriptionJobResponse' {} Maybe MedicalTranscriptionJob
a -> GetMedicalTranscriptionJobResponse
s {$sel:medicalTranscriptionJob:GetMedicalTranscriptionJobResponse' :: Maybe MedicalTranscriptionJob
medicalTranscriptionJob = Maybe MedicalTranscriptionJob
a} :: GetMedicalTranscriptionJobResponse)

-- | The response's http status code.
getMedicalTranscriptionJobResponse_httpStatus :: Lens.Lens' GetMedicalTranscriptionJobResponse Prelude.Int
getMedicalTranscriptionJobResponse_httpStatus :: (Int -> f Int)
-> GetMedicalTranscriptionJobResponse
-> f GetMedicalTranscriptionJobResponse
getMedicalTranscriptionJobResponse_httpStatus = (GetMedicalTranscriptionJobResponse -> Int)
-> (GetMedicalTranscriptionJobResponse
    -> Int -> GetMedicalTranscriptionJobResponse)
-> Lens
     GetMedicalTranscriptionJobResponse
     GetMedicalTranscriptionJobResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMedicalTranscriptionJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMedicalTranscriptionJobResponse' :: GetMedicalTranscriptionJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMedicalTranscriptionJobResponse
s@GetMedicalTranscriptionJobResponse' {} Int
a -> GetMedicalTranscriptionJobResponse
s {$sel:httpStatus:GetMedicalTranscriptionJobResponse' :: Int
httpStatus = Int
a} :: GetMedicalTranscriptionJobResponse)

instance
  Prelude.NFData
    GetMedicalTranscriptionJobResponse