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

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

-- | Provides the status code and message that result from processing data
-- for an endpoint.
--
-- /See:/ 'newEndpointItemResponse' smart constructor.
data EndpointItemResponse = EndpointItemResponse'
  { -- | The custom message that\'s returned in the response as a result of
    -- processing the endpoint data.
    EndpointItemResponse -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The status code that\'s returned in the response as a result of
    -- processing the endpoint data.
    EndpointItemResponse -> Maybe Int
statusCode :: Prelude.Maybe Prelude.Int
  }
  deriving (EndpointItemResponse -> EndpointItemResponse -> Bool
(EndpointItemResponse -> EndpointItemResponse -> Bool)
-> (EndpointItemResponse -> EndpointItemResponse -> Bool)
-> Eq EndpointItemResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointItemResponse -> EndpointItemResponse -> Bool
$c/= :: EndpointItemResponse -> EndpointItemResponse -> Bool
== :: EndpointItemResponse -> EndpointItemResponse -> Bool
$c== :: EndpointItemResponse -> EndpointItemResponse -> Bool
Prelude.Eq, ReadPrec [EndpointItemResponse]
ReadPrec EndpointItemResponse
Int -> ReadS EndpointItemResponse
ReadS [EndpointItemResponse]
(Int -> ReadS EndpointItemResponse)
-> ReadS [EndpointItemResponse]
-> ReadPrec EndpointItemResponse
-> ReadPrec [EndpointItemResponse]
-> Read EndpointItemResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointItemResponse]
$creadListPrec :: ReadPrec [EndpointItemResponse]
readPrec :: ReadPrec EndpointItemResponse
$creadPrec :: ReadPrec EndpointItemResponse
readList :: ReadS [EndpointItemResponse]
$creadList :: ReadS [EndpointItemResponse]
readsPrec :: Int -> ReadS EndpointItemResponse
$creadsPrec :: Int -> ReadS EndpointItemResponse
Prelude.Read, Int -> EndpointItemResponse -> ShowS
[EndpointItemResponse] -> ShowS
EndpointItemResponse -> String
(Int -> EndpointItemResponse -> ShowS)
-> (EndpointItemResponse -> String)
-> ([EndpointItemResponse] -> ShowS)
-> Show EndpointItemResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointItemResponse] -> ShowS
$cshowList :: [EndpointItemResponse] -> ShowS
show :: EndpointItemResponse -> String
$cshow :: EndpointItemResponse -> String
showsPrec :: Int -> EndpointItemResponse -> ShowS
$cshowsPrec :: Int -> EndpointItemResponse -> ShowS
Prelude.Show, (forall x. EndpointItemResponse -> Rep EndpointItemResponse x)
-> (forall x. Rep EndpointItemResponse x -> EndpointItemResponse)
-> Generic EndpointItemResponse
forall x. Rep EndpointItemResponse x -> EndpointItemResponse
forall x. EndpointItemResponse -> Rep EndpointItemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointItemResponse x -> EndpointItemResponse
$cfrom :: forall x. EndpointItemResponse -> Rep EndpointItemResponse x
Prelude.Generic)

-- |
-- Create a value of 'EndpointItemResponse' 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:
--
-- 'message', 'endpointItemResponse_message' - The custom message that\'s returned in the response as a result of
-- processing the endpoint data.
--
-- 'statusCode', 'endpointItemResponse_statusCode' - The status code that\'s returned in the response as a result of
-- processing the endpoint data.
newEndpointItemResponse ::
  EndpointItemResponse
newEndpointItemResponse :: EndpointItemResponse
newEndpointItemResponse =
  EndpointItemResponse' :: Maybe Text -> Maybe Int -> EndpointItemResponse
EndpointItemResponse'
    { $sel:message:EndpointItemResponse' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:EndpointItemResponse' :: Maybe Int
statusCode = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The custom message that\'s returned in the response as a result of
-- processing the endpoint data.
endpointItemResponse_message :: Lens.Lens' EndpointItemResponse (Prelude.Maybe Prelude.Text)
endpointItemResponse_message :: (Maybe Text -> f (Maybe Text))
-> EndpointItemResponse -> f EndpointItemResponse
endpointItemResponse_message = (EndpointItemResponse -> Maybe Text)
-> (EndpointItemResponse -> Maybe Text -> EndpointItemResponse)
-> Lens
     EndpointItemResponse EndpointItemResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointItemResponse' {Maybe Text
message :: Maybe Text
$sel:message:EndpointItemResponse' :: EndpointItemResponse -> Maybe Text
message} -> Maybe Text
message) (\s :: EndpointItemResponse
s@EndpointItemResponse' {} Maybe Text
a -> EndpointItemResponse
s {$sel:message:EndpointItemResponse' :: Maybe Text
message = Maybe Text
a} :: EndpointItemResponse)

-- | The status code that\'s returned in the response as a result of
-- processing the endpoint data.
endpointItemResponse_statusCode :: Lens.Lens' EndpointItemResponse (Prelude.Maybe Prelude.Int)
endpointItemResponse_statusCode :: (Maybe Int -> f (Maybe Int))
-> EndpointItemResponse -> f EndpointItemResponse
endpointItemResponse_statusCode = (EndpointItemResponse -> Maybe Int)
-> (EndpointItemResponse -> Maybe Int -> EndpointItemResponse)
-> Lens
     EndpointItemResponse EndpointItemResponse (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointItemResponse' {Maybe Int
statusCode :: Maybe Int
$sel:statusCode:EndpointItemResponse' :: EndpointItemResponse -> Maybe Int
statusCode} -> Maybe Int
statusCode) (\s :: EndpointItemResponse
s@EndpointItemResponse' {} Maybe Int
a -> EndpointItemResponse
s {$sel:statusCode:EndpointItemResponse' :: Maybe Int
statusCode = Maybe Int
a} :: EndpointItemResponse)

instance Core.FromJSON EndpointItemResponse where
  parseJSON :: Value -> Parser EndpointItemResponse
parseJSON =
    String
-> (Object -> Parser EndpointItemResponse)
-> Value
-> Parser EndpointItemResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EndpointItemResponse"
      ( \Object
x ->
          Maybe Text -> Maybe Int -> EndpointItemResponse
EndpointItemResponse'
            (Maybe Text -> Maybe Int -> EndpointItemResponse)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> EndpointItemResponse)
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
"Message")
            Parser (Maybe Int -> EndpointItemResponse)
-> Parser (Maybe Int) -> Parser EndpointItemResponse
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
"StatusCode")
      )

instance Prelude.Hashable EndpointItemResponse

instance Prelude.NFData EndpointItemResponse