{-# 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.ChimeSdkVoice.Types.TerminationHealth
-- 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.ChimeSdkVoice.Types.TerminationHealth 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

-- | /See:/ 'newTerminationHealth' smart constructor.
data TerminationHealth = TerminationHealth'
  { TerminationHealth -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
    TerminationHealth -> Maybe ISO8601
timestamp :: Prelude.Maybe Data.ISO8601
  }
  deriving (TerminationHealth -> TerminationHealth -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminationHealth -> TerminationHealth -> Bool
$c/= :: TerminationHealth -> TerminationHealth -> Bool
== :: TerminationHealth -> TerminationHealth -> Bool
$c== :: TerminationHealth -> TerminationHealth -> Bool
Prelude.Eq, ReadPrec [TerminationHealth]
ReadPrec TerminationHealth
Int -> ReadS TerminationHealth
ReadS [TerminationHealth]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminationHealth]
$creadListPrec :: ReadPrec [TerminationHealth]
readPrec :: ReadPrec TerminationHealth
$creadPrec :: ReadPrec TerminationHealth
readList :: ReadS [TerminationHealth]
$creadList :: ReadS [TerminationHealth]
readsPrec :: Int -> ReadS TerminationHealth
$creadsPrec :: Int -> ReadS TerminationHealth
Prelude.Read, Int -> TerminationHealth -> ShowS
[TerminationHealth] -> ShowS
TerminationHealth -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminationHealth] -> ShowS
$cshowList :: [TerminationHealth] -> ShowS
show :: TerminationHealth -> String
$cshow :: TerminationHealth -> String
showsPrec :: Int -> TerminationHealth -> ShowS
$cshowsPrec :: Int -> TerminationHealth -> ShowS
Prelude.Show, forall x. Rep TerminationHealth x -> TerminationHealth
forall x. TerminationHealth -> Rep TerminationHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TerminationHealth x -> TerminationHealth
$cfrom :: forall x. TerminationHealth -> Rep TerminationHealth x
Prelude.Generic)

-- |
-- Create a value of 'TerminationHealth' 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:
--
-- 'source', 'terminationHealth_source' - Undocumented member.
--
-- 'timestamp', 'terminationHealth_timestamp' - Undocumented member.
newTerminationHealth ::
  TerminationHealth
newTerminationHealth :: TerminationHealth
newTerminationHealth =
  TerminationHealth'
    { $sel:source:TerminationHealth' :: Maybe Text
source = forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:TerminationHealth' :: Maybe ISO8601
timestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
terminationHealth_source :: Lens.Lens' TerminationHealth (Prelude.Maybe Prelude.Text)
terminationHealth_source :: Lens' TerminationHealth (Maybe Text)
terminationHealth_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminationHealth' {Maybe Text
source :: Maybe Text
$sel:source:TerminationHealth' :: TerminationHealth -> Maybe Text
source} -> Maybe Text
source) (\s :: TerminationHealth
s@TerminationHealth' {} Maybe Text
a -> TerminationHealth
s {$sel:source:TerminationHealth' :: Maybe Text
source = Maybe Text
a} :: TerminationHealth)

-- | Undocumented member.
terminationHealth_timestamp :: Lens.Lens' TerminationHealth (Prelude.Maybe Prelude.UTCTime)
terminationHealth_timestamp :: Lens' TerminationHealth (Maybe UTCTime)
terminationHealth_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminationHealth' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:TerminationHealth' :: TerminationHealth -> Maybe ISO8601
timestamp} -> Maybe ISO8601
timestamp) (\s :: TerminationHealth
s@TerminationHealth' {} Maybe ISO8601
a -> TerminationHealth
s {$sel:timestamp:TerminationHealth' :: Maybe ISO8601
timestamp = Maybe ISO8601
a} :: TerminationHealth) 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

instance Data.FromJSON TerminationHealth where
  parseJSON :: Value -> Parser TerminationHealth
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TerminationHealth"
      ( \Object
x ->
          Maybe Text -> Maybe ISO8601 -> TerminationHealth
TerminationHealth'
            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
"Source")
            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
"Timestamp")
      )

instance Prelude.Hashable TerminationHealth where
  hashWithSalt :: Int -> TerminationHealth -> Int
hashWithSalt Int
_salt TerminationHealth' {Maybe Text
Maybe ISO8601
timestamp :: Maybe ISO8601
source :: Maybe Text
$sel:timestamp:TerminationHealth' :: TerminationHealth -> Maybe ISO8601
$sel:source:TerminationHealth' :: TerminationHealth -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
timestamp

instance Prelude.NFData TerminationHealth where
  rnf :: TerminationHealth -> ()
rnf TerminationHealth' {Maybe Text
Maybe ISO8601
timestamp :: Maybe ISO8601
source :: Maybe Text
$sel:timestamp:TerminationHealth' :: TerminationHealth -> Maybe ISO8601
$sel:source:TerminationHealth' :: TerminationHealth -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
timestamp