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

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

-- | Provides information about the general settings and status of a channel
-- for an application.
--
-- /See:/ 'newChannelResponse' smart constructor.
data ChannelResponse = ChannelResponse'
  { -- | The date and time, in ISO 8601 format, when the channel was last
    -- modified.
    ChannelResponse -> Maybe Text
lastModifiedDate :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the channel is enabled for the application.
    ChannelResponse -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether the channel is archived.
    ChannelResponse -> Maybe Bool
isArchived :: Prelude.Maybe Prelude.Bool,
    -- | The unique identifier for the application.
    ChannelResponse -> Maybe Text
applicationId :: Prelude.Maybe Prelude.Text,
    -- | The current version of the channel.
    ChannelResponse -> Maybe Int
version :: Prelude.Maybe Prelude.Int,
    -- | (Deprecated) An identifier for the channel. This property is retained
    -- only for backward compatibility.
    ChannelResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in ISO 8601 format, when the channel was enabled.
    ChannelResponse -> Maybe Text
creationDate :: Prelude.Maybe Prelude.Text,
    -- | The user who last modified the channel.
    ChannelResponse -> Maybe Text
lastModifiedBy :: Prelude.Maybe Prelude.Text,
    -- | (Not used) This property is retained only for backward compatibility.
    ChannelResponse -> Maybe Bool
hasCredential :: Prelude.Maybe Prelude.Bool
  }
  deriving (ChannelResponse -> ChannelResponse -> Bool
(ChannelResponse -> ChannelResponse -> Bool)
-> (ChannelResponse -> ChannelResponse -> Bool)
-> Eq ChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelResponse -> ChannelResponse -> Bool
$c/= :: ChannelResponse -> ChannelResponse -> Bool
== :: ChannelResponse -> ChannelResponse -> Bool
$c== :: ChannelResponse -> ChannelResponse -> Bool
Prelude.Eq, ReadPrec [ChannelResponse]
ReadPrec ChannelResponse
Int -> ReadS ChannelResponse
ReadS [ChannelResponse]
(Int -> ReadS ChannelResponse)
-> ReadS [ChannelResponse]
-> ReadPrec ChannelResponse
-> ReadPrec [ChannelResponse]
-> Read ChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelResponse]
$creadListPrec :: ReadPrec [ChannelResponse]
readPrec :: ReadPrec ChannelResponse
$creadPrec :: ReadPrec ChannelResponse
readList :: ReadS [ChannelResponse]
$creadList :: ReadS [ChannelResponse]
readsPrec :: Int -> ReadS ChannelResponse
$creadsPrec :: Int -> ReadS ChannelResponse
Prelude.Read, Int -> ChannelResponse -> ShowS
[ChannelResponse] -> ShowS
ChannelResponse -> String
(Int -> ChannelResponse -> ShowS)
-> (ChannelResponse -> String)
-> ([ChannelResponse] -> ShowS)
-> Show ChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelResponse] -> ShowS
$cshowList :: [ChannelResponse] -> ShowS
show :: ChannelResponse -> String
$cshow :: ChannelResponse -> String
showsPrec :: Int -> ChannelResponse -> ShowS
$cshowsPrec :: Int -> ChannelResponse -> ShowS
Prelude.Show, (forall x. ChannelResponse -> Rep ChannelResponse x)
-> (forall x. Rep ChannelResponse x -> ChannelResponse)
-> Generic ChannelResponse
forall x. Rep ChannelResponse x -> ChannelResponse
forall x. ChannelResponse -> Rep ChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelResponse x -> ChannelResponse
$cfrom :: forall x. ChannelResponse -> Rep ChannelResponse x
Prelude.Generic)

