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

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

-- | Provides information about an application.
--
-- /See:/ 'newApplicationResponse' smart constructor.
data ApplicationResponse = 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 -> 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
(ApplicationResponse -> ApplicationResponse -> Bool)
-> (ApplicationResponse -> ApplicationResponse -> Bool)
-> Eq ApplicationResponse
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]
(Int -> ReadS ApplicationResponse)
-> ReadS [ApplicationResponse]
-> ReadPrec ApplicationResponse
-> ReadPrec [ApplicationResponse]
-> Read 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
(Int -> ApplicationResponse -> ShowS)
-> (ApplicationResponse -> String)
-> ([ApplicationResponse] -> ShowS)
-> Show ApplicationResponse
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. ApplicationResponse -> Rep ApplicationResponse x)
-> (forall x. Rep ApplicationResponse x -> ApplicationResponse)
-> Generic ApplicationResponse
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:
--
-- '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' :: Maybe (HashMap Text Text)
-> Text -> Text -> Text -> ApplicationResponse
ApplicationResponse'
    { $sel:tags:ApplicationResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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_
    }

-- | 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 :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ApplicationResponse -> f ApplicationResponse
applicationResponse_tags = (ApplicationResponse -> Maybe (HashMap Text Text))
-> (ApplicationResponse
    -> Maybe (HashMap Text Text) -> ApplicationResponse)
-> Lens
     ApplicationResponse
     ApplicationResponse
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ApplicationResponse -> f ApplicationResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ApplicationResponse
-> f ApplicationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
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 :: (Text -> f Text) -> ApplicationResponse -> f ApplicationResponse
applicationResponse_id = (ApplicationResponse -> Text)
-> (ApplicationResponse -> Text -> ApplicationResponse)
-> Lens ApplicationResponse ApplicationResponse Text Text
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 :: (Text -> f Text) -> ApplicationResponse -> f ApplicationResponse
applicationResponse_arn = (ApplicationResponse -> Text)
-> (ApplicationResponse -> Text -> ApplicationResponse)
-> Lens ApplicationResponse ApplicationResponse Text Text
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 :: (Text -> f Text) -> ApplicationResponse -> f ApplicationResponse
applicationResponse_name = (ApplicationResponse -> Text)
-> (ApplicationResponse -> Text -> ApplicationResponse)
-> Lens ApplicationResponse ApplicationResponse Text Text
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 Core.FromJSON ApplicationResponse where
  parseJSON :: Value -> Parser ApplicationResponse
parseJSON =
    String
-> (Object -> Parser ApplicationResponse)
-> Value
-> Parser ApplicationResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApplicationResponse"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> Text -> Text -> ApplicationResponse
ApplicationResponse'
            (Maybe (HashMap Text Text)
 -> Text -> Text -> Text -> ApplicationResponse)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> Text -> ApplicationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> Text -> ApplicationResponse)
-> Parser Text -> Parser (Text -> Text -> ApplicationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
            Parser (Text -> Text -> ApplicationResponse)
-> Parser Text -> Parser (Text -> ApplicationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Arn")
            Parser (Text -> ApplicationResponse)
-> Parser Text -> Parser ApplicationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
      )

instance Prelude.Hashable ApplicationResponse

instance Prelude.NFData ApplicationResponse