{-# 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.Rekognition.Types.TextDetectionResult
-- 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.Rekognition.Types.TextDetectionResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.TextDetection

-- | Information about text detected in a video. Incudes the detected text,
-- the time in milliseconds from the start of the video that the text was
-- detected, and where it was detected on the screen.
--
-- /See:/ 'newTextDetectionResult' smart constructor.
data TextDetectionResult = TextDetectionResult'
  { -- | Details about text detected in a video.
    TextDetectionResult -> Maybe TextDetection
textDetection :: Prelude.Maybe TextDetection,
    -- | The time, in milliseconds from the start of the video, that the text was
    -- detected.
    TextDetectionResult -> Maybe Integer
timestamp :: Prelude.Maybe Prelude.Integer
  }
  deriving (TextDetectionResult -> TextDetectionResult -> Bool
(TextDetectionResult -> TextDetectionResult -> Bool)
-> (TextDetectionResult -> TextDetectionResult -> Bool)
-> Eq TextDetectionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDetectionResult -> TextDetectionResult -> Bool
$c/= :: TextDetectionResult -> TextDetectionResult -> Bool
== :: TextDetectionResult -> TextDetectionResult -> Bool
$c== :: TextDetectionResult -> TextDetectionResult -> Bool
Prelude.Eq, ReadPrec [TextDetectionResult]
ReadPrec TextDetectionResult
Int -> ReadS TextDetectionResult
ReadS [TextDetectionResult]
(Int -> ReadS TextDetectionResult)
-> ReadS [TextDetectionResult]
-> ReadPrec TextDetectionResult
-> ReadPrec [TextDetectionResult]
-> Read TextDetectionResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextDetectionResult]
$creadListPrec :: ReadPrec [TextDetectionResult]
readPrec :: ReadPrec TextDetectionResult
$creadPrec :: ReadPrec TextDetectionResult
readList :: ReadS [TextDetectionResult]
$creadList :: ReadS [TextDetectionResult]
readsPrec :: Int -> ReadS TextDetectionResult
$creadsPrec :: Int -> ReadS TextDetectionResult
Prelude.Read, Int -> TextDetectionResult -> ShowS
[TextDetectionResult] -> ShowS
TextDetectionResult -> String
(Int -> TextDetectionResult -> ShowS)
-> (TextDetectionResult -> String)
-> ([TextDetectionResult] -> ShowS)
-> Show TextDetectionResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDetectionResult] -> ShowS
$cshowList :: [TextDetectionResult] -> ShowS
show :: TextDetectionResult -> String
$cshow :: TextDetectionResult -> String
showsPrec :: Int -> TextDetectionResult -> ShowS
$cshowsPrec :: Int -> TextDetectionResult -> ShowS
Prelude.Show, (forall x. TextDetectionResult -> Rep TextDetectionResult x)
-> (forall x. Rep TextDetectionResult x -> TextDetectionResult)
-> Generic TextDetectionResult
forall x. Rep TextDetectionResult x -> TextDetectionResult
forall x. TextDetectionResult -> Rep TextDetectionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextDetectionResult x -> TextDetectionResult
$cfrom :: forall x. TextDetectionResult -> Rep TextDetectionResult x
Prelude.Generic)

-- |
-- Create a value of 'TextDetectionResult' 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:
--
-- 'textDetection', 'textDetectionResult_textDetection' - Details about text detected in a video.
--
-- 'timestamp', 'textDetectionResult_timestamp' - The time, in milliseconds from the start of the video, that the text was
-- detected.
newTextDetectionResult ::
  TextDetectionResult
newTextDetectionResult :: TextDetectionResult
newTextDetectionResult =
  TextDetectionResult' :: Maybe TextDetection -> Maybe Integer -> TextDetectionResult
TextDetectionResult'
    { $sel:textDetection:TextDetectionResult' :: Maybe TextDetection
textDetection =
        Maybe TextDetection
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:TextDetectionResult' :: Maybe Integer
timestamp = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | Details about text detected in a video.
textDetectionResult_textDetection :: Lens.Lens' TextDetectionResult (Prelude.Maybe TextDetection)
textDetectionResult_textDetection :: (Maybe TextDetection -> f (Maybe TextDetection))
-> TextDetectionResult -> f TextDetectionResult
textDetectionResult_textDetection = (TextDetectionResult -> Maybe TextDetection)
-> (TextDetectionResult
    -> Maybe TextDetection -> TextDetectionResult)
-> Lens
     TextDetectionResult
     TextDetectionResult
     (Maybe TextDetection)
     (Maybe TextDetection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetectionResult' {Maybe TextDetection
textDetection :: Maybe TextDetection
$sel:textDetection:TextDetectionResult' :: TextDetectionResult -> Maybe TextDetection
textDetection} -> Maybe TextDetection
textDetection) (\s :: TextDetectionResult
s@TextDetectionResult' {} Maybe TextDetection
a -> TextDetectionResult
s {$sel:textDetection:TextDetectionResult' :: Maybe TextDetection
textDetection = Maybe TextDetection
a} :: TextDetectionResult)

-- | The time, in milliseconds from the start of the video, that the text was
-- detected.
textDetectionResult_timestamp :: Lens.Lens' TextDetectionResult (Prelude.Maybe Prelude.Integer)
textDetectionResult_timestamp :: (Maybe Integer -> f (Maybe Integer))
-> TextDetectionResult -> f TextDetectionResult
textDetectionResult_timestamp = (TextDetectionResult -> Maybe Integer)
-> (TextDetectionResult -> Maybe Integer -> TextDetectionResult)
-> Lens
     TextDetectionResult
     TextDetectionResult
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextDetectionResult' {Maybe Integer
timestamp :: Maybe Integer
$sel:timestamp:TextDetectionResult' :: TextDetectionResult -> Maybe Integer
timestamp} -> Maybe Integer
timestamp) (\s :: TextDetectionResult
s@TextDetectionResult' {} Maybe Integer
a -> TextDetectionResult
s {$sel:timestamp:TextDetectionResult' :: Maybe Integer
timestamp = Maybe Integer
a} :: TextDetectionResult)

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

instance Prelude.Hashable TextDetectionResult

instance Prelude.NFData TextDetectionResult