-- |
-- Create a value of 'ChannelResponse' 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:
--
-- 'lastModifiedDate', 'channelResponse_lastModifiedDate' - The date and time, in ISO 8601 format, when the channel was last
-- modified.
--
-- 'enabled', 'channelResponse_enabled' - Specifies whether the channel is enabled for the application.
--
-- 'isArchived', 'channelResponse_isArchived' - Specifies whether the channel is archived.
--
-- 'applicationId', 'channelResponse_applicationId' - The unique identifier for the application.
--
-- 'version', 'channelResponse_version' - The current version of the channel.
--
-- 'id', 'channelResponse_id' - (Deprecated) An identifier for the channel. This property is retained
-- only for backward compatibility.
--
-- 'creationDate', 'channelResponse_creationDate' - The date and time, in ISO 8601 format, when the channel was enabled.
--
-- 'lastModifiedBy', 'channelResponse_lastModifiedBy' - The user who last modified the channel.
--
-- 'hasCredential', 'channelResponse_hasCredential' - (Not used) This property is retained only for backward compatibility.
newChannelResponse ::
  ChannelResponse
newChannelResponse :: ChannelResponse
newChannelResponse =
  ChannelResponse' :: Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> ChannelResponse
ChannelResponse'
    { $sel:lastModifiedDate:ChannelResponse' :: Maybe Text
lastModifiedDate =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:ChannelResponse' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:isArchived:ChannelResponse' :: Maybe Bool
isArchived = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationId:ChannelResponse' :: Maybe Text
applicationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:ChannelResponse' :: Maybe Int
version = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ChannelResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:ChannelResponse' :: Maybe Text
creationDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedBy:ChannelResponse' :: Maybe Text
lastModifiedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hasCredential:ChannelResponse' :: Maybe Bool
hasCredential = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time, in ISO 8601 format, when the channel was last
-- modified.
channelResponse_lastModifiedDate :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_lastModifiedDate :: (Maybe Text -> f (Maybe Text))
-> ChannelResponse -> f ChannelResponse
channelResponse_lastModifiedDate = (ChannelResponse -> Maybe Text)
-> (ChannelResponse -> Maybe Text -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Text
lastModifiedDate :: Maybe Text
$sel:lastModifiedDate:ChannelResponse' :: ChannelResponse -> Maybe Text
lastModifiedDate} -> Maybe Text
lastModifiedDate) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Text
a -> ChannelResponse
s {$sel:lastModifiedDate:ChannelResponse' :: Maybe Text
lastModifiedDate = Maybe Text
a} :: ChannelResponse)

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

-- | Specifies whether the channel is archived.
channelResponse_isArchived :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Bool)
channelResponse_isArchived :: (Maybe Bool -> f (Maybe Bool))
-> ChannelResponse -> f ChannelResponse
channelResponse_isArchived = (ChannelResponse -> Maybe Bool)
-> (ChannelResponse -> Maybe Bool -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Bool
isArchived :: Maybe Bool
$sel:isArchived:ChannelResponse' :: ChannelResponse -> Maybe Bool
isArchived} -> Maybe Bool
isArchived) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Bool
a -> ChannelResponse
s {$sel:isArchived:ChannelResponse' :: Maybe Bool
isArchived = Maybe Bool
a} :: ChannelResponse)

-- | The unique identifier for the application.
channelResponse_applicationId :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_applicationId :: (Maybe Text -> f (Maybe Text))
-> ChannelResponse -> f ChannelResponse
channelResponse_applicationId = (ChannelResponse -> Maybe Text)
-> (ChannelResponse -> Maybe Text -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Text
applicationId :: Maybe Text
$sel:applicationId:ChannelResponse' :: ChannelResponse -> Maybe Text
applicationId} -> Maybe Text
applicationId) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Text
a -> ChannelResponse
s {$sel:applicationId:ChannelResponse' :: Maybe Text
applicationId = Maybe Text
a} :: ChannelResponse)

-- | The current version of the channel.
channelResponse_version :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Int)
channelResponse_version :: (Maybe Int -> f (Maybe Int))
-> ChannelResponse -> f ChannelResponse
channelResponse_version = (ChannelResponse -> Maybe Int)
-> (ChannelResponse -> Maybe Int -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Int
version :: Maybe Int
$sel:version:ChannelResponse' :: ChannelResponse -> Maybe Int
version} -> Maybe Int
version) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Int
a -> ChannelResponse
s {$sel:version:ChannelResponse' :: Maybe Int
version = Maybe Int
a} :: ChannelResponse)

