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

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

-- |
-- Module      : Amazonka.ConnectContactLens.Types.Transcript
-- 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)
module Amazonka.ConnectContactLens.Types.Transcript where

import Amazonka.ConnectContactLens.Types.IssueDetected
import Amazonka.ConnectContactLens.Types.SentimentValue
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A list of messages in the session.
--
-- /See:/ 'newTranscript' smart constructor.
data Transcript = Transcript'
  { -- | List of positions where issues were detected on the transcript.
    Transcript -> Maybe [IssueDetected]
issuesDetected :: Prelude.Maybe [IssueDetected],
    -- | The identifier of the transcript.
    Transcript -> Text
id :: Prelude.Text,
    -- | The identifier of the participant.
    Transcript -> Text
participantId :: Prelude.Text,
    -- | The role of participant. For example, is it a customer, agent, or
    -- system.
    Transcript -> Text
participantRole :: Prelude.Text,
    -- | The content of the transcript.
    Transcript -> Text
content :: Prelude.Text,
    -- | The beginning offset in the contact for this transcript.
    Transcript -> Natural
beginOffsetMillis :: Prelude.Natural,
    -- | The end offset in the contact for this transcript.
    Transcript -> Natural
endOffsetMillis :: Prelude.Natural,
    -- | The sentiment of the detected for this piece of transcript.
    Transcript -> SentimentValue
sentiment :: SentimentValue
  }
  deriving (Transcript -> Transcript -> Bool
(Transcript -> Transcript -> Bool)
-> (Transcript -> Transcript -> Bool) -> Eq Transcript
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Transcript -> Transcript -> Bool
$c/= :: Transcript -> Transcript -> Bool
== :: Transcript -> Transcript -> Bool
$c== :: Transcript -> Transcript -> Bool
Prelude.Eq, ReadPrec [Transcript]
ReadPrec Transcript
Int -> ReadS Transcript
ReadS [Transcript]
(Int -> ReadS Transcript)
-> ReadS [Transcript]
-> ReadPrec Transcript
-> ReadPrec [Transcript]
-> Read Transcript
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Transcript]
$creadListPrec :: ReadPrec [Transcript]
readPrec :: ReadPrec Transcript
$creadPrec :: ReadPrec Transcript
readList :: ReadS [Transcript]
$creadList :: ReadS [Transcript]
readsPrec :: Int -> ReadS Transcript
$creadsPrec :: Int -> ReadS Transcript
Prelude.Read, Int -> Transcript -> ShowS
[Transcript] -> ShowS
Transcript -> String
(Int -> Transcript -> ShowS)
-> (Transcript -> String)
-> ([Transcript] -> ShowS)
-> Show Transcript
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Transcript] -> ShowS
$cshowList :: [Transcript] -> ShowS
show :: Transcript -> String
$cshow :: Transcript -> String
showsPrec :: Int -> Transcript -> ShowS
$cshowsPrec :: Int -> Transcript -> ShowS
Prelude.Show, (forall x. Transcript -> Rep Transcript x)
-> (forall x. Rep Transcript x -> Transcript) -> Generic Transcript
forall x. Rep Transcript x -> Transcript
forall x. Transcript -> Rep Transcript x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Transcript x -> Transcript
$cfrom :: forall x. Transcript -> Rep Transcript x
Prelude.Generic)

-- |
-- Create a value of 'Transcript' 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:
--
-- 'issuesDetected', 'transcript_issuesDetected' - List of positions where issues were detected on the transcript.
--
-- 'id', 'transcript_id' - The identifier of the transcript.
--
-- 'participantId', 'transcript_participantId' - The identifier of the participant.
--
-- 'participantRole', 'transcript_participantRole' - The role of participant. For example, is it a customer, agent, or
-- system.
--
-- 'content', 'transcript_content' - The content of the transcript.
--
-- 'beginOffsetMillis', 'transcript_beginOffsetMillis' - The beginning offset in the contact for this transcript.
--
-- 'endOffsetMillis', 'transcript_endOffsetMillis' - The end offset in the contact for this transcript.
--
-- 'sentiment', 'transcript_sentiment' - The sentiment of the detected for this piece of transcript.
newTranscript ::
  -- | 'id'
  Prelude.Text ->
  -- | 'participantId'
  Prelude.Text ->
  -- | 'participantRole'
  Prelude.Text ->
  -- | 'content'
  Prelude.Text ->
  -- | 'beginOffsetMillis'
  Prelude.Natural ->
  -- | 'endOffsetMillis'
  Prelude.Natural ->
  -- | 'sentiment'
  SentimentValue ->
  Transcript
newTranscript :: Text
-> Text
-> Text
-> Text
-> Natural
-> Natural
-> SentimentValue
-> Transcript
newTranscript
  Text
pId_
  Text
pParticipantId_
  Text
pParticipantRole_
  Text
pContent_
  Natural
pBeginOffsetMillis_
  Natural
pEndOffsetMillis_
  SentimentValue
pSentiment_ =
    Transcript' :: Maybe [IssueDetected]
