{-# 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.RealtimeContactAnalysisSegment
-- 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.RealtimeContactAnalysisSegment where

import Amazonka.ConnectContactLens.Types.Categories
import Amazonka.ConnectContactLens.Types.Transcript
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An analyzed segment for a real-time analysis session.
--
-- /See:/ 'newRealtimeContactAnalysisSegment' smart constructor.
data RealtimeContactAnalysisSegment = RealtimeContactAnalysisSegment'
  { -- | The matched category rules.
    RealtimeContactAnalysisSegment -> Maybe Categories
categories :: Prelude.Maybe Categories,
    -- | The analyzed transcript.
    RealtimeContactAnalysisSegment -> Maybe Transcript
transcript :: Prelude.Maybe Transcript
  }
  deriving (RealtimeContactAnalysisSegment
-> RealtimeContactAnalysisSegment -> Bool
(RealtimeContactAnalysisSegment
 -> RealtimeContactAnalysisSegment -> Bool)
-> (RealtimeContactAnalysisSegment
    -> RealtimeContactAnalysisSegment -> Bool)
-> Eq RealtimeContactAnalysisSegment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RealtimeContactAnalysisSegment
-> RealtimeContactAnalysisSegment -> Bool
$c/= :: RealtimeContactAnalysisSegment
-> RealtimeContactAnalysisSegment -> Bool
== :: RealtimeContactAnalysisSegment
-> RealtimeContactAnalysisSegment -> Bool
$c== :: RealtimeContactAnalysisSegment
-> RealtimeContactAnalysisSegment -> Bool
Prelude.Eq, ReadPrec [RealtimeContactAnalysisSegment]
ReadPrec RealtimeContactAnalysisSegment
Int -> ReadS RealtimeContactAnalysisSegment
ReadS [RealtimeContactAnalysisSegment]
(Int -> ReadS RealtimeContactAnalysisSegment)
-> ReadS [RealtimeContactAnalysisSegment]
-> ReadPrec RealtimeContactAnalysisSegment
-> ReadPrec [RealtimeContactAnalysisSegment]
-> Read RealtimeContactAnalysisSegment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RealtimeContactAnalysisSegment]
$creadListPrec :: ReadPrec [RealtimeContactAnalysisSegment]
readPrec :: ReadPrec RealtimeContactAnalysisSegment
$creadPrec :: ReadPrec RealtimeContactAnalysisSegment
readList :: ReadS [RealtimeContactAnalysisSegment]
$creadList :: ReadS [RealtimeContactAnalysisSegment]
readsPrec :: Int -> ReadS RealtimeContactAnalysisSegment
$creadsPrec :: Int -> ReadS RealtimeContactAnalysisSegment
Prelude.Read, Int -> RealtimeContactAnalysisSegment -> ShowS
[RealtimeContactAnalysisSegment] -> ShowS
RealtimeContactAnalysisSegment -> String
(Int -> RealtimeContactAnalysisSegment -> ShowS)
-> (RealtimeContactAnalysisSegment -> String)
-> ([RealtimeContactAnalysisSegment] -> ShowS)
-> Show RealtimeContactAnalysisSegment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RealtimeContactAnalysisSegment] -> ShowS
$cshowList :: [RealtimeContactAnalysisSegment] -> ShowS
show :: RealtimeContactAnalysisSegment -> String
$cshow :: RealtimeContactAnalysisSegment -> String
showsPrec :: Int -> RealtimeContactAnalysisSegment -> ShowS
$cshowsPrec :: Int -> RealtimeContactAnalysisSegment -> ShowS
Prelude.Show, (forall x.
 RealtimeContactAnalysisSegment
 -> Rep RealtimeContactAnalysisSegment x)
-> (forall x.
    Rep RealtimeContactAnalysisSegment x
    -> RealtimeContactAnalysisSegment)
-> Generic RealtimeContactAnalysisSegment
forall x.
Rep RealtimeContactAnalysisSegment x
-> RealtimeContactAnalysisSegment
forall x.
RealtimeContactAnalysisSegment
-> Rep RealtimeContactAnalysisSegment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RealtimeContactAnalysisSegment x
-> RealtimeContactAnalysisSegment
$cfrom :: forall x.
RealtimeContactAnalysisSegment
-> Rep RealtimeContactAnalysisSegment x
Prelude.Generic)

-- |
-- Create a value of 'RealtimeContactAnalysisSegment' 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:
--
-- 'categories', 'realtimeContactAnalysisSegment_categories' - The matched category rules.
--
-- 'transcript', 'realtimeContactAnalysisSegment_transcript' - The analyzed transcript.
newRealtimeContactAnalysisSegment ::
  RealtimeContactAnalysisSegment
