{-# 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.Pinpoint.Types.VerificationResponse
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Pinpoint.Types.VerificationResponse where

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

-- | Verify OTP Message Response.
--
-- /See:/ 'newVerificationResponse' smart constructor.
data VerificationResponse = VerificationResponse'
  { -- | Specifies whether the OTP is valid or not.
    VerificationResponse -> Maybe Bool
valid :: Prelude.Maybe Prelude.Bool
  }
  deriving (VerificationResponse -> VerificationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VerificationResponse -> VerificationResponse -> Bool
$c/= :: VerificationResponse -> VerificationResponse -> Bool
== :: VerificationResponse -> VerificationResponse -> Bool
$c== :: VerificationResponse -> VerificationResponse -> Bool
Prelude.Eq, ReadPrec [VerificationResponse]
ReadPrec VerificationResponse
Int -> ReadS VerificationResponse
ReadS [VerificationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VerificationResponse]
$creadListPrec :: ReadPrec [VerificationResponse]
readPrec :: ReadPrec VerificationResponse
$creadPrec :: ReadPrec VerificationResponse
readList :: ReadS [VerificationResponse]
$creadList :: ReadS [VerificationResponse]
readsPrec :: Int -> ReadS VerificationResponse
$creadsPrec :: Int -> ReadS VerificationResponse
Prelude.Read, Int -> VerificationResponse -> ShowS
[VerificationResponse] -> ShowS
VerificationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VerificationResponse] -> ShowS
$cshowList :: [VerificationResponse] -> ShowS
show :: VerificationResponse -> String
$cshow :: VerificationResponse -> String
showsPrec :: Int -> VerificationResponse -> ShowS
$cshowsPrec :: Int -> VerificationResponse -> ShowS
Prelude.Show, forall x. Rep VerificationResponse x -> VerificationResponse
forall x. VerificationResponse -> Rep VerificationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VerificationResponse x -> VerificationResponse
$cfrom :: forall x. VerificationResponse -> Rep VerificationResponse x
Prelude.Generic)

-- |
-- Create a value of 'VerificationResponse' 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:
--
-- 'valid', 'verificationResponse_valid' - Specifies whether the OTP is valid or not.
newVerificationResponse ::
  VerificationResponse
newVerificationResponse :: VerificationResponse
newVerificationResponse =
  VerificationResponse' {$sel:valid:VerificationResponse' :: Maybe Bool
valid = forall a. Maybe a
Prelude.Nothing}

-- | Specifies whether the OTP is valid or not.
verificationResponse_valid :: Lens.Lens' VerificationResponse (Prelude.Maybe Prelude.Bool)
verificationResponse_valid :: Lens' VerificationResponse (Maybe Bool)
verificationResponse_valid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerificationResponse' {Maybe Bool
valid :: Maybe Bool
$sel:valid:VerificationResponse' :: VerificationResponse -> Maybe Bool
valid} -> Maybe Bool
valid) (\s :: VerificationResponse
s@VerificationResponse' {} Maybe Bool
a -> VerificationResponse
s {$sel:valid:VerificationResponse' :: Maybe Bool
valid = Maybe Bool
a} :: VerificationResponse)

instance Data.FromJSON VerificationResponse where
  parseJSON :: Value -> Parser VerificationResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VerificationResponse"
      ( \Object
x ->
          Maybe Bool -> VerificationResponse
VerificationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Valid")
      )

instance Prelude.Hashable VerificationResponse where
  hashWithSalt :: Int -> VerificationResponse -> Int
hashWithSalt Int
_salt VerificationResponse' {Maybe Bool
valid :: Maybe Bool
$sel:valid:VerificationResponse' :: VerificationResponse -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
valid

instance Prelude.NFData VerificationResponse where
  rnf :: VerificationResponse -> ()
rnf VerificationResponse' {Maybe Bool
valid :: Maybe Bool
$sel:valid:VerificationResponse' :: VerificationResponse -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
valid