{-# 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.Pinpoint.Types.ADMChannelRequest
-- 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.Pinpoint.Types.ADMChannelRequest where

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

-- | Specifies the status and settings of the ADM (Amazon Device Messaging)
-- channel for an application.
--
-- /See:/ 'newADMChannelRequest' smart constructor.
data ADMChannelRequest = ADMChannelRequest'
  { -- | Specifies whether to enable the ADM channel for the application.
    ADMChannelRequest -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The Client Secret that you received from Amazon to send messages by
    -- using ADM.
    ADMChannelRequest -> Text
clientSecret :: Prelude.Text,
    -- | The Client ID that you received from Amazon to send messages by using
    -- ADM.
    ADMChannelRequest -> Text
clientId :: Prelude.Text
  }
  deriving (ADMChannelRequest -> ADMChannelRequest -> Bool
(ADMChannelRequest -> ADMChannelRequest -> Bool)
-> (ADMChannelRequest -> ADMChannelRequest -> Bool)
-> Eq ADMChannelRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ADMChannelRequest -> ADMChannelRequest -> Bool
$c/= :: ADMChannelRequest -> ADMChannelRequest -> Bool
== :: ADMChannelRequest -> ADMChannelRequest -> Bool
$c== :: ADMChannelRequest -> ADMChannelRequest -> Bool
Prelude.Eq, ReadPrec [ADMChannelRequest]
ReadPrec ADMChannelRequest
Int -> ReadS ADMChannelRequest
ReadS [ADMChannelRequest]
(Int -> ReadS ADMChannelRequest)
-> ReadS [ADMChannelRequest]
-> ReadPrec ADMChannelRequest
-> ReadPrec [ADMChannelRequest]
-> Read ADMChannelRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ADMChannelRequest]
$creadListPrec :: ReadPrec [ADMChannelRequest]
readPrec :: ReadPrec ADMChannelRequest
$creadPrec :: ReadPrec ADMChannelRequest
readList :: ReadS [ADMChannelRequest]
$creadList :: ReadS [ADMChannelRequest]
readsPrec :: Int -> ReadS ADMChannelRequest
$creadsPrec :: Int -> ReadS ADMChannelRequest
Prelude.Read, Int -> ADMChannelRequest -> ShowS
[ADMChannelRequest] -> ShowS
ADMChannelRequest -> String
(Int -> ADMChannelRequest -> ShowS)
-> (ADMChannelRequest -> String)
-> ([ADMChannelRequest] -> ShowS)
-> Show ADMChannelRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ADMChannelRequest] -> ShowS
$cshowList :: [ADMChannelRequest] -> ShowS
show :: ADMChannelRequest -> String
$cshow :: ADMChannelRequest -> String
showsPrec :: Int -> ADMChannelRequest -> ShowS
$cshowsPrec :: Int -> ADMChannelRequest -> ShowS
Prelude.Show, (forall x. ADMChannelRequest -> Rep ADMChannelRequest x)
-> (forall x. Rep ADMChannelRequest x -> ADMChannelRequest)
-> Generic ADMChannelRequest
forall x. Rep ADMChannelRequest x -> ADMChannelRequest
forall x. ADMChannelRequest -> Rep ADMChannelRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ADMChannelRequest x -> ADMChannelRequest
$cfrom :: forall x. ADMChannelRequest -> Rep ADMChannelRequest x
Prelude.Generic)

-- |
-- Create a value of 'ADMChannelRequest' 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:
--
-- 'enabled', 'aDMChannelRequest_enabled' - Specifies whether to enable the ADM channel for the application.
--
-- 'clientSecret', 'aDMChannelRequest_clientSecret' - The Client Secret that you received from Amazon to send messages by
-- using ADM.
--
-- 'clientId', 'aDMChannelRequest_clientId' - The Client ID that you received from Amazon to send messages by using
-- ADM.
newADMChannelRequest ::
  -- | 'clientSecret'
  Prelude.Text ->
  -- | 'clientId'
  Prelude.Text ->
  ADMChannelRequest