newRealtimeContactAnalysisSegment :: RealtimeContactAnalysisSegment
newRealtimeContactAnalysisSegment =
  RealtimeContactAnalysisSegment' :: Maybe Categories
-> Maybe Transcript -> RealtimeContactAnalysisSegment
RealtimeContactAnalysisSegment'
    { $sel:categories:RealtimeContactAnalysisSegment' :: Maybe Categories
categories =
        Maybe Categories
forall a. Maybe a
Prelude.Nothing,
      $sel:transcript:RealtimeContactAnalysisSegment' :: Maybe Transcript
transcript = Maybe Transcript
forall a. Maybe a
Prelude.Nothing
    }

-- | The matched category rules.
realtimeContactAnalysisSegment_categories :: Lens.Lens' RealtimeContactAnalysisSegment (Prelude.Maybe Categories)
realtimeContactAnalysisSegment_categories :: (Maybe Categories -> f (Maybe Categories))
-> RealtimeContactAnalysisSegment
-> f RealtimeContactAnalysisSegment
realtimeContactAnalysisSegment_categories = (RealtimeContactAnalysisSegment -> Maybe Categories)
-> (RealtimeContactAnalysisSegment
    -> Maybe Categories -> RealtimeContactAnalysisSegment)
-> Lens
     RealtimeContactAnalysisSegment
     RealtimeContactAnalysisSegment
     (Maybe Categories)
     (Maybe Categories)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeContactAnalysisSegment' {Maybe Categories
categories :: Maybe Categories
$sel:categories:RealtimeContactAnalysisSegment' :: RealtimeContactAnalysisSegment -> Maybe Categories
categories} -> Maybe Categories
categories) (\s :: RealtimeContactAnalysisSegment
s@RealtimeContactAnalysisSegment' {} Maybe Categories
a -> RealtimeContactAnalysisSegment
s {$sel:categories:RealtimeContactAnalysisSegment' :: Maybe Categories
categories = Maybe Categories
a} :: RealtimeContactAnalysisSegment)

-- | The analyzed transcript.
realtimeContactAnalysisSegment_transcript :: Lens.Lens' RealtimeContactAnalysisSegment (Prelude.Maybe Transcript)
realtimeContactAnalysisSegment_transcript :: (Maybe Transcript -> f (Maybe Transcript))
-> RealtimeContactAnalysisSegment
-> f RealtimeContactAnalysisSegment
realtimeContactAnalysisSegment_transcript = (RealtimeContactAnalysisSegment -> Maybe Transcript)
-> (RealtimeContactAnalysisSegment
    -> Maybe Transcript -> RealtimeContactAnalysisSegment)
-> Lens
     RealtimeContactAnalysisSegment
     RealtimeContactAnalysisSegment
     (Maybe Transcript)
     (Maybe Transcript)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeContactAnalysisSegment' {Maybe Transcript
transcript :: Maybe Transcript
$sel:transcript:RealtimeContactAnalysisSegment' :: RealtimeContactAnalysisSegment -> Maybe Transcript
transcript} -> Maybe Transcript
transcript) (\s :: RealtimeContactAnalysisSegment
s@RealtimeContactAnalysisSegment' {} Maybe Transcript
a -> RealtimeContactAnalysisSegment
s {$sel:transcript:RealtimeContactAnalysisSegment' :: Maybe Transcript
transcript = Maybe Transcript
a} :: RealtimeContactAnalysisSegment)

instance Core.FromJSON RealtimeContactAnalysisSegment where
  parseJSON :: Value -> Parser RealtimeContactAnalysisSegment
parseJSON =
    String
-> (Object -> Parser RealtimeContactAnalysisSegment)
-> Value
-> Parser RealtimeContactAnalysisSegment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RealtimeContactAnalysisSegment"
      ( \Object
x ->
          Maybe Categories
-> Maybe Transcript -> RealtimeContactAnalysisSegment
RealtimeContactAnalysisSegment'
            (Maybe Categories
 -> Maybe Transcript -> RealtimeContactAnalysisSegment)
-> Parser (Maybe Categories)
-> Parser (Maybe Transcript -> RealtimeContactAnalysisSegment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Categories)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Categories")
            Parser (Maybe Transcript -> RealtimeContactAnalysisSegment)
-> Parser (Maybe Transcript)
-> Parser RealtimeContactAnalysisSegment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Transcript)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Transcript")
      )

instance
  Prelude.Hashable
    RealtimeContactAnalysisSegment

instance
  Prelude.NFData
    RealtimeContactAnalysisSegment