-- | (Deprecated) An identifier for the channel. This property is retained
-- only for backward compatibility.
channelResponse_id :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_id :: (Maybe Text -> f (Maybe Text))
-> ChannelResponse -> f ChannelResponse
channelResponse_id = (ChannelResponse -> Maybe Text)
-> (ChannelResponse -> Maybe Text -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Text
id :: Maybe Text
$sel:id:ChannelResponse' :: ChannelResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Text
a -> ChannelResponse
s {$sel:id:ChannelResponse' :: Maybe Text
id = Maybe Text
a} :: ChannelResponse)

-- | The date and time, in ISO 8601 format, when the channel was enabled.
channelResponse_creationDate :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_creationDate :: (Maybe Text -> f (Maybe Text))
-> ChannelResponse -> f ChannelResponse
channelResponse_creationDate = (ChannelResponse -> Maybe Text)
-> (ChannelResponse -> Maybe Text -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Text
creationDate :: Maybe Text
$sel:creationDate:ChannelResponse' :: ChannelResponse -> Maybe Text
creationDate} -> Maybe Text
creationDate) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Text
a -> ChannelResponse
s {$sel:creationDate:ChannelResponse' :: Maybe Text
creationDate = Maybe Text
a} :: ChannelResponse)

-- | The user who last modified the channel.
channelResponse_lastModifiedBy :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_lastModifiedBy :: (Maybe Text -> f (Maybe Text))
-> ChannelResponse -> f ChannelResponse
channelResponse_lastModifiedBy = (ChannelResponse -> Maybe Text)
-> (ChannelResponse -> Maybe Text -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Text
lastModifiedBy :: Maybe Text
$sel:lastModifiedBy:ChannelResponse' :: ChannelResponse -> Maybe Text
lastModifiedBy} -> Maybe Text
lastModifiedBy) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Text
a -> ChannelResponse
s {$sel:lastModifiedBy:ChannelResponse' :: Maybe Text
lastModifiedBy = Maybe Text
a} :: ChannelResponse)

-- | (Not used) This property is retained only for backward compatibility.
channelResponse_hasCredential :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Bool)
channelResponse_hasCredential :: (Maybe Bool -> f (Maybe Bool))
-> ChannelResponse -> f ChannelResponse
channelResponse_hasCredential = (ChannelResponse -> Maybe Bool)
-> (ChannelResponse -> Maybe Bool -> ChannelResponse)
-> Lens ChannelResponse ChannelResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelResponse' {Maybe Bool
hasCredential :: Maybe Bool
$sel:hasCredential:ChannelResponse' :: ChannelResponse -> Maybe Bool
hasCredential} -> Maybe Bool
hasCredential) (\s :: ChannelResponse
s@ChannelResponse' {} Maybe Bool
a -> ChannelResponse
s {$sel:hasCredential:ChannelResponse' :: Maybe Bool
hasCredential = Maybe Bool
a} :: ChannelResponse)

instance Core.FromJSON ChannelResponse where
  parseJSON :: Value -> Parser ChannelResponse
parseJSON =
    String
-> (Object -> Parser ChannelResponse)
-> Value
-> Parser ChannelResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChannelResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> ChannelResponse
ChannelResponse'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> ChannelResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> ChannelResponse)
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
"LastModifiedDate")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> ChannelResponse)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Enabled")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> ChannelResponse)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsArchived")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> ChannelResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"ApplicationId")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> ChannelResponse)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Bool -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Version")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Bool -> ChannelResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Bool -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Id")
            Parser (Maybe Text -> Maybe Text -> Maybe Bool -> ChannelResponse)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Bool -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"CreationDate")
            Parser (Maybe Text -> Maybe Bool -> ChannelResponse)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> ChannelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"LastModifiedBy")
            Parser (Maybe Bool -> ChannelResponse)
-> Parser (Maybe Bool) -> Parser ChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HasCredential")
      )

instance Prelude.Hashable ChannelResponse

instance Prelude.NFData ChannelResponse