{-# 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.IoT.Types.BillingGroupMetadata
-- 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.IoT.Types.BillingGroupMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Additional information about the billing group.
--
-- /See:/ 'newBillingGroupMetadata' smart constructor.
data BillingGroupMetadata = BillingGroupMetadata'
  { -- | The date the billing group was created.
    BillingGroupMetadata -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX
  }
  deriving (BillingGroupMetadata -> BillingGroupMetadata -> Bool
(BillingGroupMetadata -> BillingGroupMetadata -> Bool)
-> (BillingGroupMetadata -> BillingGroupMetadata -> Bool)
-> Eq BillingGroupMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BillingGroupMetadata -> BillingGroupMetadata -> Bool
$c/= :: BillingGroupMetadata -> BillingGroupMetadata -> Bool
== :: BillingGroupMetadata -> BillingGroupMetadata -> Bool
$c== :: BillingGroupMetadata -> BillingGroupMetadata -> Bool
Prelude.Eq, ReadPrec [BillingGroupMetadata]
ReadPrec BillingGroupMetadata
Int -> ReadS BillingGroupMetadata
ReadS [BillingGroupMetadata]
(Int -> ReadS BillingGroupMetadata)
-> ReadS [BillingGroupMetadata]
-> ReadPrec BillingGroupMetadata
-> ReadPrec [BillingGroupMetadata]
-> Read BillingGroupMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BillingGroupMetadata]
$creadListPrec :: ReadPrec [BillingGroupMetadata]
readPrec :: ReadPrec BillingGroupMetadata
$creadPrec :: ReadPrec BillingGroupMetadata
readList :: ReadS [BillingGroupMetadata]
$creadList :: ReadS [BillingGroupMetadata]
readsPrec :: Int -> ReadS BillingGroupMetadata
$creadsPrec :: Int -> ReadS BillingGroupMetadata
Prelude.Read, Int -> BillingGroupMetadata -> ShowS
[BillingGroupMetadata] -> ShowS
BillingGroupMetadata -> String
(Int -> BillingGroupMetadata -> ShowS)
-> (BillingGroupMetadata -> String)
-> ([BillingGroupMetadata] -> ShowS)
-> Show BillingGroupMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BillingGroupMetadata] -> ShowS
$cshowList :: [BillingGroupMetadata] -> ShowS
show :: BillingGroupMetadata -> String
$cshow :: BillingGroupMetadata -> String
showsPrec :: Int -> BillingGroupMetadata -> ShowS
$cshowsPrec :: Int -> BillingGroupMetadata -> ShowS
Prelude.Show, (forall x. BillingGroupMetadata -> Rep BillingGroupMetadata x)
-> (forall x. Rep BillingGroupMetadata x -> BillingGroupMetadata)
-> Generic BillingGroupMetadata
forall x. Rep BillingGroupMetadata x -> BillingGroupMetadata
forall x. BillingGroupMetadata -> Rep BillingGroupMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BillingGroupMetadata x -> BillingGroupMetadata
$cfrom :: forall x. BillingGroupMetadata -> Rep BillingGroupMetadata x
Prelude.Generic)

-- |
-- Create a value of 'BillingGroupMetadata' 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:
--
-- 'creationDate', 'billingGroupMetadata_creationDate' - The date the billing group was created.
newBillingGroupMetadata ::
  BillingGroupMetadata
newBillingGroupMetadata :: BillingGroupMetadata
newBillingGroupMetadata =
  BillingGroupMetadata' :: Maybe POSIX -> BillingGroupMetadata
BillingGroupMetadata'
    { $sel:creationDate:BillingGroupMetadata' :: Maybe POSIX
creationDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The date the billing group was created.
billingGroupMetadata_creationDate :: Lens.Lens' BillingGroupMetadata (Prelude.Maybe Prelude.UTCTime)
billingGroupMetadata_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> BillingGroupMetadata -> f BillingGroupMetadata
billingGroupMetadata_creationDate = (BillingGroupMetadata -> Maybe POSIX)
-> (BillingGroupMetadata -> Maybe POSIX -> BillingGroupMetadata)
-> Lens
     BillingGroupMetadata
     BillingGroupMetadata
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingGroupMetadata' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:BillingGroupMetadata' :: BillingGroupMetadata -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: BillingGroupMetadata
s@BillingGroupMetadata' {} Maybe POSIX
a -> BillingGroupMetadata
s {$sel:creationDate:BillingGroupMetadata' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: BillingGroupMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> BillingGroupMetadata -> f BillingGroupMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> BillingGroupMetadata
-> f BillingGroupMetadata
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 BillingGroupMetadata where
  parseJSON :: Value -> Parser BillingGroupMetadata
parseJSON =
    String
-> (Object -> Parser BillingGroupMetadata)
-> Value
-> Parser BillingGroupMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BillingGroupMetadata"
      ( \Object
x ->
          Maybe POSIX -> BillingGroupMetadata
BillingGroupMetadata'
            (Maybe POSIX -> BillingGroupMetadata)
-> Parser (Maybe POSIX) -> Parser BillingGroupMetadata
forall (f :: * -> *) a b. Functor 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
"creationDate")
      )

instance Prelude.Hashable BillingGroupMetadata

instance Prelude.NFData BillingGroupMetadata