{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Pinpoint.Types.ChannelResponse 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

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

-- | The unique identifier for the application.
channelResponse_applicationId :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_applicationId :: Lens' ChannelResponse (Maybe Text)
channelResponse_applicationId = 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 date and time, in ISO 8601 format, when the channel was enabled.
channelResponse_creationDate :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_creationDate :: Lens' ChannelResponse (Maybe Text)
channelResponse_creationDate = 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)

-- | Specifies whether the channel is enabled for the application.
channelResponse_enabled :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Bool)
channelResponse_enabled :: Lens' ChannelResponse (Maybe Bool)
channelResponse_enabled = 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)

-- | (Not used) This property is retained only for backward compatibility.
channelResponse_hasCredential :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Bool)
channelResponse_hasCredential :: Lens' ChannelResponse (Maybe Bool)
channelResponse_hasCredential = 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)

-- | (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 :: Lens' ChannelResponse (Maybe Text)
channelResponse_id = 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)

-- | Specifies whether the channel is archived.
channelResponse_isArchived :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Bool)
channelResponse_isArchived :: Lens' ChannelResponse (Maybe Bool)
channelResponse_isArchived = 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 user who last modified the channel.
channelResponse_lastModifiedBy :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Text)
channelResponse_lastModifiedBy :: Lens' ChannelResponse (Maybe Text)
channelResponse_lastModifiedBy = 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)

-- | 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 :: Lens' ChannelResponse (Maybe Text)
channelResponse_lastModifiedDate = 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)

-- | The current version of the channel.
channelResponse_version :: Lens.Lens' ChannelResponse (Prelude.Maybe Prelude.Int)
channelResponse_version :: Lens' ChannelResponse (Maybe Int)
channelResponse_version = 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)

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

instance Prelude.Hashable ChannelResponse where
  hashWithSalt :: Int -> ChannelResponse -> Int
hashWithSalt Int
_salt ChannelResponse' {Maybe Bool
Maybe Int
Maybe Text
version :: Maybe Int
lastModifiedDate :: Maybe Text
lastModifiedBy :: Maybe Text
isArchived :: Maybe Bool
id :: Maybe Text
hasCredential :: Maybe Bool
enabled :: Maybe Bool
creationDate :: Maybe Text
applicationId :: Maybe Text
$sel:version:ChannelResponse' :: ChannelResponse -> Maybe Int
$sel:lastModifiedDate:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:lastModifiedBy:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:isArchived:ChannelResponse' :: ChannelResponse -> Maybe Bool
$sel:id:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:hasCredential:ChannelResponse' :: ChannelResponse -> Maybe Bool
$sel:enabled:ChannelResponse' :: ChannelResponse -> Maybe Bool
$sel:creationDate:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:applicationId:ChannelResponse' :: ChannelResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hasCredential
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isArchived
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastModifiedBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
version

instance Prelude.NFData ChannelResponse where
  rnf :: ChannelResponse -> ()
rnf ChannelResponse' {Maybe Bool
Maybe Int
Maybe Text
version :: Maybe Int
lastModifiedDate :: Maybe Text
lastModifiedBy :: Maybe Text
isArchived :: Maybe Bool
id :: Maybe Text
hasCredential :: Maybe Bool
enabled :: Maybe Bool
creationDate :: Maybe Text
applicationId :: Maybe Text
$sel:version:ChannelResponse' :: ChannelResponse -> Maybe Int
$sel:lastModifiedDate:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:lastModifiedBy:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:isArchived:ChannelResponse' :: ChannelResponse -> Maybe Bool
$sel:id:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:hasCredential:ChannelResponse' :: ChannelResponse -> Maybe Bool
$sel:enabled:ChannelResponse' :: ChannelResponse -> Maybe Bool
$sel:creationDate:ChannelResponse' :: ChannelResponse -> Maybe Text
$sel:applicationId:ChannelResponse' :: ChannelResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hasCredential
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isArchived
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastModifiedBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastModifiedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
version