{-# 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-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.EndpointItemResponse 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 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
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]
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
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. 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'
    { $sel:message:EndpointItemResponse' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:EndpointItemResponse' :: Maybe Int
statusCode = 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 :: Lens' EndpointItemResponse (Maybe Text)
endpointItemResponse_message = 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 :: Lens' EndpointItemResponse (Maybe Int)
endpointItemResponse_statusCode = 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 Data.FromJSON EndpointItemResponse where
  parseJSON :: Value -> Parser EndpointItemResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EndpointItemResponse"
      ( \Object
x ->
          Maybe Text -> Maybe Int -> EndpointItemResponse
EndpointItemResponse'
            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
"Message")
            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
"StatusCode")
      )

instance Prelude.Hashable EndpointItemResponse where
  hashWithSalt :: Int -> EndpointItemResponse -> Int
hashWithSalt Int
_salt EndpointItemResponse' {Maybe Int
Maybe Text
statusCode :: Maybe Int
message :: Maybe Text
$sel:statusCode:EndpointItemResponse' :: EndpointItemResponse -> Maybe Int
$sel:message:EndpointItemResponse' :: EndpointItemResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
statusCode

instance Prelude.NFData EndpointItemResponse where
  rnf :: EndpointItemResponse -> ()
rnf EndpointItemResponse' {Maybe Int
Maybe Text
statusCode :: Maybe Int
message :: Maybe Text
$sel:statusCode:EndpointItemResponse' :: EndpointItemResponse -> Maybe Int
$sel:message:EndpointItemResponse' :: EndpointItemResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
statusCode