{-# 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.CloudSearchDomains.Types.SuggestStatus
-- 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.CloudSearchDomains.Types.SuggestStatus 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

-- | Contains the resource id (@rid@) and the time it took to process the
-- request (@timems@).
--
-- /See:/ 'newSuggestStatus' smart constructor.
data SuggestStatus = SuggestStatus'
  { -- | The encrypted resource ID for the request.
    SuggestStatus -> Maybe Text
rid :: Prelude.Maybe Prelude.Text,
    -- | How long it took to process the request, in milliseconds.
    SuggestStatus -> Maybe Integer
timems :: Prelude.Maybe Prelude.Integer
  }
  deriving (SuggestStatus -> SuggestStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuggestStatus -> SuggestStatus -> Bool
$c/= :: SuggestStatus -> SuggestStatus -> Bool
== :: SuggestStatus -> SuggestStatus -> Bool
$c== :: SuggestStatus -> SuggestStatus -> Bool
Prelude.Eq, ReadPrec [SuggestStatus]
ReadPrec SuggestStatus
Int -> ReadS SuggestStatus
ReadS [SuggestStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuggestStatus]
$creadListPrec :: ReadPrec [SuggestStatus]
readPrec :: ReadPrec SuggestStatus
$creadPrec :: ReadPrec SuggestStatus
readList :: ReadS [SuggestStatus]
$creadList :: ReadS [SuggestStatus]
readsPrec :: Int -> ReadS SuggestStatus
$creadsPrec :: Int -> ReadS SuggestStatus
Prelude.Read, Int -> SuggestStatus -> ShowS
[SuggestStatus] -> ShowS
SuggestStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuggestStatus] -> ShowS
$cshowList :: [SuggestStatus] -> ShowS
show :: SuggestStatus -> String
$cshow :: SuggestStatus -> String
showsPrec :: Int -> SuggestStatus -> ShowS
$cshowsPrec :: Int -> SuggestStatus -> ShowS
Prelude.Show, forall x. Rep SuggestStatus x -> SuggestStatus
forall x. SuggestStatus -> Rep SuggestStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuggestStatus x -> SuggestStatus
$cfrom :: forall x. SuggestStatus -> Rep SuggestStatus x
Prelude.Generic)

-- |
-- Create a value of 'SuggestStatus' 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:
--
-- 'rid', 'suggestStatus_rid' - The encrypted resource ID for the request.
--
-- 'timems', 'suggestStatus_timems' - How long it took to process the request, in milliseconds.
newSuggestStatus ::
  SuggestStatus
newSuggestStatus :: SuggestStatus
newSuggestStatus =
  SuggestStatus'
    { $sel:rid:SuggestStatus' :: Maybe Text
rid = forall a. Maybe a
Prelude.Nothing,
      $sel:timems:SuggestStatus' :: Maybe Integer
timems = forall a. Maybe a
Prelude.Nothing
    }

-- | The encrypted resource ID for the request.
suggestStatus_rid :: Lens.Lens' SuggestStatus (Prelude.Maybe Prelude.Text)
suggestStatus_rid :: Lens' SuggestStatus (Maybe Text)
suggestStatus_rid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuggestStatus' {Maybe Text
rid :: Maybe Text
$sel:rid:SuggestStatus' :: SuggestStatus -> Maybe Text
rid} -> Maybe Text
rid) (\s :: SuggestStatus
s@SuggestStatus' {} Maybe Text
a -> SuggestStatus
s {$sel:rid:SuggestStatus' :: Maybe Text
rid = Maybe Text
a} :: SuggestStatus)

-- | How long it took to process the request, in milliseconds.
suggestStatus_timems :: Lens.Lens' SuggestStatus (Prelude.Maybe Prelude.Integer)
suggestStatus_timems :: Lens' SuggestStatus (Maybe Integer)
suggestStatus_timems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuggestStatus' {Maybe Integer
timems :: Maybe Integer
$sel:timems:SuggestStatus' :: SuggestStatus -> Maybe Integer
timems} -> Maybe Integer
timems) (\s :: SuggestStatus
s@SuggestStatus' {} Maybe Integer
a -> SuggestStatus
s {$sel:timems:SuggestStatus' :: Maybe Integer
timems = Maybe Integer
a} :: SuggestStatus)

instance Data.FromJSON SuggestStatus where
  parseJSON :: Value -> Parser SuggestStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SuggestStatus"
      ( \Object
x ->
          Maybe Text -> Maybe Integer -> SuggestStatus
SuggestStatus'
            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
"rid")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timems")
      )

instance Prelude.Hashable SuggestStatus where
  hashWithSalt :: Int -> SuggestStatus -> Int
hashWithSalt Int
_salt SuggestStatus' {Maybe Integer
Maybe Text
timems :: Maybe Integer
rid :: Maybe Text
$sel:timems:SuggestStatus' :: SuggestStatus -> Maybe Integer
$sel:rid:SuggestStatus' :: SuggestStatus -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rid
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
timems

instance Prelude.NFData SuggestStatus where
  rnf :: SuggestStatus -> ()
rnf SuggestStatus' {Maybe Integer
Maybe Text
timems :: Maybe Integer
rid :: Maybe Text
$sel:timems:SuggestStatus' :: SuggestStatus -> Maybe Integer
$sel:rid:SuggestStatus' :: SuggestStatus -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rid seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
timems