{-# 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.Chime.Types.BusinessCallingSettings
-- 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.Chime.Types.BusinessCallingSettings where

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

-- | The Amazon Chime Business Calling settings for the administrator\'s AWS
-- account. Includes any Amazon S3 buckets designated for storing call
-- detail records.
--
-- /See:/ 'newBusinessCallingSettings' smart constructor.
data BusinessCallingSettings = BusinessCallingSettings'
  { -- | The Amazon S3 bucket designated for call detail record storage.
    BusinessCallingSettings -> Maybe Text
cdrBucket :: Prelude.Maybe Prelude.Text
  }
  deriving (BusinessCallingSettings -> BusinessCallingSettings -> Bool
(BusinessCallingSettings -> BusinessCallingSettings -> Bool)
-> (BusinessCallingSettings -> BusinessCallingSettings -> Bool)
-> Eq BusinessCallingSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BusinessCallingSettings -> BusinessCallingSettings -> Bool
$c/= :: BusinessCallingSettings -> BusinessCallingSettings -> Bool
== :: BusinessCallingSettings -> BusinessCallingSettings -> Bool
$c== :: BusinessCallingSettings -> BusinessCallingSettings -> Bool
Prelude.Eq, ReadPrec [BusinessCallingSettings]
ReadPrec BusinessCallingSettings
Int -> ReadS BusinessCallingSettings
ReadS [BusinessCallingSettings]
(Int -> ReadS BusinessCallingSettings)
-> ReadS [BusinessCallingSettings]
-> ReadPrec BusinessCallingSettings
-> ReadPrec [BusinessCallingSettings]
-> Read BusinessCallingSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BusinessCallingSettings]
$creadListPrec :: ReadPrec [BusinessCallingSettings]
readPrec :: ReadPrec BusinessCallingSettings
$creadPrec :: ReadPrec BusinessCallingSettings
readList :: ReadS [BusinessCallingSettings]
$creadList :: ReadS [BusinessCallingSettings]
readsPrec :: Int -> ReadS BusinessCallingSettings
$creadsPrec :: Int -> ReadS BusinessCallingSettings
Prelude.Read, Int -> BusinessCallingSettings -> ShowS
[BusinessCallingSettings] -> ShowS
BusinessCallingSettings -> String
(Int -> BusinessCallingSettings -> ShowS)
-> (BusinessCallingSettings -> String)
-> ([BusinessCallingSettings] -> ShowS)
-> Show BusinessCallingSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BusinessCallingSettings] -> ShowS
$cshowList :: [BusinessCallingSettings] -> ShowS
show :: BusinessCallingSettings -> String
$cshow :: BusinessCallingSettings -> String
showsPrec :: Int -> BusinessCallingSettings -> ShowS
$cshowsPrec :: Int -> BusinessCallingSettings -> ShowS
Prelude.Show, (forall x.
 BusinessCallingSettings -> Rep BusinessCallingSettings x)
-> (forall x.
    Rep BusinessCallingSettings x -> BusinessCallingSettings)
-> Generic BusinessCallingSettings
forall x. Rep BusinessCallingSettings x -> BusinessCallingSettings
forall x. BusinessCallingSettings -> Rep BusinessCallingSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BusinessCallingSettings x -> BusinessCallingSettings
$cfrom :: forall x. BusinessCallingSettings -> Rep BusinessCallingSettings x
Prelude.Generic)

-- |
-- Create a value of 'BusinessCallingSettings' 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:
--
-- 'cdrBucket', 'businessCallingSettings_cdrBucket' - The Amazon S3 bucket designated for call detail record storage.
newBusinessCallingSettings ::
  BusinessCallingSettings
newBusinessCallingSettings :: BusinessCallingSettings
newBusinessCallingSettings =
  BusinessCallingSettings' :: Maybe Text -> BusinessCallingSettings
BusinessCallingSettings'
    { $sel:cdrBucket:BusinessCallingSettings' :: Maybe Text
cdrBucket =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon S3 bucket designated for call detail record storage.
businessCallingSettings_cdrBucket :: Lens.Lens' BusinessCallingSettings (Prelude.Maybe Prelude.Text)
businessCallingSettings_cdrBucket :: (Maybe Text -> f (Maybe Text))
-> BusinessCallingSettings -> f BusinessCallingSettings
businessCallingSettings_cdrBucket = (BusinessCallingSettings -> Maybe Text)
-> (BusinessCallingSettings
    -> Maybe Text -> BusinessCallingSettings)
-> Lens
     BusinessCallingSettings
     BusinessCallingSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessCallingSettings' {Maybe Text
cdrBucket :: Maybe Text
$sel:cdrBucket:BusinessCallingSettings' :: BusinessCallingSettings -> Maybe Text
cdrBucket} -> Maybe Text
cdrBucket) (\s :: BusinessCallingSettings
s@BusinessCallingSettings' {} Maybe Text
a -> BusinessCallingSettings
s {$sel:cdrBucket:BusinessCallingSettings' :: Maybe Text
cdrBucket = Maybe Text
a} :: BusinessCallingSettings)

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

instance Prelude.Hashable BusinessCallingSettings

instance Prelude.NFData BusinessCallingSettings

instance Core.ToJSON BusinessCallingSettings where
  toJSON :: BusinessCallingSettings -> Value
toJSON BusinessCallingSettings' {Maybe Text
cdrBucket :: Maybe Text
$sel:cdrBucket:BusinessCallingSettings' :: BusinessCallingSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"CdrBucket" 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
cdrBucket]
      )