{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Provides information about the specified medical transcription job.
--
-- To view the status of the specified medical transcription job, check the
-- @TranscriptionJobStatus@ field. If the status is @COMPLETED@, the job is
-- finished. You can find the results at the location specified in
-- @TranscriptFileUri@. If the status is @FAILED@, @FailureReason@ provides
-- details on why your transcription job failed.
--
-- To get a list of your medical transcription jobs, use the operation.
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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 you want information about.
    -- Job names are case sensitive.
    GetMedicalTranscriptionJob -> Text
medicalTranscriptionJobName :: Prelude.Text
  }
  deriving (GetMedicalTranscriptionJob -> GetMedicalTranscriptionJob -> Bool
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]
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
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.
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 you want information about.
-- Job names are case sensitive.
newGetMedicalTranscriptionJob ::
  -- | 'medicalTranscriptionJobName'
  Prelude.Text ->
  GetMedicalTranscriptionJob
newGetMedicalTranscriptionJob :: Text -> GetMedicalTranscriptionJob
newGetMedicalTranscriptionJob
  Text
pMedicalTranscriptionJobName_ =
    GetMedicalTranscriptionJob'
      { $sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: Text
medicalTranscriptionJobName =
          Text
pMedicalTranscriptionJobName_
      }

-- | The name of the medical transcription job you want information about.
-- Job names are case sensitive.
getMedicalTranscriptionJob_medicalTranscriptionJobName :: Lens.Lens' GetMedicalTranscriptionJob Prelude.Text
getMedicalTranscriptionJob_medicalTranscriptionJobName :: Lens' GetMedicalTranscriptionJob Text
getMedicalTranscriptionJob_medicalTranscriptionJobName = 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 :: (Service -> Service)
-> GetMedicalTranscriptionJob -> Request GetMedicalTranscriptionJob
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetMedicalTranscriptionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMedicalTranscriptionJob)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe MedicalTranscriptionJob
-> Int -> GetMedicalTranscriptionJobResponse
GetMedicalTranscriptionJobResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"MedicalTranscriptionJob")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetMedicalTranscriptionJob where
  hashWithSalt :: Int -> GetMedicalTranscriptionJob -> Int
hashWithSalt Int
_salt GetMedicalTranscriptionJob' {Text
medicalTranscriptionJobName :: Text
$sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: GetMedicalTranscriptionJob -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
medicalTranscriptionJobName

instance Prelude.NFData GetMedicalTranscriptionJob where
  rnf :: GetMedicalTranscriptionJob -> ()
rnf GetMedicalTranscriptionJob' {Text
medicalTranscriptionJobName :: Text
$sel:medicalTranscriptionJobName:GetMedicalTranscriptionJob' :: GetMedicalTranscriptionJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
medicalTranscriptionJobName

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

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

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

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

-- | /See:/ 'newGetMedicalTranscriptionJobResponse' smart constructor.
data GetMedicalTranscriptionJobResponse = GetMedicalTranscriptionJobResponse'
  { -- | Provides detailed information about the specified medical transcription
    -- job, including job status and, if applicable, failure reason.
    GetMedicalTranscriptionJobResponse -> Maybe MedicalTranscriptionJob
medicalTranscriptionJob :: Prelude.Maybe MedicalTranscriptionJob,
    -- | The response's http status code.
    GetMedicalTranscriptionJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMedicalTranscriptionJobResponse
-> GetMedicalTranscriptionJobResponse -> Bool
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]
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
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.
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' - Provides detailed information about the specified medical transcription
-- job, including job status and, if applicable, failure reason.
--
-- 'httpStatus', 'getMedicalTranscriptionJobResponse_httpStatus' - The response's http status code.
newGetMedicalTranscriptionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMedicalTranscriptionJobResponse
newGetMedicalTranscriptionJobResponse :: Int -> GetMedicalTranscriptionJobResponse
newGetMedicalTranscriptionJobResponse Int
pHttpStatus_ =
  GetMedicalTranscriptionJobResponse'
    { $sel:medicalTranscriptionJob:GetMedicalTranscriptionJobResponse' :: Maybe MedicalTranscriptionJob
medicalTranscriptionJob =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMedicalTranscriptionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Provides detailed information about the specified medical transcription
-- job, including job status and, if applicable, failure reason.
getMedicalTranscriptionJobResponse_medicalTranscriptionJob :: Lens.Lens' GetMedicalTranscriptionJobResponse (Prelude.Maybe MedicalTranscriptionJob)
getMedicalTranscriptionJobResponse_medicalTranscriptionJob :: Lens'
  GetMedicalTranscriptionJobResponse (Maybe MedicalTranscriptionJob)
getMedicalTranscriptionJobResponse_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 :: Lens' GetMedicalTranscriptionJobResponse Int
getMedicalTranscriptionJobResponse_httpStatus = 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
  where
  rnf :: GetMedicalTranscriptionJobResponse -> ()
rnf GetMedicalTranscriptionJobResponse' {Int
Maybe MedicalTranscriptionJob
httpStatus :: Int
medicalTranscriptionJob :: Maybe MedicalTranscriptionJob
$sel:httpStatus:GetMedicalTranscriptionJobResponse' :: GetMedicalTranscriptionJobResponse -> Int
$sel:medicalTranscriptionJob:GetMedicalTranscriptionJobResponse' :: GetMedicalTranscriptionJobResponse -> Maybe MedicalTranscriptionJob
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MedicalTranscriptionJob
medicalTranscriptionJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus