{-# 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.ElasticSearch.Types.OptionStatus
-- 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.ElasticSearch.Types.OptionStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.OptionState
import qualified Amazonka.Prelude as Prelude

-- | Provides the current status of the entity.
--
-- /See:/ 'newOptionStatus' smart constructor.
data OptionStatus = OptionStatus'
  { -- | Indicates whether the Elasticsearch domain is being deleted.
    OptionStatus -> Maybe Bool
pendingDeletion :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the latest version for the entity.
    OptionStatus -> Maybe Natural
updateVersion :: Prelude.Maybe Prelude.Natural,
    -- | Timestamp which tells the creation date for the entity.
    OptionStatus -> POSIX
creationDate :: Data.POSIX,
    -- | Timestamp which tells the last updated time for the entity.
    OptionStatus -> POSIX
updateDate :: Data.POSIX,
    -- | Provides the @OptionState@ for the Elasticsearch domain.
    OptionStatus -> OptionState
state :: OptionState
  }
  deriving (OptionStatus -> OptionStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionStatus -> OptionStatus -> Bool
$c/= :: OptionStatus -> OptionStatus -> Bool
== :: OptionStatus -> OptionStatus -> Bool
$c== :: OptionStatus -> OptionStatus -> Bool
Prelude.Eq, ReadPrec [OptionStatus]
ReadPrec OptionStatus
Int -> ReadS OptionStatus
ReadS [OptionStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptionStatus]
$creadListPrec :: ReadPrec [OptionStatus]
readPrec :: ReadPrec OptionStatus
$creadPrec :: ReadPrec OptionStatus
readList :: ReadS [OptionStatus]
$creadList :: ReadS [OptionStatus]
readsPrec :: Int -> ReadS OptionStatus
$creadsPrec :: Int -> ReadS OptionStatus
Prelude.Read, Int -> OptionStatus -> ShowS
[OptionStatus] -> ShowS
OptionStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionStatus] -> ShowS
$cshowList :: [OptionStatus] -> ShowS
show :: OptionStatus -> String
$cshow :: OptionStatus -> String
showsPrec :: Int -> OptionStatus -> ShowS
$cshowsPrec :: Int -> OptionStatus -> ShowS
Prelude.Show, forall x. Rep OptionStatus x -> OptionStatus
forall x. OptionStatus -> Rep OptionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptionStatus x -> OptionStatus
$cfrom :: forall x. OptionStatus -> Rep OptionStatus x
Prelude.Generic)

-- |
-- Create a value of 'OptionStatus' 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:
--
-- 'pendingDeletion', 'optionStatus_pendingDeletion' - Indicates whether the Elasticsearch domain is being deleted.
--
-- 'updateVersion', 'optionStatus_updateVersion' - Specifies the latest version for the entity.
--
-- 'creationDate', 'optionStatus_creationDate' - Timestamp which tells the creation date for the entity.
--
-- 'updateDate', 'optionStatus_updateDate' - Timestamp which tells the last updated time for the entity.
--
-- 'state', 'optionStatus_state' - Provides the @OptionState@ for the Elasticsearch domain.
newOptionStatus ::
  -- | 'creationDate'
  Prelude.UTCTime ->
  -- | 'updateDate'
  Prelude.UTCTime ->
  -- | 'state'
  OptionState ->
  OptionStatus
newOptionStatus :: UTCTime -> UTCTime -> OptionState -> OptionStatus
newOptionStatus UTCTime
pCreationDate_ UTCTime
pUpdateDate_ OptionState
pState_ =
  OptionStatus'
    { $sel:pendingDeletion:OptionStatus' :: Maybe Bool
pendingDeletion = forall a. Maybe a
Prelude.Nothing,
      $sel:updateVersion:OptionStatus' :: Maybe Natural
updateVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:OptionStatus' :: POSIX
creationDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_,
      $sel:updateDate:OptionStatus' :: POSIX
updateDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateDate_,
      $sel:state:OptionStatus' :: OptionState
state = OptionState
pState_
    }

-- | Indicates whether the Elasticsearch domain is being deleted.
optionStatus_pendingDeletion :: Lens.Lens' OptionStatus (Prelude.Maybe Prelude.Bool)
optionStatus_pendingDeletion :: Lens' OptionStatus (Maybe Bool)
optionStatus_pendingDeletion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {Maybe Bool
pendingDeletion :: Maybe Bool
$sel:pendingDeletion:OptionStatus' :: OptionStatus -> Maybe Bool
pendingDeletion} -> Maybe Bool
pendingDeletion) (\s :: OptionStatus
s@OptionStatus' {} Maybe Bool
a -> OptionStatus
s {$sel:pendingDeletion:OptionStatus' :: Maybe Bool
pendingDeletion = Maybe Bool
a} :: OptionStatus)

