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

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

-- | The properties of a billing group.
--
-- /See:/ 'newBillingGroupProperties' smart constructor.
data BillingGroupProperties = BillingGroupProperties'
  { -- | The description of the billing group.
    BillingGroupProperties -> Maybe Text
billingGroupDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (BillingGroupProperties -> BillingGroupProperties -> Bool
(BillingGroupProperties -> BillingGroupProperties -> Bool)
-> (BillingGroupProperties -> BillingGroupProperties -> Bool)
-> Eq BillingGroupProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BillingGroupProperties -> BillingGroupProperties -> Bool
$c/= :: BillingGroupProperties -> BillingGroupProperties -> Bool
== :: BillingGroupProperties -> BillingGroupProperties -> Bool
$c== :: BillingGroupProperties -> BillingGroupProperties -> Bool
Prelude.Eq, ReadPrec [BillingGroupProperties]
ReadPrec BillingGroupProperties
Int -> ReadS BillingGroupProperties
ReadS [BillingGroupProperties]
(Int -> ReadS BillingGroupProperties)
-> ReadS [BillingGroupProperties]
-> ReadPrec BillingGroupProperties
-> ReadPrec [BillingGroupProperties]
-> Read BillingGroupProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BillingGroupProperties]
$creadListPrec :: ReadPrec [BillingGroupProperties]
readPrec :: ReadPrec BillingGroupProperties
$creadPrec :: ReadPrec BillingGroupProperties
readList :: ReadS [BillingGroupProperties]
$creadList :: ReadS [BillingGroupProperties]
readsPrec :: Int -> ReadS BillingGroupProperties
$creadsPrec :: Int -> ReadS BillingGroupProperties
Prelude.Read, Int -> BillingGroupProperties -> ShowS
[BillingGroupProperties] -> ShowS
BillingGroupProperties -> String
(Int -> BillingGroupProperties -> ShowS)
-> (BillingGroupProperties -> String)
-> ([BillingGroupProperties] -> ShowS)
-> Show BillingGroupProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BillingGroupProperties] -> ShowS
$cshowList :: [BillingGroupProperties] -> ShowS
show :: BillingGroupProperties -> String
$cshow :: BillingGroupProperties -> String
showsPrec :: Int -> BillingGroupProperties -> ShowS
$cshowsPrec :: Int -> BillingGroupProperties -> ShowS
Prelude.Show, (forall x. BillingGroupProperties -> Rep BillingGroupProperties x)
-> (forall x.
    Rep BillingGroupProperties x -> BillingGroupProperties)
-> Generic BillingGroupProperties
forall x. Rep BillingGroupProperties x -> BillingGroupProperties
forall x. BillingGroupProperties -> Rep BillingGroupProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BillingGroupProperties x -> BillingGroupProperties
$cfrom :: forall x. BillingGroupProperties -> Rep BillingGroupProperties x
Prelude.Generic)

-- |
-- Create a value of 'BillingGroupProperties' 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:
--
-- 'billingGroupDescription', 'billingGroupProperties_billingGroupDescription' - The description of the billing group.
newBillingGroupProperties ::
  BillingGroupProperties
newBillingGroupProperties :: BillingGroupProperties
newBillingGroupProperties =
  BillingGroupProperties' :: Maybe Text -> BillingGroupProperties
BillingGroupProperties'
    { $sel:billingGroupDescription:BillingGroupProperties' :: Maybe Text
billingGroupDescription =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The description of the billing group.
billingGroupProperties_billingGroupDescription :: Lens.Lens' BillingGroupProperties (Prelude.Maybe Prelude.Text)
billingGroupProperties_billingGroupDescription :: (Maybe Text -> f (Maybe Text))
-> BillingGroupProperties -> f BillingGroupProperties
billingGroupProperties_billingGroupDescription = (BillingGroupProperties -> Maybe Text)
-> (BillingGroupProperties -> Maybe Text -> BillingGroupProperties)
-> Lens
     BillingGroupProperties
     BillingGroupProperties
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingGroupProperties' {Maybe Text
billingGroupDescription :: Maybe Text
$sel:billingGroupDescription:BillingGroupProperties' :: BillingGroupProperties -> Maybe Text
billingGroupDescription} -> Maybe Text
billingGroupDescription) (\s :: BillingGroupProperties
s@BillingGroupProperties' {} Maybe Text
a -> BillingGroupProperties
s {$sel:billingGroupDescription:BillingGroupProperties' :: Maybe Text
billingGroupDescription = Maybe Text
a} :: BillingGroupProperties)

instance Core.FromJSON BillingGroupProperties where
  parseJSON :: Value -> Parser BillingGroupProperties
parseJSON =
    String
-> (Object -> Parser BillingGroupProperties)
-> Value
-> Parser BillingGroupProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BillingGroupProperties"
      ( \Object
x ->
          Maybe Text -> BillingGroupProperties
BillingGroupProperties'
            (Maybe Text -> BillingGroupProperties)
-> Parser (Maybe Text) -> Parser BillingGroupProperties
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
"billingGroupDescription")
      )

instance Prelude.Hashable BillingGroupProperties

instance Prelude.NFData BillingGroupProperties

instance Core.ToJSON BillingGroupProperties where
  toJSON :: BillingGroupProperties -> Value
toJSON BillingGroupProperties' {Maybe Text
billingGroupDescription :: Maybe Text
$sel:billingGroupDescription:BillingGroupProperties' :: BillingGroupProperties -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"billingGroupDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
billingGroupDescription
          ]
      )