{-# 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.ApplicationResponse
-- 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.ApplicationResponse 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 an application.
--
-- /See:/ 'newApplicationResponse' smart constructor.
data ApplicationResponse = ApplicationResponse'
  { -- | The date and time when the Application was created.
    ApplicationResponse -> Maybe Text
creationDate :: Prelude.Maybe Prelude.Text,
    -- | A string-to-string map of key-value pairs that identifies the tags that
    -- are associated with the application. Each tag consists of a required tag
    -- key and an associated tag value.
    ApplicationResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    ApplicationResponse -> Text
id :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the application.
    ApplicationResponse -> Text
arn :: Prelude.Text,
    -- | The display name of the application. This name is displayed as the
    -- __Project name__ on the Amazon Pinpoint console.
    ApplicationResponse -> Text
name :: Prelude.Text
  }
  deriving (ApplicationResponse -> ApplicationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationResponse -> ApplicationResponse -> Bool
$c/= :: ApplicationResponse -> ApplicationResponse -> Bool
== :: ApplicationResponse -> ApplicationResponse -> Bool
$c== :: ApplicationResponse -> ApplicationResponse -> Bool
Prelude.Eq, ReadPrec [ApplicationResponse]
ReadPrec ApplicationResponse
Int -> ReadS ApplicationResponse
ReadS [ApplicationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationResponse]
$creadListPrec :: ReadPrec [ApplicationResponse]
readPrec :: ReadPrec ApplicationResponse
$creadPrec :: ReadPrec ApplicationResponse
readList :: ReadS [ApplicationResponse]
$creadList :: ReadS [ApplicationResponse]
readsPrec :: Int -> ReadS ApplicationResponse
$creadsPrec :: Int -> ReadS ApplicationResponse
Prelude.Read, Int -> ApplicationResponse -> ShowS
[ApplicationResponse] -> ShowS
ApplicationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationResponse] -> ShowS
$cshowList :: [ApplicationResponse] -> ShowS
show :: ApplicationResponse -> String
$cshow :: ApplicationResponse -> String
showsPrec :: Int -> ApplicationResponse -> ShowS
$cshowsPrec :: Int -> ApplicationResponse -> ShowS
Prelude.Show, forall x. Rep ApplicationResponse x -> ApplicationResponse
forall x. ApplicationResponse -> Rep ApplicationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationResponse x -> ApplicationResponse
$cfrom :: forall x. ApplicationResponse -> Rep ApplicationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationResponse' 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:
--
-- 'creationDate', 'applicationResponse_creationDate' - The date and time when the Application was created.
--
-- 'tags', 'applicationResponse_tags' - A string-to-string map of key-value pairs that identifies the tags that
-- are associated with the application. Each tag consists of a required tag
-- key and an associated tag value.
--
-- 'id', 'applicationResponse_id' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'arn', 'applicationResponse_arn' - The Amazon Resource Name (ARN) of the application.
--
-- 'name', 'applicationResponse_name' - The display name of the application. This name is displayed as the
-- __Project name__ on the Amazon Pinpoint console.
newApplicationResponse ::
  -- | 'id'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  ApplicationResponse
newApplicationResponse :: Text -> Text -> Text -> ApplicationResponse
newApplicationResponse Text
pId_ Text
pArn_ Text
pName_ =
  ApplicationResponse'
    { $sel:creationDate:ApplicationResponse' :: Maybe Text
creationDate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ApplicationResponse' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ApplicationResponse' :: Text
id = Text
pId_,
      $sel:arn:ApplicationResponse' :: Text
arn = Text
pArn_,
      $sel:name:ApplicationResponse' :: Text
name = Text
pName_
    }

-- | The date and time when the Application was created.
applicationResponse_creationDate :: Lens.Lens' ApplicationResponse (Prelude.Maybe Prelude.Text)
applicationResponse_creationDate :: Lens' ApplicationResponse (Maybe Text)
applicationResponse_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationResponse' {Maybe Text
creationDate :: Maybe Text
$sel:creationDate:ApplicationResponse' :: ApplicationResponse -> Maybe Text
creationDate} -> Maybe Text
creationDate) (\s :: ApplicationResponse
s@ApplicationResponse' {} Maybe Text
a -> ApplicationResponse
s {$sel:creationDate:ApplicationResponse' :: Maybe Text
creationDate = Maybe Text
a} :: ApplicationResponse)

