{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WellArchitected.Types.Milestone where

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

-- | A milestone return object.
--
-- /See:/ 'newMilestone' smart constructor.
data Milestone = Milestone'
  { Milestone -> Maybe Text
milestoneName :: Prelude.Maybe Prelude.Text,
    Milestone -> Maybe Natural
milestoneNumber :: Prelude.Maybe Prelude.Natural,
    Milestone -> Maybe POSIX
recordedAt :: Prelude.Maybe Data.POSIX,
    Milestone -> Maybe Workload
workload :: Prelude.Maybe Workload
  }
  deriving (Milestone -> Milestone -> Bool
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]
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
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. 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:
--
-- 'milestoneName', 'milestone_milestoneName' - Undocumented member.
--
-- 'milestoneNumber', 'milestone_milestoneNumber' - Undocumented member.
--
-- 'recordedAt', 'milestone_recordedAt' - Undocumented member.
--
-- 'workload', 'milestone_workload' - Undocumented member.
newMilestone ::
  Milestone
newMilestone :: Milestone
newMilestone =
  Milestone'
    { $sel:milestoneName:Milestone' :: Maybe Text
milestoneName = forall a. Maybe a
Prelude.Nothing,
      $sel:milestoneNumber:Milestone' :: Maybe Natural
milestoneNumber = forall a. Maybe a
Prelude.Nothing,
      $sel:recordedAt:Milestone' :: Maybe POSIX
recordedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:workload:Milestone' :: Maybe Workload
workload = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
milestone_milestoneName :: Lens.Lens' Milestone (Prelude.Maybe Prelude.Text)
milestone_milestoneName :: Lens' Milestone (Maybe Text)
milestone_milestoneName = 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_milestoneNumber :: Lens.Lens' Milestone (Prelude.Maybe Prelude.Natural)
milestone_milestoneNumber :: Lens' Milestone (Maybe Natural)
milestone_milestoneNumber = 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_recordedAt :: Lens.Lens' Milestone (Prelude.Maybe Prelude.UTCTime)
milestone_recordedAt :: Lens' Milestone (Maybe UTCTime)
milestone_recordedAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Undocumented member.
milestone_workload :: Lens.Lens' Milestone (Prelude.Maybe Workload)
milestone_workload :: Lens' Milestone (Maybe Workload)
milestone_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)

instance Data.FromJSON Milestone where
  parseJSON :: Value -> Parser Milestone
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Milestone"
      ( \Object
x ->
          Maybe Text
-> Maybe Natural -> Maybe POSIX -> Maybe Workload -> Milestone
Milestone'
            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
"MilestoneName")
            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
"MilestoneNumber")
            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
"RecordedAt")
            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
"Workload")
      )

instance Prelude.Hashable Milestone where
  hashWithSalt :: Int -> Milestone -> Int
hashWithSalt Int
_salt Milestone' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe Workload
workload :: Maybe Workload
recordedAt :: Maybe POSIX
milestoneNumber :: Maybe Natural
milestoneName :: Maybe Text
$sel:workload:Milestone' :: Milestone -> Maybe Workload
$sel:recordedAt:Milestone' :: Milestone -> Maybe POSIX
$sel:milestoneNumber:Milestone' :: Milestone -> Maybe Natural
$sel:milestoneName:Milestone' :: Milestone -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
milestoneName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
milestoneNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
recordedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Workload
workload

instance Prelude.NFData Milestone where
  rnf :: Milestone -> ()
rnf Milestone' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe Workload
workload :: Maybe Workload
recordedAt :: Maybe POSIX
milestoneNumber :: Maybe Natural
milestoneName :: Maybe Text
$sel:workload:Milestone' :: Milestone -> Maybe Workload
$sel:recordedAt:Milestone' :: Milestone -> Maybe POSIX
$sel:milestoneNumber:Milestone' :: Milestone -> Maybe Natural
$sel:milestoneName:Milestone' :: Milestone -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
milestoneName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
milestoneNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
recordedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Workload
workload