{-# 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.Milestone
-- 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.Milestone where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WellArchitected.Types.Workload

-- | A milestone return object.
--
-- /See:/ 'newMilestone' smart constructor.
data Milestone = Milestone'
  { Milestone -> Maybe Workload
workload :: Prelude.Maybe Workload,
    Milestone -> Maybe Natural
milestoneNumber :: Prelude.Maybe Prelude.Natural,
    Milestone -> Maybe Text
milestoneName :: Prelude.Maybe Prelude.Text,
    Milestone -> Maybe POSIX
recordedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (Milestone -> Milestone -> Bool
(Milestone -> Milestone -> Bool)
-> (Milestone -> Milestone -> Bool) -> Eq Milestone
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Milestone -> Milestone -> Bool
$c/= :: Milestone -> Milestone -> Bool
== :: Milestone -> Milestone -> Bool
$c== :: Milestone -> Milestone -> Bool
Prelude.Eq, ReadPrec [Milestone]
ReadPrec Milestone
Int -> ReadS Milestone
ReadS [Milestone]
(Int -> ReadS Milestone)
-> ReadS [Milestone]
-> ReadPrec Milestone
-> ReadPrec [Milestone]
-> Read Milestone
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Milestone]
$creadListPrec :: ReadPrec [Milestone]
readPrec :: ReadPrec Milestone
$creadPrec :: ReadPrec Milestone
readList :: ReadS [Milestone]
$creadList :: ReadS [Milestone]
readsPrec :: Int -> ReadS Milestone
$creadsPrec :: Int -> ReadS Milestone
Prelude.Read, Int -> Milestone -> ShowS
[Milestone] -> ShowS
Milestone -> String
(Int -> Milestone -> ShowS)
-> (Milestone -> String)
-> ([Milestone] -> ShowS)
-> Show Milestone
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Milestone] -> ShowS
$cshowList :: [Milestone] -> ShowS
show :: Milestone -> String
$cshow :: Milestone -> String
showsPrec :: Int -> Milestone -> ShowS
$cshowsPrec :: Int -> Milestone -> ShowS
Prelude.Show, (forall x. Milestone -> Rep Milestone x)
-> (forall x. Rep Milestone x -> Milestone) -> Generic Milestone
forall x. Rep Milestone x -> Milestone
forall x. Milestone -> Rep Milestone x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Milestone x -> Milestone
$cfrom :: forall x. Milestone -> Rep Milestone x
Prelude.Generic)

-- |
-- Create a value of 'Milestone' 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:
--
-- 'workload', 'milestone_workload' - Undocumented member.
--
-- 'milestoneNumber', 'milestone_milestoneNumber' - Undocumented member.
--
-- 'milestoneName', 'milestone_milestoneName' - Undocumented member.
--
-- 'recordedAt', 'milestone_recordedAt' - Undocumented member.
newMilestone ::
  Milestone
newMilestone :: Milestone
newMilestone =
  Milestone' :: Maybe Workload
-> Maybe Natural -> Maybe Text -> Maybe POSIX -> Milestone
Milestone'
    { $sel:workload:Milestone' :: Maybe Workload
workload = Maybe Workload
forall a. Maybe a
Prelude.Nothing,
      $sel:milestoneNumber:Milestone' :: Maybe Natural
milestoneNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:milestoneName:Milestone' :: Maybe Text
milestoneName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recordedAt:Milestone' :: Maybe POSIX
recordedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
milestone_workload :: Lens.Lens' Milestone (Prelude.Maybe Workload)
milestone_workload :: (Maybe Workload -> f (Maybe Workload)) -> Milestone -> f Milestone
milestone_workload = (Milestone -> Maybe Workload)
-> (Milestone -> Maybe Workload -> Milestone)
-> Lens Milestone Milestone (Maybe Workload) (Maybe Workload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Milestone' {Maybe Workload
workload :: Maybe Workload
$sel:workload:Milestone' :: Milestone -> Maybe Workload
workload} -> Maybe Workload
workload) (\s :: Milestone
s@Milestone' {} Maybe Workload
a -> Milestone
s {$sel:workload:Milestone' :: Maybe Workload
workload = Maybe Workload
a} :: Milestone)

-- | Undocumented member.
milestone_milestoneNumber :: Lens.Lens' Milestone (Prelude.Maybe Prelude.Natural)
milestone_milestoneNumber :: (Maybe Natural -> f (Maybe Natural)) -> Milestone -> f Milestone
milestone_milestoneNumber = (Milestone -> Maybe Natural)
-> (Milestone -> Maybe Natural -> Milestone)
-> Lens Milestone Milestone (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Milestone' {Maybe Natural
milestoneNumber :: Maybe Natural
$sel:milestoneNumber:Milestone' :: Milestone -> Maybe Natural
milestoneNumber} -> Maybe Natural
milestoneNumber) (\s :: Milestone
s@Milestone' {} Maybe Natural
a -> Milestone
s {$sel:milestoneNumber:Milestone' :: Maybe Natural
milestoneNumber = Maybe Natural
a} :: Milestone)

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

-- | Undocumented member.
milestone_recordedAt :: Lens.Lens' Milestone (Prelude.Maybe Prelude.UTCTime)
milestone_recordedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Milestone -> f Milestone
milestone_recordedAt = (Milestone -> Maybe POSIX)
-> (Milestone -> Maybe POSIX -> Milestone)
-> Lens Milestone Milestone (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Milestone' {Maybe POSIX
recordedAt :: Maybe POSIX
$sel:recordedAt:Milestone' :: Milestone -> Maybe POSIX
recordedAt} -> Maybe POSIX
recordedAt) (\s :: Milestone
s@Milestone' {} Maybe POSIX
a -> Milestone
s {$sel:recordedAt:Milestone' :: Maybe POSIX
recordedAt = Maybe POSIX
a} :: Milestone) ((Maybe POSIX -> f (Maybe POSIX)) -> Milestone -> f Milestone)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Milestone
-> f Milestone
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON Milestone where
  parseJSON :: Value -> Parser Milestone
parseJSON =
    String -> (Object -> Parser Milestone) -> Value -> Parser Milestone
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Milestone"
      ( \Object
x ->
          Maybe Workload
-> Maybe Natural -> Maybe Text -> Maybe POSIX -> Milestone
Milestone'
            (Maybe Workload
 -> Maybe Natural -> Maybe Text -> Maybe POSIX -> Milestone)
-> Parser (Maybe Workload)
-> Parser (Maybe Natural -> Maybe Text -> Maybe POSIX -> Milestone)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Workload)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Workload")
            Parser (Maybe Natural -> Maybe Text -> Maybe POSIX -> Milestone)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> Maybe POSIX -> Milestone)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MilestoneNumber")
            Parser (Maybe Text -> Maybe POSIX -> Milestone)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Milestone)
forall (f :: * -> *) a b. Applicative f => 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
"MilestoneName")
            Parser (Maybe POSIX -> Milestone)
-> Parser (Maybe POSIX) -> Parser Milestone
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RecordedAt")
      )

instance Prelude.Hashable Milestone

instance Prelude.NFData Milestone