-> Text
-> Text
-> Text
-> Text
-> Natural
-> Natural
-> SentimentValue
-> Transcript
Transcript'
      { $sel:issuesDetected:Transcript' :: Maybe [IssueDetected]
issuesDetected = Maybe [IssueDetected]
forall a. Maybe a
Prelude.Nothing,
        $sel:id:Transcript' :: Text
id = Text
pId_,
        $sel:participantId:Transcript' :: Text
participantId = Text
pParticipantId_,
        $sel:participantRole:Transcript' :: Text
participantRole = Text
pParticipantRole_,
        $sel:content:Transcript' :: Text
content = Text
pContent_,
        $sel:beginOffsetMillis:Transcript' :: Natural
beginOffsetMillis = Natural
pBeginOffsetMillis_,
        $sel:endOffsetMillis:Transcript' :: Natural
endOffsetMillis = Natural
pEndOffsetMillis_,
        $sel:sentiment:Transcript' :: SentimentValue
sentiment = SentimentValue
pSentiment_
      }

-- | List of positions where issues were detected on the transcript.
transcript_issuesDetected :: Lens.Lens' Transcript (Prelude.Maybe [IssueDetected])
transcript_issuesDetected :: (Maybe [IssueDetected] -> f (Maybe [IssueDetected]))
-> Transcript -> f Transcript
transcript_issuesDetected = (Transcript -> Maybe [IssueDetected])
-> (Transcript -> Maybe [IssueDetected] -> Transcript)
-> Lens
     Transcript
     Transcript
     (Maybe [IssueDetected])
     (Maybe [IssueDetected])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Maybe [IssueDetected]
issuesDetected :: Maybe [IssueDetected]
$sel:issuesDetected:Transcript' :: Transcript -> Maybe [IssueDetected]
issuesDetected} -> Maybe [IssueDetected]
issuesDetected) (\s :: Transcript
s@Transcript' {} Maybe [IssueDetected]
a -> Transcript
s {$sel:issuesDetected:Transcript' :: Maybe [IssueDetected]
issuesDetected = Maybe [IssueDetected]
a} :: Transcript) ((Maybe [IssueDetected] -> f (Maybe [IssueDetected]))
 -> Transcript -> f Transcript)
-> ((Maybe [IssueDetected] -> f (Maybe [IssueDetected]))
    -> Maybe [IssueDetected] -> f (Maybe [IssueDetected]))
-> (Maybe [IssueDetected] -> f (Maybe [IssueDetected]))
-> Transcript
-> f Transcript
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [IssueDetected] [IssueDetected] [IssueDetected] [IssueDetected]
-> Iso
     (Maybe [IssueDetected])
     (Maybe [IssueDetected])
     (Maybe [IssueDetected])
     (Maybe [IssueDetected])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [IssueDetected] [IssueDetected] [IssueDetected] [IssueDetected]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the transcript.
transcript_id :: Lens.Lens' Transcript Prelude.Text
transcript_id :: (Text -> f Text) -> Transcript -> f Transcript
transcript_id = (Transcript -> Text)
-> (Transcript -> Text -> Transcript)
-> Lens Transcript Transcript Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Text
id :: Text
$sel:id:Transcript' :: Transcript -> Text
id} -> Text
id) (\s :: Transcript
s@Transcript' {} Text
a -> Transcript
s {$sel:id:Transcript' :: Text
id = Text
a} :: Transcript)

-- | The identifier of the participant.
transcript_participantId :: Lens.Lens' Transcript Prelude.Text
transcript_participantId :: (Text -> f Text) -> Transcript -> f Transcript
transcript_participantId = (Transcript -> Text)
-> (Transcript -> Text -> Transcript)
-> Lens Transcript Transcript Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Text
participantId :: Text
$sel:participantId:Transcript' :: Transcript -> Text
participantId} -> Text
participantId) (\s :: Transcript
s@Transcript' {} Text
a -> Transcript
s {$sel:participantId:Transcript' :: Text
participantId = Text
a} :: Transcript)

-- | The role of participant. For example, is it a customer, agent, or
-- system.
transcript_participantRole :: Lens.Lens' Transcript Prelude.Text
transcript_participantRole :: (Text -> f Text) -> Transcript -> f Transcript
transcript_participantRole = (Transcript -> Text)
-> (Transcript -> Text -> Transcript)
-> Lens Transcript Transcript Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Text
participantRole :: Text
$sel:participantRole:Transcript' :: Transcript -> Text
participantRole} -> Text
participantRole) (\s :: Transcript
s@Transcript' {} Text
a -> Transcript
s {$sel:participantRole:Transcript' :: Text
participantRole = Text
a} :: Transcript)

-- | The content of the transcript.
transcript_content :: Lens.Lens' Transcript Prelude.Text
transcript_content :: (Text -> f Text) -> Transcript -> f Transcript
transcript_content = (Transcript -> Text)
-> (Transcript -> Text -> Transcript)
-> Lens Transcript Transcript Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Text
content :: Text
$sel:content:Transcript' :: Transcript -> Text
content} -> Text
content) (\s :: Transcript
s@Transcript' {} Text
a -> Transcript
s {$sel:content:Transcript' :: Text
content = Text
a} :: Transcript)