-- | A string-to-string map of key-value pairs that identifies the tags that
-- are associated with the application. Each tag consists of a required tag
-- key and an associated tag value.
applicationResponse_tags :: Lens.Lens' ApplicationResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
applicationResponse_tags :: Lens' ApplicationResponse (Maybe (HashMap Text Text))
applicationResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ApplicationResponse' :: ApplicationResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ApplicationResponse
s@ApplicationResponse' {} Maybe (HashMap Text Text)
a -> ApplicationResponse
s {$sel:tags:ApplicationResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ApplicationResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
applicationResponse_id :: Lens.Lens' ApplicationResponse Prelude.Text
applicationResponse_id :: Lens' ApplicationResponse Text
applicationResponse_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationResponse' {Text
id :: Text
$sel:id:ApplicationResponse' :: ApplicationResponse -> Text
id} -> Text
id) (\s :: ApplicationResponse
s@ApplicationResponse' {} Text
a -> ApplicationResponse
s {$sel:id:ApplicationResponse' :: Text
id = Text
a} :: ApplicationResponse)

-- | The Amazon Resource Name (ARN) of the application.
applicationResponse_arn :: Lens.Lens' ApplicationResponse Prelude.Text
applicationResponse_arn :: Lens' ApplicationResponse Text
applicationResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationResponse' {Text
arn :: Text
$sel:arn:ApplicationResponse' :: ApplicationResponse -> Text
arn} -> Text
arn) (\s :: ApplicationResponse
s@ApplicationResponse' {} Text
a -> ApplicationResponse
s {$sel:arn:ApplicationResponse' :: Text
arn = Text
a} :: ApplicationResponse)

-- | The display name of the application. This name is displayed as the
-- __Project name__ on the Amazon Pinpoint console.
applicationResponse_name :: Lens.Lens' ApplicationResponse Prelude.Text
applicationResponse_name :: Lens' ApplicationResponse Text
applicationResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationResponse' {Text
name :: Text
$sel:name:ApplicationResponse' :: ApplicationResponse -> Text
name} -> Text
name) (\s :: ApplicationResponse
s@ApplicationResponse' {} Text
a -> ApplicationResponse
s {$sel:name:ApplicationResponse' :: Text
name = Text
a} :: ApplicationResponse)

instance Data.FromJSON ApplicationResponse where
  parseJSON :: Value -> Parser ApplicationResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApplicationResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> ApplicationResponse
ApplicationResponse'
            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
"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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
      )

instance Prelude.Hashable ApplicationResponse where
  hashWithSalt :: Int -> ApplicationResponse -> Int
hashWithSalt Int
_salt ApplicationResponse' {Maybe Text
Maybe (HashMap Text Text)
Text
name :: Text
arn :: Text
id :: Text
tags :: Maybe (HashMap Text Text)
creationDate :: Maybe Text
$sel:name:ApplicationResponse' :: ApplicationResponse -> Text
$sel:arn:ApplicationResponse' :: ApplicationResponse -> Text
$sel:id:ApplicationResponse' :: ApplicationResponse -> Text
$sel:tags:ApplicationResponse' :: ApplicationResponse -> Maybe (HashMap Text Text)
$sel:creationDate:ApplicationResponse' :: ApplicationResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData ApplicationResponse where
  rnf :: ApplicationResponse -> ()
rnf ApplicationResponse' {Maybe Text
Maybe (HashMap Text Text)
Text
name :: Text
arn :: Text
id :: Text
tags :: Maybe (HashMap Text Text)
creationDate :: Maybe Text
$sel:name:ApplicationResponse' :: ApplicationResponse -> Text
$sel:arn:ApplicationResponse' :: ApplicationResponse -> Text
$sel:id:ApplicationResponse' :: ApplicationResponse -> Text
$sel:tags:ApplicationResponse' :: ApplicationResponse -> Maybe (HashMap Text Text)
$sel:creationDate:ApplicationResponse' :: ApplicationResponse -> Maybe Text
..} =
    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 (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name