{-# 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.WellArchitected.Types.PillarDifference
-- 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.WellArchitected.Types.PillarDifference where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WellArchitected.Types.DifferenceStatus
import Amazonka.WellArchitected.Types.QuestionDifference

-- | A pillar difference return object.
--
-- /See:/ 'newPillarDifference' smart constructor.
data PillarDifference = PillarDifference'
  { PillarDifference -> Maybe Text
pillarId :: Prelude.Maybe Prelude.Text,
    -- | List of question differences.
    PillarDifference -> Maybe [QuestionDifference]
questionDifferences :: Prelude.Maybe [QuestionDifference],
    -- | Indicates the type of change to the pillar.
    PillarDifference -> Maybe DifferenceStatus
differenceStatus :: Prelude.Maybe DifferenceStatus
  }
  deriving (PillarDifference -> PillarDifference -> Bool
(PillarDifference -> PillarDifference -> Bool)
-> (PillarDifference -> PillarDifference -> Bool)
-> Eq PillarDifference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PillarDifference -> PillarDifference -> Bool
$c/= :: PillarDifference -> PillarDifference -> Bool
== :: PillarDifference -> PillarDifference -> Bool
$c== :: PillarDifference -> PillarDifference -> Bool
Prelude.Eq, ReadPrec [PillarDifference]
ReadPrec PillarDifference
Int -> ReadS PillarDifference
ReadS [PillarDifference]
(Int -> ReadS PillarDifference)
-> ReadS [PillarDifference]
-> ReadPrec PillarDifference
-> ReadPrec [PillarDifference]
-> Read PillarDifference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PillarDifference]
$creadListPrec :: ReadPrec [PillarDifference]
readPrec :: ReadPrec PillarDifference
$creadPrec :: ReadPrec PillarDifference
readList :: ReadS [PillarDifference]
$creadList :: ReadS [PillarDifference]
readsPrec :: Int -> ReadS PillarDifference
$creadsPrec :: Int -> ReadS PillarDifference
Prelude.Read, Int -> PillarDifference -> ShowS
[PillarDifference] -> ShowS
PillarDifference -> String
(Int -> PillarDifference -> ShowS)
-> (PillarDifference -> String)
-> ([PillarDifference] -> ShowS)
-> Show PillarDifference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PillarDifference] -> ShowS
$cshowList :: [PillarDifference] -> ShowS
show :: PillarDifference -> String
$cshow :: PillarDifference -> String
showsPrec :: Int -> PillarDifference -> ShowS
$cshowsPrec :: Int -> PillarDifference -> ShowS
Prelude.Show, (forall x. PillarDifference -> Rep PillarDifference x)
-> (forall x. Rep PillarDifference x -> PillarDifference)
-> Generic PillarDifference
forall x. Rep PillarDifference x -> PillarDifference
forall x. PillarDifference -> Rep PillarDifference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PillarDifference x -> PillarDifference
$cfrom :: forall x. PillarDifference -> Rep PillarDifference x
Prelude.Generic)

-- |
-- Create a value of 'PillarDifference' 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:
--
-- 'pillarId', 'pillarDifference_pillarId' - Undocumented member.
--
-- 'questionDifferences', 'pillarDifference_questionDifferences' - List of question differences.
--
-- 'differenceStatus', 'pillarDifference_differenceStatus' - Indicates the type of change to the pillar.
newPillarDifference ::
  PillarDifference
newPillarDifference :: PillarDifference
newPillarDifference =
  PillarDifference' :: Maybe Text
-> Maybe [QuestionDifference]
-> Maybe DifferenceStatus
-> PillarDifference
PillarDifference'
    { $sel:pillarId:PillarDifference' :: Maybe Text
pillarId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:questionDifferences:PillarDifference' :: Maybe [QuestionDifference]
questionDifferences = Maybe [QuestionDifference]
forall a. Maybe a
Prelude.Nothing,
      $sel:differenceStatus:PillarDifference' :: Maybe DifferenceStatus
differenceStatus = Maybe DifferenceStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
pillarDifference_pillarId :: Lens.Lens' PillarDifference (Prelude.Maybe Prelude.Text)
pillarDifference_pillarId :: (Maybe Text -> f (Maybe Text))
-> PillarDifference -> f PillarDifference
pillarDifference_pillarId = (PillarDifference -> Maybe Text)
-> (PillarDifference -> Maybe Text -> PillarDifference)
-> Lens PillarDifference PillarDifference (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PillarDifference' {Maybe Text
pillarId :: Maybe Text
$sel:pillarId:PillarDifference' :: PillarDifference -> Maybe Text
pillarId} -> Maybe Text
pillarId) (\s :: PillarDifference
s@PillarDifference' {} Maybe Text
a -> PillarDifference
s {$sel:pillarId:PillarDifference' :: Maybe Text
pillarId = Maybe Text
a} :: PillarDifference)

