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

import Amazonka.ConnectContactLens.Types.CharacterOffsets
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Potential issues that are detected based on an artificial intelligence
-- analysis of each turn in the conversation.
--
-- /See:/ 'newIssueDetected' smart constructor.
data IssueDetected = IssueDetected'
  { -- | The offset for when the issue was detected in the segment.
    IssueDetected -> CharacterOffsets
characterOffsets :: CharacterOffsets
  }
  deriving (IssueDetected -> IssueDetected -> Bool
(IssueDetected -> IssueDetected -> Bool)
-> (IssueDetected -> IssueDetected -> Bool) -> Eq IssueDetected
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IssueDetected -> IssueDetected -> Bool
$c/= :: IssueDetected -> IssueDetected -> Bool
== :: IssueDetected -> IssueDetected -> Bool
$c== :: IssueDetected -> IssueDetected -> Bool
Prelude.Eq, ReadPrec [IssueDetected]
ReadPrec IssueDetected
Int -> ReadS IssueDetected
ReadS [IssueDetected]
(Int -> ReadS IssueDetected)
-> ReadS [IssueDetected]
-> ReadPrec IssueDetected
-> ReadPrec [IssueDetected]
-> Read IssueDetected
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IssueDetected]
$creadListPrec :: ReadPrec [IssueDetected]
readPrec :: ReadPrec IssueDetected
$creadPrec :: ReadPrec IssueDetected
readList :: ReadS [IssueDetected]
$creadList :: ReadS [IssueDetected]
readsPrec :: Int -> ReadS IssueDetected
$creadsPrec :: Int -> ReadS IssueDetected
Prelude.Read, Int -> IssueDetected -> ShowS
[IssueDetected] -> ShowS
IssueDetected -> String
(Int -> IssueDetected -> ShowS)
-> (IssueDetected -> String)
-> ([IssueDetected] -> ShowS)
-> Show IssueDetected
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IssueDetected] -> ShowS
$cshowList :: [IssueDetected] -> ShowS
show :: IssueDetected -> String
$cshow :: IssueDetected -> String
showsPrec :: Int -> IssueDetected -> ShowS
$cshowsPrec :: Int -> IssueDetected -> ShowS
Prelude.Show, (forall x. IssueDetected -> Rep IssueDetected x)
-> (forall x. Rep IssueDetected x -> IssueDetected)
-> Generic IssueDetected
forall x. Rep IssueDetected x -> IssueDetected
forall x. IssueDetected -> Rep IssueDetected x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IssueDetected x -> IssueDetected
$cfrom :: forall x. IssueDetected -> Rep IssueDetected x
Prelude.Generic)

-- |
-- Create a value of 'IssueDetected' 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:
--
-- 'characterOffsets', 'issueDetected_characterOffsets' - The offset for when the issue was detected in the segment.
newIssueDetected ::
  -- | 'characterOffsets'
  CharacterOffsets ->
  IssueDetected
newIssueDetected :: CharacterOffsets -> IssueDetected
newIssueDetected CharacterOffsets
pCharacterOffsets_ =
  IssueDetected' :: CharacterOffsets -> IssueDetected
IssueDetected'
    { $sel:characterOffsets:IssueDetected' :: CharacterOffsets
characterOffsets =
        CharacterOffsets
pCharacterOffsets_
    }

-- | The offset for when the issue was detected in the segment.
issueDetected_characterOffsets :: Lens.Lens' IssueDetected CharacterOffsets
issueDetected_characterOffsets :: (CharacterOffsets -> f CharacterOffsets)
-> IssueDetected -> f IssueDetected
issueDetected_characterOffsets = (IssueDetected -> CharacterOffsets)
-> (IssueDetected -> CharacterOffsets -> IssueDetected)
-> Lens
     IssueDetected IssueDetected CharacterOffsets CharacterOffsets
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IssueDetected' {CharacterOffsets
characterOffsets :: CharacterOffsets
$sel:characterOffsets:IssueDetected' :: IssueDetected -> CharacterOffsets
characterOffsets} -> CharacterOffsets
characterOffsets) (\s :: IssueDetected
s@IssueDetected' {} CharacterOffsets
a -> IssueDetected
s {$sel:characterOffsets:IssueDetected' :: CharacterOffsets
characterOffsets = CharacterOffsets
a} :: IssueDetected)

instance Core.FromJSON IssueDetected where
  parseJSON :: Value -> Parser IssueDetected
parseJSON =
    String
-> (Object -> Parser IssueDetected)
-> Value
-> Parser IssueDetected
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IssueDetected"
      ( \Object
x ->
          CharacterOffsets -> IssueDetected
IssueDetected'
            (CharacterOffsets -> IssueDetected)
-> Parser CharacterOffsets -> Parser IssueDetected
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser CharacterOffsets
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CharacterOffsets")
      )

instance Prelude.Hashable IssueDetected

instance Prelude.NFData IssueDetected