newADMChannelRequest :: Text -> Text -> ADMChannelRequest
newADMChannelRequest Text
pClientSecret_ Text
pClientId_ =
  ADMChannelRequest' :: Maybe Bool -> Text -> Text -> ADMChannelRequest
ADMChannelRequest'
    { $sel:enabled:ADMChannelRequest' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:clientSecret:ADMChannelRequest' :: Text
clientSecret = Text
pClientSecret_,
      $sel:clientId:ADMChannelRequest' :: Text
clientId = Text
pClientId_
    }

-- | Specifies whether to enable the ADM channel for the application.
aDMChannelRequest_enabled :: Lens.Lens' ADMChannelRequest (Prelude.Maybe Prelude.Bool)
aDMChannelRequest_enabled :: (Maybe Bool -> f (Maybe Bool))
-> ADMChannelRequest -> f ADMChannelRequest
aDMChannelRequest_enabled = (ADMChannelRequest -> Maybe Bool)
-> (ADMChannelRequest -> Maybe Bool -> ADMChannelRequest)
-> Lens
     ADMChannelRequest ADMChannelRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ADMChannelRequest' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:ADMChannelRequest' :: ADMChannelRequest -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: ADMChannelRequest
s@ADMChannelRequest' {} Maybe Bool
a -> ADMChannelRequest
s {$sel:enabled:ADMChannelRequest' :: Maybe Bool
enabled = Maybe Bool
a} :: ADMChannelRequest)

-- | The Client Secret that you received from Amazon to send messages by
-- using ADM.
aDMChannelRequest_clientSecret :: Lens.Lens' ADMChannelRequest Prelude.Text
aDMChannelRequest_clientSecret :: (Text -> f Text) -> ADMChannelRequest -> f ADMChannelRequest
aDMChannelRequest_clientSecret = (ADMChannelRequest -> Text)
-> (ADMChannelRequest -> Text -> ADMChannelRequest)
-> Lens ADMChannelRequest ADMChannelRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ADMChannelRequest' {Text
clientSecret :: Text
$sel:clientSecret:ADMChannelRequest' :: ADMChannelRequest -> Text
clientSecret} -> Text
clientSecret) (\s :: ADMChannelRequest
s@ADMChannelRequest' {} Text
a -> ADMChannelRequest
s {$sel:clientSecret:ADMChannelRequest' :: Text
clientSecret = Text
a} :: ADMChannelRequest)

-- | The Client ID that you received from Amazon to send messages by using
-- ADM.
aDMChannelRequest_clientId :: Lens.Lens' ADMChannelRequest Prelude.Text
aDMChannelRequest_clientId :: (Text -> f Text) -> ADMChannelRequest -> f ADMChannelRequest
aDMChannelRequest_clientId = (ADMChannelRequest -> Text)
-> (ADMChannelRequest -> Text -> ADMChannelRequest)
-> Lens ADMChannelRequest ADMChannelRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ADMChannelRequest' {Text
clientId :: Text
$sel:clientId:ADMChannelRequest' :: ADMChannelRequest -> Text
clientId} -> Text
clientId) (\s :: ADMChannelRequest
s@ADMChannelRequest' {} Text
a -> ADMChannelRequest
s {$sel:clientId:ADMChannelRequest' :: Text
clientId = Text
a} :: ADMChannelRequest)

instance Prelude.Hashable ADMChannelRequest

instance Prelude.NFData ADMChannelRequest

instance Core.ToJSON ADMChannelRequest where
  toJSON :: ADMChannelRequest -> Value
toJSON ADMChannelRequest' {Maybe Bool
Text
clientId :: Text
clientSecret :: Text
enabled :: Maybe Bool
$sel:clientId:ADMChannelRequest' :: ADMChannelRequest -> Text
$sel:clientSecret:ADMChannelRequest' :: ADMChannelRequest -> Text
$sel:enabled:ADMChannelRequest' :: ADMChannelRequest -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientSecret" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientSecret),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientId)
          ]
      )