-- | List of question differences.
pillarDifference_questionDifferences :: Lens.Lens' PillarDifference (Prelude.Maybe [QuestionDifference])
pillarDifference_questionDifferences :: (Maybe [QuestionDifference] -> f (Maybe [QuestionDifference]))
-> PillarDifference -> f PillarDifference
pillarDifference_questionDifferences = (PillarDifference -> Maybe [QuestionDifference])
-> (PillarDifference
    -> Maybe [QuestionDifference] -> PillarDifference)
-> Lens
     PillarDifference
     PillarDifference
     (Maybe [QuestionDifference])
     (Maybe [QuestionDifference])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PillarDifference' {Maybe [QuestionDifference]
questionDifferences :: Maybe [QuestionDifference]
$sel:questionDifferences:PillarDifference' :: PillarDifference -> Maybe [QuestionDifference]
questionDifferences} -> Maybe [QuestionDifference]
questionDifferences) (\s :: PillarDifference
s@PillarDifference' {} Maybe [QuestionDifference]
a -> PillarDifference
s {$sel:questionDifferences:PillarDifference' :: Maybe [QuestionDifference]
questionDifferences = Maybe [QuestionDifference]
a} :: PillarDifference) ((Maybe [QuestionDifference] -> f (Maybe [QuestionDifference]))
 -> PillarDifference -> f PillarDifference)
-> ((Maybe [QuestionDifference] -> f (Maybe [QuestionDifference]))
    -> Maybe [QuestionDifference] -> f (Maybe [QuestionDifference]))
-> (Maybe [QuestionDifference] -> f (Maybe [QuestionDifference]))
-> PillarDifference
-> f PillarDifference
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [QuestionDifference]
  [QuestionDifference]
  [QuestionDifference]
  [QuestionDifference]
-> Iso
     (Maybe [QuestionDifference])
     (Maybe [QuestionDifference])
     (Maybe [QuestionDifference])
     (Maybe [QuestionDifference])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [QuestionDifference]
  [QuestionDifference]
  [QuestionDifference]
  [QuestionDifference]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates the type of change to the pillar.
pillarDifference_differenceStatus :: Lens.Lens' PillarDifference (Prelude.Maybe DifferenceStatus)
pillarDifference_differenceStatus :: (Maybe DifferenceStatus -> f (Maybe DifferenceStatus))
-> PillarDifference -> f PillarDifference
pillarDifference_differenceStatus = (PillarDifference -> Maybe DifferenceStatus)
-> (PillarDifference -> Maybe DifferenceStatus -> PillarDifference)
-> Lens
     PillarDifference
     PillarDifference
     (Maybe DifferenceStatus)
     (Maybe DifferenceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PillarDifference' {Maybe DifferenceStatus
differenceStatus :: Maybe DifferenceStatus
$sel:differenceStatus:PillarDifference' :: PillarDifference -> Maybe DifferenceStatus
differenceStatus} -> Maybe DifferenceStatus
differenceStatus) (\s :: PillarDifference
s@PillarDifference' {} Maybe DifferenceStatus
a -> PillarDifference
s {$sel:differenceStatus:PillarDifference' :: Maybe DifferenceStatus
differenceStatus = Maybe DifferenceStatus
a} :: PillarDifference)

instance Core.FromJSON PillarDifference where
  parseJSON :: Value -> Parser PillarDifference
parseJSON =
    String
-> (Object -> Parser PillarDifference)
-> Value
-> Parser PillarDifference
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PillarDifference"
      ( \Object
x ->
          Maybe Text
-> Maybe [QuestionDifference]
-> Maybe DifferenceStatus
-> PillarDifference
PillarDifference'
            (Maybe Text
 -> Maybe [QuestionDifference]
 -> Maybe DifferenceStatus
 -> PillarDifference)
-> Parser (Maybe Text)
-> Parser
     (Maybe [QuestionDifference]
      -> Maybe DifferenceStatus -> PillarDifference)
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
"PillarId")
            Parser
  (Maybe [QuestionDifference]
   -> Maybe DifferenceStatus -> PillarDifference)
-> Parser (Maybe [QuestionDifference])
-> Parser (Maybe DifferenceStatus -> PillarDifference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [QuestionDifference]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"QuestionDifferences"
                            Parser (Maybe (Maybe [QuestionDifference]))
-> Maybe [QuestionDifference]
-> Parser (Maybe [QuestionDifference])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [QuestionDifference]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe DifferenceStatus -> PillarDifference)
-> Parser (Maybe DifferenceStatus) -> Parser PillarDifference
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DifferenceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DifferenceStatus")
      )

instance Prelude.Hashable PillarDifference

instance Prelude.NFData PillarDifference