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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | For characters that were detected as issues, where they occur in the
-- transcript.
--
-- /See:/ 'newCharacterOffsets' smart constructor.
data CharacterOffsets = CharacterOffsets'
  { -- | The beginning of the issue.
    CharacterOffsets -> Natural
beginOffsetChar :: Prelude.Natural,
    -- | The end of the issue.
    CharacterOffsets -> Natural
endOffsetChar :: Prelude.Natural
  }
  deriving (CharacterOffsets -> CharacterOffsets -> Bool
(CharacterOffsets -> CharacterOffsets -> Bool)
-> (CharacterOffsets -> CharacterOffsets -> Bool)
-> Eq CharacterOffsets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CharacterOffsets -> CharacterOffsets -> Bool
$c/= :: CharacterOffsets -> CharacterOffsets -> Bool
== :: CharacterOffsets -> CharacterOffsets -> Bool
$c== :: CharacterOffsets -> CharacterOffsets -> Bool
Prelude.Eq, ReadPrec [CharacterOffsets]
ReadPrec CharacterOffsets
Int -> ReadS CharacterOffsets
ReadS [CharacterOffsets]
(Int -> ReadS CharacterOffsets)
-> ReadS [CharacterOffsets]
-> ReadPrec CharacterOffsets
-> ReadPrec [CharacterOffsets]
-> Read CharacterOffsets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CharacterOffsets]
$creadListPrec :: ReadPrec [CharacterOffsets]
readPrec :: ReadPrec CharacterOffsets
$creadPrec :: ReadPrec CharacterOffsets
readList :: ReadS [CharacterOffsets]
$creadList :: ReadS [CharacterOffsets]
readsPrec :: Int -> ReadS CharacterOffsets
$creadsPrec :: Int -> ReadS CharacterOffsets
Prelude.Read, Int -> CharacterOffsets -> ShowS
[CharacterOffsets] -> ShowS
CharacterOffsets -> String
(Int -> CharacterOffsets -> ShowS)
-> (CharacterOffsets -> String)
-> ([CharacterOffsets] -> ShowS)
-> Show CharacterOffsets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CharacterOffsets] -> ShowS
$cshowList :: [CharacterOffsets] -> ShowS
show :: CharacterOffsets -> String
$cshow :: CharacterOffsets -> String
showsPrec :: Int -> CharacterOffsets -> ShowS
$cshowsPrec :: Int -> CharacterOffsets -> ShowS
Prelude.Show, (forall x. CharacterOffsets -> Rep CharacterOffsets x)
-> (forall x. Rep CharacterOffsets x -> CharacterOffsets)
-> Generic CharacterOffsets
forall x. Rep CharacterOffsets x -> CharacterOffsets
forall x. CharacterOffsets -> Rep CharacterOffsets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CharacterOffsets x -> CharacterOffsets
$cfrom :: forall x. CharacterOffsets -> Rep CharacterOffsets x
Prelude.Generic)

-- |
-- Create a value of 'CharacterOffsets' 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:
--
-- 'beginOffsetChar', 'characterOffsets_beginOffsetChar' - The beginning of the issue.
--
-- 'endOffsetChar', 'characterOffsets_endOffsetChar' - The end of the issue.
newCharacterOffsets ::
  -- | 'beginOffsetChar'
  Prelude.Natural ->
  -- | 'endOffsetChar'
  Prelude.Natural ->
  CharacterOffsets
newCharacterOffsets :: Natural -> Natural -> CharacterOffsets
newCharacterOffsets Natural
pBeginOffsetChar_ Natural
pEndOffsetChar_ =
  CharacterOffsets' :: Natural -> Natural -> CharacterOffsets
CharacterOffsets'
    { $sel:beginOffsetChar:CharacterOffsets' :: Natural
beginOffsetChar =
        Natural
pBeginOffsetChar_,
      $sel:endOffsetChar:CharacterOffsets' :: Natural
endOffsetChar = Natural
pEndOffsetChar_
    }

-- | The beginning of the issue.
characterOffsets_beginOffsetChar :: Lens.Lens' CharacterOffsets Prelude.Natural
characterOffsets_beginOffsetChar :: (Natural -> f Natural) -> CharacterOffsets -> f CharacterOffsets
characterOffsets_beginOffsetChar = (CharacterOffsets -> Natural)
-> (CharacterOffsets -> Natural -> CharacterOffsets)
-> Lens CharacterOffsets CharacterOffsets Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CharacterOffsets' {Natural
beginOffsetChar :: Natural
$sel:beginOffsetChar:CharacterOffsets' :: CharacterOffsets -> Natural
beginOffsetChar} -> Natural
beginOffsetChar) (\s :: CharacterOffsets
s@CharacterOffsets' {} Natural
a -> CharacterOffsets
s {$sel:beginOffsetChar:CharacterOffsets' :: Natural
beginOffsetChar = Natural
a} :: CharacterOffsets)

-- | The end of the issue.
characterOffsets_endOffsetChar :: Lens.Lens' CharacterOffsets Prelude.Natural
characterOffsets_endOffsetChar :: (Natural -> f Natural) -> CharacterOffsets -> f CharacterOffsets
characterOffsets_endOffsetChar = (CharacterOffsets -> Natural)
-> (CharacterOffsets -> Natural -> CharacterOffsets)
-> Lens CharacterOffsets CharacterOffsets Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CharacterOffsets' {Natural
endOffsetChar :: Natural
$sel:endOffsetChar:CharacterOffsets' :: CharacterOffsets -> Natural
endOffsetChar} -> Natural
endOffsetChar) (\s :: CharacterOffsets
s@CharacterOffsets' {} Natural
a -> CharacterOffsets
s {$sel:endOffsetChar:CharacterOffsets' :: Natural
endOffsetChar = Natural
a} :: CharacterOffsets)

instance Core.FromJSON CharacterOffsets where
  parseJSON :: Value -> Parser CharacterOffsets
parseJSON =
    String
-> (Object -> Parser CharacterOffsets)
-> Value
-> Parser CharacterOffsets
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CharacterOffsets"
      ( \Object
x ->
          Natural -> Natural -> CharacterOffsets
CharacterOffsets'
            (Natural -> Natural -> CharacterOffsets)
-> Parser Natural -> Parser (Natural -> CharacterOffsets)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BeginOffsetChar")
            Parser (Natural -> CharacterOffsets)
-> Parser Natural -> Parser CharacterOffsets
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
"EndOffsetChar")
      )

instance Prelude.Hashable CharacterOffsets

instance Prelude.NFData CharacterOffsets