{-# 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.WorkSpaces.Types.ModificationState
-- 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.WorkSpaces.Types.ModificationState where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.ModificationResourceEnum
import Amazonka.WorkSpaces.Types.ModificationStateEnum

-- | Describes a WorkSpace modification.
--
-- /See:/ 'newModificationState' smart constructor.
data ModificationState = ModificationState'
  { -- | The modification state.
    ModificationState -> Maybe ModificationStateEnum
state :: Prelude.Maybe ModificationStateEnum,
    -- | The resource.
    ModificationState -> Maybe ModificationResourceEnum
resource :: Prelude.Maybe ModificationResourceEnum
  }
  deriving (ModificationState -> ModificationState -> Bool
(ModificationState -> ModificationState -> Bool)
-> (ModificationState -> ModificationState -> Bool)
-> Eq ModificationState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModificationState -> ModificationState -> Bool
$c/= :: ModificationState -> ModificationState -> Bool
== :: ModificationState -> ModificationState -> Bool
$c== :: ModificationState -> ModificationState -> Bool
Prelude.Eq, ReadPrec [ModificationState]
ReadPrec ModificationState
Int -> ReadS ModificationState
ReadS [ModificationState]
(Int -> ReadS ModificationState)
-> ReadS [ModificationState]
-> ReadPrec ModificationState
-> ReadPrec [ModificationState]
-> Read ModificationState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModificationState]
$creadListPrec :: ReadPrec [ModificationState]
readPrec :: ReadPrec ModificationState
$creadPrec :: ReadPrec ModificationState
readList :: ReadS [ModificationState]
$creadList :: ReadS [ModificationState]
readsPrec :: Int -> ReadS ModificationState
$creadsPrec :: Int -> ReadS ModificationState
Prelude.Read, Int -> ModificationState -> ShowS
[ModificationState] -> ShowS
ModificationState -> String
(Int -> ModificationState -> ShowS)
-> (ModificationState -> String)
-> ([ModificationState] -> ShowS)
-> Show ModificationState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModificationState] -> ShowS
$cshowList :: [ModificationState] -> ShowS
show :: ModificationState -> String
$cshow :: ModificationState -> String
showsPrec :: Int -> ModificationState -> ShowS
$cshowsPrec :: Int -> ModificationState -> ShowS
Prelude.Show, (forall x. ModificationState -> Rep ModificationState x)
-> (forall x. Rep ModificationState x -> ModificationState)
-> Generic ModificationState
forall x. Rep ModificationState x -> ModificationState
forall x. ModificationState -> Rep ModificationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModificationState x -> ModificationState
$cfrom :: forall x. ModificationState -> Rep ModificationState x
Prelude.Generic)

-- |
-- Create a value of 'ModificationState' 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:
--
-- 'state', 'modificationState_state' - The modification state.
--
-- 'resource', 'modificationState_resource' - The resource.
newModificationState ::
  ModificationState
newModificationState :: ModificationState
newModificationState =
  ModificationState' :: Maybe ModificationStateEnum
-> Maybe ModificationResourceEnum -> ModificationState
ModificationState'
    { $sel:state:ModificationState' :: Maybe ModificationStateEnum
state = Maybe ModificationStateEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:resource:ModificationState' :: Maybe ModificationResourceEnum
resource = Maybe ModificationResourceEnum
forall a. Maybe a
Prelude.Nothing
    }

-- | The modification state.
modificationState_state :: Lens.Lens' ModificationState (Prelude.Maybe ModificationStateEnum)
modificationState_state :: (Maybe ModificationStateEnum -> f (Maybe ModificationStateEnum))
-> ModificationState -> f ModificationState
modificationState_state = (ModificationState -> Maybe ModificationStateEnum)
-> (ModificationState
    -> Maybe ModificationStateEnum -> ModificationState)
-> Lens
     ModificationState
     ModificationState
     (Maybe ModificationStateEnum)
     (Maybe ModificationStateEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModificationState' {Maybe ModificationStateEnum
state :: Maybe ModificationStateEnum
$sel:state:ModificationState' :: ModificationState -> Maybe ModificationStateEnum
state} -> Maybe ModificationStateEnum
state) (\s :: ModificationState
s@ModificationState' {} Maybe ModificationStateEnum
a -> ModificationState
s {$sel:state:ModificationState' :: Maybe ModificationStateEnum
state = Maybe ModificationStateEnum
a} :: ModificationState)

-- | The resource.
modificationState_resource :: Lens.Lens' ModificationState (Prelude.Maybe ModificationResourceEnum)
modificationState_resource :: (Maybe ModificationResourceEnum
 -> f (Maybe ModificationResourceEnum))
-> ModificationState -> f ModificationState
modificationState_resource = (ModificationState -> Maybe ModificationResourceEnum)
-> (ModificationState
    -> Maybe ModificationResourceEnum -> ModificationState)
-> Lens
     ModificationState
     ModificationState
     (Maybe ModificationResourceEnum)
     (Maybe ModificationResourceEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModificationState' {Maybe ModificationResourceEnum
resource :: Maybe ModificationResourceEnum
$sel:resource:ModificationState' :: ModificationState -> Maybe ModificationResourceEnum
resource} -> Maybe ModificationResourceEnum
resource) (\s :: ModificationState
s@ModificationState' {} Maybe ModificationResourceEnum
a -> ModificationState
s {$sel:resource:ModificationState' :: Maybe ModificationResourceEnum
resource = Maybe ModificationResourceEnum
a} :: ModificationState)

instance Core.FromJSON ModificationState where
  parseJSON :: Value -> Parser ModificationState
parseJSON =
    String
-> (Object -> Parser ModificationState)
-> Value
-> Parser ModificationState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModificationState"
      ( \Object
x ->
          Maybe ModificationStateEnum
-> Maybe ModificationResourceEnum -> ModificationState
ModificationState'
            (Maybe ModificationStateEnum
 -> Maybe ModificationResourceEnum -> ModificationState)
-> Parser (Maybe ModificationStateEnum)
-> Parser (Maybe ModificationResourceEnum -> ModificationState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ModificationStateEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser (Maybe ModificationResourceEnum -> ModificationState)
-> Parser (Maybe ModificationResourceEnum)
-> Parser ModificationState
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ModificationResourceEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Resource")
      )

instance Prelude.Hashable ModificationState

instance Prelude.NFData ModificationState