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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.ChannelResponse
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the general settings and status of all
-- channels for an application, including channels that aren\'t enabled for
-- the application.
--
-- /See:/ 'newChannelsResponse' smart constructor.
data ChannelsResponse = ChannelsResponse'
  { -- | A map that contains a multipart response for each channel. For each item
    -- in this object, the ChannelType is the key and the Channel is the value.
    ChannelsResponse -> HashMap Text ChannelResponse
channels :: Prelude.HashMap Prelude.Text ChannelResponse
  }
  deriving (ChannelsResponse -> ChannelsResponse -> Bool
(ChannelsResponse -> ChannelsResponse -> Bool)
-> (ChannelsResponse -> ChannelsResponse -> Bool)
-> Eq ChannelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelsResponse -> ChannelsResponse -> Bool
$c/= :: ChannelsResponse -> ChannelsResponse -> Bool
== :: ChannelsResponse -> ChannelsResponse -> Bool
$c== :: ChannelsResponse -> ChannelsResponse -> Bool
Prelude.Eq, ReadPrec [ChannelsResponse]
ReadPrec ChannelsResponse
Int -> ReadS ChannelsResponse
ReadS [ChannelsResponse]
(Int -> ReadS ChannelsResponse)
-> ReadS [ChannelsResponse]
-> ReadPrec ChannelsResponse
-> ReadPrec [ChannelsResponse]
-> Read ChannelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelsResponse]
$creadListPrec :: ReadPrec [ChannelsResponse]
readPrec :: ReadPrec ChannelsResponse
$creadPrec :: ReadPrec ChannelsResponse
readList :: ReadS [ChannelsResponse]
$creadList :: ReadS [ChannelsResponse]
readsPrec :: Int -> ReadS ChannelsResponse
$creadsPrec :: Int -> ReadS ChannelsResponse
Prelude.Read, Int -> ChannelsResponse -> ShowS
[ChannelsResponse] -> ShowS
ChannelsResponse -> String
(Int -> ChannelsResponse -> ShowS)
-> (ChannelsResponse -> String)
-> ([ChannelsResponse] -> ShowS)
-> Show ChannelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelsResponse] -> ShowS
$cshowList :: [ChannelsResponse] -> ShowS
show :: ChannelsResponse -> String
$cshow :: ChannelsResponse -> String
showsPrec :: Int -> ChannelsResponse -> ShowS
$cshowsPrec :: Int -> ChannelsResponse -> ShowS
Prelude.Show, (forall x. ChannelsResponse -> Rep ChannelsResponse x)
-> (forall x. Rep ChannelsResponse x -> ChannelsResponse)
-> Generic ChannelsResponse
forall x. Rep ChannelsResponse x -> ChannelsResponse
forall x. ChannelsResponse -> Rep ChannelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelsResponse x -> ChannelsResponse
$cfrom :: forall x. ChannelsResponse -> Rep ChannelsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ChannelsResponse' 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:
--
-- 'channels', 'channelsResponse_channels' - A map that contains a multipart response for each channel. For each item
-- in this object, the ChannelType is the key and the Channel is the value.
newChannelsResponse ::
  ChannelsResponse
newChannelsResponse :: ChannelsResponse
newChannelsResponse =
  ChannelsResponse' :: HashMap Text ChannelResponse -> ChannelsResponse
ChannelsResponse' {$sel:channels:ChannelsResponse' :: HashMap Text ChannelResponse
channels = HashMap Text ChannelResponse
forall a. Monoid a => a
Prelude.mempty}

-- | A map that contains a multipart response for each channel. For each item
-- in this object, the ChannelType is the key and the Channel is the value.
channelsResponse_channels :: Lens.Lens' ChannelsResponse (Prelude.HashMap Prelude.Text ChannelResponse)
channelsResponse_channels :: (HashMap Text ChannelResponse -> f (HashMap Text ChannelResponse))
-> ChannelsResponse -> f ChannelsResponse
channelsResponse_channels = (ChannelsResponse -> HashMap Text ChannelResponse)
-> (ChannelsResponse
    -> HashMap Text ChannelResponse -> ChannelsResponse)
-> Lens
     ChannelsResponse
     ChannelsResponse
     (HashMap Text ChannelResponse)
     (HashMap Text ChannelResponse)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelsResponse' {HashMap Text ChannelResponse
channels :: HashMap Text ChannelResponse
$sel:channels:ChannelsResponse' :: ChannelsResponse -> HashMap Text ChannelResponse
channels} -> HashMap Text ChannelResponse
channels) (\s :: ChannelsResponse
s@ChannelsResponse' {} HashMap Text ChannelResponse
a -> ChannelsResponse
s {$sel:channels:ChannelsResponse' :: HashMap Text ChannelResponse
channels = HashMap Text ChannelResponse
a} :: ChannelsResponse) ((HashMap Text ChannelResponse -> f (HashMap Text ChannelResponse))
 -> ChannelsResponse -> f ChannelsResponse)
-> ((HashMap Text ChannelResponse
     -> f (HashMap Text ChannelResponse))
    -> HashMap Text ChannelResponse
    -> f (HashMap Text ChannelResponse))
-> (HashMap Text ChannelResponse
    -> f (HashMap Text ChannelResponse))
-> ChannelsResponse
-> f ChannelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text ChannelResponse -> f (HashMap Text ChannelResponse))
-> HashMap Text ChannelResponse -> f (HashMap Text ChannelResponse)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ChannelsResponse where
  parseJSON :: Value -> Parser ChannelsResponse
parseJSON =
    String
-> (Object -> Parser ChannelsResponse)
-> Value
-> Parser ChannelsResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChannelsResponse"
      ( \Object
x ->
          HashMap Text ChannelResponse -> ChannelsResponse
ChannelsResponse'
            (HashMap Text ChannelResponse -> ChannelsResponse)
-> Parser (HashMap Text ChannelResponse) -> Parser ChannelsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (HashMap Text ChannelResponse))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Channels" Parser (Maybe (HashMap Text ChannelResponse))
-> HashMap Text ChannelResponse
-> Parser (HashMap Text ChannelResponse)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text ChannelResponse
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ChannelsResponse

instance Prelude.NFData ChannelsResponse