-- | Specifies the latest version for the entity.
optionStatus_updateVersion :: Lens.Lens' OptionStatus (Prelude.Maybe Prelude.Natural)
optionStatus_updateVersion :: Lens' OptionStatus (Maybe Natural)
optionStatus_updateVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {Maybe Natural
updateVersion :: Maybe Natural
$sel:updateVersion:OptionStatus' :: OptionStatus -> Maybe Natural
updateVersion} -> Maybe Natural
updateVersion) (\s :: OptionStatus
s@OptionStatus' {} Maybe Natural
a -> OptionStatus
s {$sel:updateVersion:OptionStatus' :: Maybe Natural
updateVersion = Maybe Natural
a} :: OptionStatus)

-- | Timestamp which tells the creation date for the entity.
optionStatus_creationDate :: Lens.Lens' OptionStatus Prelude.UTCTime
optionStatus_creationDate :: Lens' OptionStatus UTCTime
optionStatus_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {POSIX
creationDate :: POSIX
$sel:creationDate:OptionStatus' :: OptionStatus -> POSIX
creationDate} -> POSIX
creationDate) (\s :: OptionStatus
s@OptionStatus' {} POSIX
a -> OptionStatus
s {$sel:creationDate:OptionStatus' :: POSIX
creationDate = POSIX
a} :: OptionStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Timestamp which tells the last updated time for the entity.
optionStatus_updateDate :: Lens.Lens' OptionStatus Prelude.UTCTime
optionStatus_updateDate :: Lens' OptionStatus UTCTime
optionStatus_updateDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {POSIX
updateDate :: POSIX
$sel:updateDate:OptionStatus' :: OptionStatus -> POSIX
updateDate} -> POSIX
updateDate) (\s :: OptionStatus
s@OptionStatus' {} POSIX
a -> OptionStatus
s {$sel:updateDate:OptionStatus' :: POSIX
updateDate = POSIX
a} :: OptionStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Provides the @OptionState@ for the Elasticsearch domain.
optionStatus_state :: Lens.Lens' OptionStatus OptionState
optionStatus_state :: Lens' OptionStatus OptionState
optionStatus_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {OptionState
state :: OptionState
$sel:state:OptionStatus' :: OptionStatus -> OptionState
state} -> OptionState
state) (\s :: OptionStatus
s@OptionStatus' {} OptionState
a -> OptionStatus
s {$sel:state:OptionStatus' :: OptionState
state = OptionState
a} :: OptionStatus)

instance Data.FromJSON OptionStatus where
  parseJSON :: Value -> Parser OptionStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OptionStatus"
      ( \Object
x ->
          Maybe Bool
-> Maybe Natural -> POSIX -> POSIX -> OptionState -> OptionStatus
OptionStatus'
            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
"PendingDeletion")
            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
"UpdateVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CreationDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"UpdateDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"State")
      )

instance Prelude.Hashable OptionStatus where
  hashWithSalt :: Int -> OptionStatus -> Int
hashWithSalt Int
_salt OptionStatus' {Maybe Bool
Maybe Natural
POSIX
OptionState
state :: OptionState
updateDate :: POSIX
creationDate :: POSIX
updateVersion :: Maybe Natural
pendingDeletion :: Maybe Bool
$sel:state:OptionStatus' :: OptionStatus -> OptionState
$sel:updateDate:OptionStatus' :: OptionStatus -> POSIX
$sel:creationDate:OptionStatus' :: OptionStatus -> POSIX
$sel:updateVersion:OptionStatus' :: OptionStatus -> Maybe Natural
$sel:pendingDeletion:OptionStatus' :: OptionStatus -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
pendingDeletion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
updateVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
updateDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OptionState
state

instance Prelude.NFData OptionStatus where
  rnf :: OptionStatus -> ()
rnf OptionStatus' {Maybe Bool
Maybe Natural
POSIX
OptionState
state :: OptionState
updateDate :: POSIX
creationDate :: POSIX
updateVersion :: Maybe Natural
pendingDeletion :: Maybe Bool
$sel:state:OptionStatus' :: OptionStatus -> OptionState
$sel:updateDate:OptionStatus' :: OptionStatus -> POSIX
$sel:creationDate:OptionStatus' :: OptionStatus -> POSIX
$sel:updateVersion:OptionStatus' :: OptionStatus -> Maybe Natural
$sel:pendingDeletion:OptionStatus' :: OptionStatus -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
pendingDeletion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
updateVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
updateDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf OptionState
state