{-# 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.BillingConductor.Types.UpdateFreeTierConfig
-- 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.BillingConductor.Types.UpdateFreeTierConfig 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

-- | The possible Amazon Web Services Free Tier configurations.
--
-- /See:/ 'newUpdateFreeTierConfig' smart constructor.
data UpdateFreeTierConfig = UpdateFreeTierConfig'
  { -- | Activate or deactivate application of Amazon Web Services Free Tier.
    UpdateFreeTierConfig -> Bool
activated :: Prelude.Bool
  }
  deriving (UpdateFreeTierConfig -> UpdateFreeTierConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFreeTierConfig -> UpdateFreeTierConfig -> Bool
$c/= :: UpdateFreeTierConfig -> UpdateFreeTierConfig -> Bool
== :: UpdateFreeTierConfig -> UpdateFreeTierConfig -> Bool
$c== :: UpdateFreeTierConfig -> UpdateFreeTierConfig -> Bool
Prelude.Eq, ReadPrec [UpdateFreeTierConfig]
ReadPrec UpdateFreeTierConfig
Int -> ReadS UpdateFreeTierConfig
ReadS [UpdateFreeTierConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFreeTierConfig]
$creadListPrec :: ReadPrec [UpdateFreeTierConfig]
readPrec :: ReadPrec UpdateFreeTierConfig
$creadPrec :: ReadPrec UpdateFreeTierConfig
readList :: ReadS [UpdateFreeTierConfig]
$creadList :: ReadS [UpdateFreeTierConfig]
readsPrec :: Int -> ReadS UpdateFreeTierConfig
$creadsPrec :: Int -> ReadS UpdateFreeTierConfig
Prelude.Read, Int -> UpdateFreeTierConfig -> ShowS
[UpdateFreeTierConfig] -> ShowS
UpdateFreeTierConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFreeTierConfig] -> ShowS
$cshowList :: [UpdateFreeTierConfig] -> ShowS
show :: UpdateFreeTierConfig -> String
$cshow :: UpdateFreeTierConfig -> String
showsPrec :: Int -> UpdateFreeTierConfig -> ShowS
$cshowsPrec :: Int -> UpdateFreeTierConfig -> ShowS
Prelude.Show, forall x. Rep UpdateFreeTierConfig x -> UpdateFreeTierConfig
forall x. UpdateFreeTierConfig -> Rep UpdateFreeTierConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFreeTierConfig x -> UpdateFreeTierConfig
$cfrom :: forall x. UpdateFreeTierConfig -> Rep UpdateFreeTierConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFreeTierConfig' 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:
--
-- 'activated', 'updateFreeTierConfig_activated' - Activate or deactivate application of Amazon Web Services Free Tier.
newUpdateFreeTierConfig ::
  -- | 'activated'
  Prelude.Bool ->
  UpdateFreeTierConfig
newUpdateFreeTierConfig :: Bool -> UpdateFreeTierConfig
newUpdateFreeTierConfig Bool
pActivated_ =
  UpdateFreeTierConfig' {$sel:activated:UpdateFreeTierConfig' :: Bool
activated = Bool
pActivated_}

-- | Activate or deactivate application of Amazon Web Services Free Tier.
updateFreeTierConfig_activated :: Lens.Lens' UpdateFreeTierConfig Prelude.Bool
updateFreeTierConfig_activated :: Lens' UpdateFreeTierConfig Bool
updateFreeTierConfig_activated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFreeTierConfig' {Bool
activated :: Bool
$sel:activated:UpdateFreeTierConfig' :: UpdateFreeTierConfig -> Bool
activated} -> Bool
activated) (\s :: UpdateFreeTierConfig
s@UpdateFreeTierConfig' {} Bool
a -> UpdateFreeTierConfig
s {$sel:activated:UpdateFreeTierConfig' :: Bool
activated = Bool
a} :: UpdateFreeTierConfig)

instance Data.FromJSON UpdateFreeTierConfig where
  parseJSON :: Value -> Parser UpdateFreeTierConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpdateFreeTierConfig"
      ( \Object
x ->
          Bool -> UpdateFreeTierConfig
UpdateFreeTierConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Activated")
      )

instance Prelude.Hashable UpdateFreeTierConfig where
  hashWithSalt :: Int -> UpdateFreeTierConfig -> Int
hashWithSalt Int
_salt UpdateFreeTierConfig' {Bool
activated :: Bool
$sel:activated:UpdateFreeTierConfig' :: UpdateFreeTierConfig -> Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
activated

instance Prelude.NFData UpdateFreeTierConfig where
  rnf :: UpdateFreeTierConfig -> ()
rnf UpdateFreeTierConfig' {Bool
activated :: Bool
$sel:activated:UpdateFreeTierConfig' :: UpdateFreeTierConfig -> Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Bool
activated

instance Data.ToJSON UpdateFreeTierConfig where
  toJSON :: UpdateFreeTierConfig -> Value
toJSON UpdateFreeTierConfig' {Bool
activated :: Bool
$sel:activated:UpdateFreeTierConfig' :: UpdateFreeTierConfig -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Activated" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
activated)]
      )