-- | The beginning offset in the contact for this transcript.
transcript_beginOffsetMillis :: Lens.Lens' Transcript Prelude.Natural
transcript_beginOffsetMillis :: (Natural -> f Natural) -> Transcript -> f Transcript
transcript_beginOffsetMillis = (Transcript -> Natural)
-> (Transcript -> Natural -> Transcript)
-> Lens Transcript Transcript Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Natural
beginOffsetMillis :: Natural
$sel:beginOffsetMillis:Transcript' :: Transcript -> Natural
beginOffsetMillis} -> Natural
beginOffsetMillis) (\s :: Transcript
s@Transcript' {} Natural
a -> Transcript
s {$sel:beginOffsetMillis:Transcript' :: Natural
beginOffsetMillis = Natural
a} :: Transcript)

-- | The end offset in the contact for this transcript.
transcript_endOffsetMillis :: Lens.Lens' Transcript Prelude.Natural
transcript_endOffsetMillis :: (Natural -> f Natural) -> Transcript -> f Transcript
transcript_endOffsetMillis = (Transcript -> Natural)
-> (Transcript -> Natural -> Transcript)
-> Lens Transcript Transcript Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {Natural
endOffsetMillis :: Natural
$sel:endOffsetMillis:Transcript' :: Transcript -> Natural
endOffsetMillis} -> Natural
endOffsetMillis) (\s :: Transcript
s@Transcript' {} Natural
a -> Transcript
s {$sel:endOffsetMillis:Transcript' :: Natural
endOffsetMillis = Natural
a} :: Transcript)

-- | The sentiment of the detected for this piece of transcript.
transcript_sentiment :: Lens.Lens' Transcript SentimentValue
transcript_sentiment :: (SentimentValue -> f SentimentValue) -> Transcript -> f Transcript
transcript_sentiment = (Transcript -> SentimentValue)
-> (Transcript -> SentimentValue -> Transcript)
-> Lens Transcript Transcript SentimentValue SentimentValue
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transcript' {SentimentValue
sentiment :: SentimentValue
$sel:sentiment:Transcript' :: Transcript -> SentimentValue
sentiment} -> SentimentValue
sentiment) (\s :: Transcript
s@Transcript' {} SentimentValue
a -> Transcript
s {$sel:sentiment:Transcript' :: SentimentValue
sentiment = SentimentValue
a} :: Transcript)

instance Core.FromJSON Transcript where
  parseJSON :: Value -> Parser Transcript
parseJSON =
    String
-> (Object -> Parser Transcript) -> Value -> Parser Transcript
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Transcript"
      ( \Object
x ->
          Maybe [IssueDetected]
-> Text
-> Text
-> Text
-> Text
-> Natural
-> Natural
-> SentimentValue
-> Transcript
Transcript'
            (Maybe [IssueDetected]
 -> Text
 -> Text
 -> Text
 -> Text
 -> Natural
 -> Natural
 -> SentimentValue
 -> Transcript)
-> Parser (Maybe [IssueDetected])
-> Parser
     (Text
      -> Text
      -> Text
      -> Text
      -> Natural
      -> Natural
      -> SentimentValue
      -> Transcript)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [IssueDetected]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IssuesDetected" Parser (Maybe (Maybe [IssueDetected]))
-> Maybe [IssueDetected] -> Parser (Maybe [IssueDetected])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [IssueDetected]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Text
   -> Text
   -> Text
   -> Text
   -> Natural
   -> Natural
   -> SentimentValue
   -> Transcript)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> Text
      -> Natural
      -> Natural
      -> SentimentValue
      -> Transcript)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
            Parser
  (Text
   -> Text
   -> Text
   -> Natural
   -> Natural
   -> SentimentValue
   -> Transcript)
-> Parser Text
-> Parser
     (Text
      -> Text -> Natural -> Natural -> SentimentValue -> Transcript)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ParticipantId")
            Parser
  (Text
   -> Text -> Natural -> Natural -> SentimentValue -> Transcript)
-> Parser Text
-> Parser
     (Text -> Natural -> Natural -> SentimentValue -> Transcript)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ParticipantRole")
            Parser (Text -> Natural -> Natural -> SentimentValue -> Transcript)
-> Parser Text
-> Parser (Natural -> Natural -> SentimentValue -> Transcript)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Content")
            Parser (Natural -> Natural -> SentimentValue -> Transcript)
-> Parser Natural
-> Parser (Natural -> SentimentValue -> Transcript)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BeginOffsetMillis")
            Parser (Natural -> SentimentValue -> Transcript)
-> Parser Natural -> Parser (SentimentValue -> Transcript)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndOffsetMillis")
            Parser (SentimentValue -> Transcript)
-> Parser SentimentValue -> Parser Transcript
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SentimentValue
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Sentiment")
      )

instance Prelude.Hashable Transcript

instance Prelude.NFData Transcript