{-# 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.AttributesResource
-- 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.AttributesResource 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 type and the names of attributes that
-- were removed from all the endpoints that are associated with an
-- application.
--
-- /See:/ 'newAttributesResource' smart constructor.
data AttributesResource = AttributesResource'
  { -- | An array that specifies the names of the attributes that were removed
    -- from the endpoints.
    AttributesResource -> Maybe [Text]
attributes :: Prelude.Maybe [Prelude.Text],
    -- | The type of attribute or attributes that were removed from the
    -- endpoints. Valid values are:
    --
    -- -   endpoint-custom-attributes - Custom attributes that describe
    --     endpoints.
    --
    -- -   endpoint-metric-attributes - Custom metrics that your app reports to
    --     Amazon Pinpoint for endpoints.
    --
    -- -   endpoint-user-attributes - Custom attributes that describe users.
    AttributesResource -> Text
attributeType :: Prelude.Text,
    -- | The unique identifier for the application.
    AttributesResource -> Text
applicationId :: Prelude.Text
  }
  deriving (AttributesResource -> AttributesResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributesResource -> AttributesResource -> Bool
$c/= :: AttributesResource -> AttributesResource -> Bool
== :: AttributesResource -> AttributesResource -> Bool
$c== :: AttributesResource -> AttributesResource -> Bool
Prelude.Eq, ReadPrec [AttributesResource]
ReadPrec AttributesResource
Int -> ReadS AttributesResource
ReadS [AttributesResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributesResource]
$creadListPrec :: ReadPrec [AttributesResource]
readPrec :: ReadPrec AttributesResource
$creadPrec :: ReadPrec AttributesResource
readList :: ReadS [AttributesResource]
$creadList :: ReadS [AttributesResource]
readsPrec :: Int -> ReadS AttributesResource
$creadsPrec :: Int -> ReadS AttributesResource
Prelude.Read, Int -> AttributesResource -> ShowS
[AttributesResource] -> ShowS
AttributesResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributesResource] -> ShowS
$cshowList :: [AttributesResource] -> ShowS
show :: AttributesResource -> String
$cshow :: AttributesResource -> String
showsPrec :: Int -> AttributesResource -> ShowS
$cshowsPrec :: Int -> AttributesResource -> ShowS
Prelude.Show, forall x. Rep AttributesResource x -> AttributesResource
forall x. AttributesResource -> Rep AttributesResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributesResource x -> AttributesResource
$cfrom :: forall x. AttributesResource -> Rep AttributesResource x
Prelude.Generic)

-- |
-- Create a value of 'AttributesResource' 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:
--
-- 'attributes', 'attributesResource_attributes' - An array that specifies the names of the attributes that were removed
-- from the endpoints.
--
-- 'attributeType', 'attributesResource_attributeType' - The type of attribute or attributes that were removed from the
-- endpoints. Valid values are:
--
-- -   endpoint-custom-attributes - Custom attributes that describe
--     endpoints.
--
-- -   endpoint-metric-attributes - Custom metrics that your app reports to
--     Amazon Pinpoint for endpoints.
--
-- -   endpoint-user-attributes - Custom attributes that describe users.
--
-- 'applicationId', 'attributesResource_applicationId' - The unique identifier for the application.
newAttributesResource ::
  -- | 'attributeType'
  Prelude.Text ->
  -- | 'applicationId'
  Prelude.Text ->
  AttributesResource
newAttributesResource :: Text -> Text -> AttributesResource
newAttributesResource Text
pAttributeType_ Text
pApplicationId_ =
  AttributesResource'
    { $sel:attributes:AttributesResource' :: Maybe [Text]
attributes = forall a. Maybe a
Prelude.Nothing,
      $sel:attributeType:AttributesResource' :: Text
attributeType = Text
pAttributeType_,
      $sel:applicationId:AttributesResource' :: Text
applicationId = Text
pApplicationId_
    }

-- | An array that specifies the names of the attributes that were removed
-- from the endpoints.
attributesResource_attributes :: Lens.Lens' AttributesResource (Prelude.Maybe [Prelude.Text])
attributesResource_attributes :: Lens' AttributesResource (Maybe [Text])
attributesResource_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributesResource' {Maybe [Text]
attributes :: Maybe [Text]
$sel:attributes:AttributesResource' :: AttributesResource -> Maybe [Text]
attributes} -> Maybe [Text]
attributes) (\s :: AttributesResource
s@AttributesResource' {} Maybe [Text]
a -> AttributesResource
s {$sel:attributes:AttributesResource' :: Maybe [Text]
attributes = Maybe [Text]
a} :: AttributesResource) 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 type of attribute or attributes that were removed from the
-- endpoints. Valid values are:
--
-- -   endpoint-custom-attributes - Custom attributes that describe
--     endpoints.
--
-- -   endpoint-metric-attributes - Custom metrics that your app reports to
--     Amazon Pinpoint for endpoints.
--
-- -   endpoint-user-attributes - Custom attributes that describe users.
attributesResource_attributeType :: Lens.Lens' AttributesResource Prelude.Text
attributesResource_attributeType :: Lens' AttributesResource Text
attributesResource_attributeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributesResource' {Text
attributeType :: Text
$sel:attributeType:AttributesResource' :: AttributesResource -> Text
attributeType} -> Text
attributeType) (\s :: AttributesResource
s@AttributesResource' {} Text
a -> AttributesResource
s {$sel:attributeType:AttributesResource' :: Text
attributeType = Text
a} :: AttributesResource)

-- | The unique identifier for the application.
attributesResource_applicationId :: Lens.Lens' AttributesResource Prelude.Text
attributesResource_applicationId :: Lens' AttributesResource Text
attributesResource_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributesResource' {Text
applicationId :: Text
$sel:applicationId:AttributesResource' :: AttributesResource -> Text
applicationId} -> Text
applicationId) (\s :: AttributesResource
s@AttributesResource' {} Text
a -> AttributesResource
s {$sel:applicationId:AttributesResource' :: Text
applicationId = Text
a} :: AttributesResource)

instance Data.FromJSON AttributesResource where
  parseJSON :: Value -> Parser AttributesResource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AttributesResource"
      ( \Object
x ->
          Maybe [Text] -> Text -> Text -> AttributesResource
AttributesResource'
            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
"Attributes" 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
"AttributeType")
            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
"ApplicationId")
      )

instance Prelude.Hashable AttributesResource where
  hashWithSalt :: Int -> AttributesResource -> Int
hashWithSalt Int
_salt AttributesResource' {Maybe [Text]
Text
applicationId :: Text
attributeType :: Text
attributes :: Maybe [Text]
$sel:applicationId:AttributesResource' :: AttributesResource -> Text
$sel:attributeType:AttributesResource' :: AttributesResource -> Text
$sel:attributes:AttributesResource' :: AttributesResource -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attributeType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId

instance Prelude.NFData AttributesResource where
  rnf :: AttributesResource -> ()
rnf AttributesResource' {Maybe [Text]
Text
applicationId :: Text
attributeType :: Text
attributes :: Maybe [Text]
$sel:applicationId:AttributesResource' :: AttributesResource -> Text
$sel:attributeType:AttributesResource' :: AttributesResource -> Text
$sel:attributes:AttributesResource' :: AttributesResource -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
attributeType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId