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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(SuggestStatus -> SuggestStatus -> Bool)
-> (SuggestStatus -> SuggestStatus -> Bool) -> Eq SuggestStatus
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]
(Int -> ReadS SuggestStatus)
-> ReadS [SuggestStatus]
-> ReadPrec SuggestStatus
-> ReadPrec [SuggestStatus]
-> Read 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
(Int -> SuggestStatus -> ShowS)
-> (SuggestStatus -> String)
-> ([SuggestStatus] -> ShowS)
-> Show SuggestStatus
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. SuggestStatus -> Rep SuggestStatus x)
-> (forall x. Rep SuggestStatus x -> SuggestStatus)
-> Generic SuggestStatus
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' :: Maybe Text -> Maybe Integer -> SuggestStatus
SuggestStatus'
    { $sel:rid:SuggestStatus' :: Maybe Text
rid = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timems:SuggestStatus' :: Maybe Integer
timems = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The encrypted resource ID for the request.
suggestStatus_rid :: Lens.Lens' SuggestStatus (Prelude.Maybe Prelude.Text)
suggestStatus_rid :: (Maybe Text -> f (Maybe Text)) -> SuggestStatus -> f SuggestStatus
suggestStatus_rid = (SuggestStatus -> Maybe Text)
-> (SuggestStatus -> Maybe Text -> SuggestStatus)
-> Lens SuggestStatus SuggestStatus (Maybe Text) (Maybe Text)
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 :: (Maybe Integer -> f (Maybe Integer))
-> SuggestStatus -> f SuggestStatus
suggestStatus_timems = (SuggestStatus -> Maybe Integer)
-> (SuggestStatus -> Maybe Integer -> SuggestStatus)
-> Lens SuggestStatus SuggestStatus (Maybe Integer) (Maybe Integer)
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 Core.FromJSON SuggestStatus where
  parseJSON :: Value -> Parser SuggestStatus
parseJSON =
    String
-> (Object -> Parser SuggestStatus)
-> Value
-> Parser SuggestStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuggestStatus"
      ( \Object
x ->
          Maybe Text -> Maybe Integer -> SuggestStatus
SuggestStatus'
            (Maybe Text -> Maybe Integer -> SuggestStatus)
-> Parser (Maybe Text) -> Parser (Maybe Integer -> SuggestStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rid") Parser (Maybe Integer -> SuggestStatus)
-> Parser (Maybe Integer) -> Parser SuggestStatus
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
"timems")
      )

instance Prelude.Hashable SuggestStatus

instance Prelude.NFData SuggestStatus