{-# 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.EndpointDemographic
-- 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.EndpointDemographic 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

-- | Specifies demographic information about an endpoint, such as the
-- applicable time zone and platform.
--
-- /See:/ 'newEndpointDemographic' smart constructor.
data EndpointDemographic = EndpointDemographic'
  { -- | The version of the app that\'s associated with the endpoint.
    EndpointDemographic -> Maybe Text
appVersion :: Prelude.Maybe Prelude.Text,
    -- | The locale of the endpoint, in the following format: the ISO 639-1
    -- alpha-2 code, followed by an underscore (_), followed by an ISO 3166-1
    -- alpha-2 value.
    EndpointDemographic -> Maybe Text
locale :: Prelude.Maybe Prelude.Text,
    -- | The manufacturer of the endpoint device, such as apple or samsung.
    EndpointDemographic -> Maybe Text
make :: Prelude.Maybe Prelude.Text,
    -- | The model name or number of the endpoint device, such as iPhone or
    -- SM-G900F.
    EndpointDemographic -> Maybe Text
model :: Prelude.Maybe Prelude.Text,
    -- | The model version of the endpoint device.
    EndpointDemographic -> Maybe Text
modelVersion :: Prelude.Maybe Prelude.Text,
    -- | The platform of the endpoint device, such as ios.
    EndpointDemographic -> Maybe Text
platform :: Prelude.Maybe Prelude.Text,
    -- | The platform version of the endpoint device.
    EndpointDemographic -> Maybe Text
platformVersion :: Prelude.Maybe Prelude.Text,
    -- | The time zone of the endpoint, specified as a tz database name value,
    -- such as America\/Los_Angeles.
    EndpointDemographic -> Maybe Text
timezone :: Prelude.Maybe Prelude.Text
  }
  deriving (EndpointDemographic -> EndpointDemographic -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointDemographic -> EndpointDemographic -> Bool
$c/= :: EndpointDemographic -> EndpointDemographic -> Bool
== :: EndpointDemographic -> EndpointDemographic -> Bool
$c== :: EndpointDemographic -> EndpointDemographic -> Bool
Prelude.Eq, ReadPrec [EndpointDemographic]
ReadPrec EndpointDemographic
Int -> ReadS EndpointDemographic
ReadS [EndpointDemographic]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointDemographic]
$creadListPrec :: ReadPrec [EndpointDemographic]
readPrec :: ReadPrec EndpointDemographic
$creadPrec :: ReadPrec EndpointDemographic
readList :: ReadS [EndpointDemographic]
$creadList :: ReadS [EndpointDemographic]
readsPrec :: Int -> ReadS EndpointDemographic
$creadsPrec :: Int -> ReadS EndpointDemographic
Prelude.Read, Int -> EndpointDemographic -> ShowS
[EndpointDemographic] -> ShowS
EndpointDemographic -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointDemographic] -> ShowS
$cshowList :: [EndpointDemographic] -> ShowS
show :: EndpointDemographic -> String
$cshow :: EndpointDemographic -> String
showsPrec :: Int -> EndpointDemographic -> ShowS
$cshowsPrec :: Int -> EndpointDemographic -> ShowS
Prelude.Show, forall x. Rep EndpointDemographic x -> EndpointDemographic
forall x. EndpointDemographic -> Rep EndpointDemographic x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointDemographic x -> EndpointDemographic
$cfrom :: forall x. EndpointDemographic -> Rep EndpointDemographic x
Prelude.Generic)

-- |
-- Create a value of 'EndpointDemographic' 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:
--
-- 'appVersion', 'endpointDemographic_appVersion' - The version of the app that\'s associated with the endpoint.
--
-- 'locale', 'endpointDemographic_locale' - The locale of the endpoint, in the following format: the ISO 639-1
-- alpha-2 code, followed by an underscore (_), followed by an ISO 3166-1
-- alpha-2 value.
--
-- 'make', 'endpointDemographic_make' - The manufacturer of the endpoint device, such as apple or samsung.
--
-- 'model', 'endpointDemographic_model' - The model name or number of the endpoint device, such as iPhone or
-- SM-G900F.
--
-- 'modelVersion', 'endpointDemographic_modelVersion' - The model version of the endpoint device.
--
-- 'platform', 'endpointDemographic_platform' - The platform of the endpoint device, such as ios.
--
-- 'platformVersion', 'endpointDemographic_platformVersion' - The platform version of the endpoint device.
--
-- 'timezone', 'endpointDemographic_timezone' - The time zone of the endpoint, specified as a tz database name value,
-- such as America\/Los_Angeles.
newEndpointDemographic ::
  EndpointDemographic
newEndpointDemographic :: EndpointDemographic
newEndpointDemographic =
  EndpointDemographic'
    { $sel:appVersion:EndpointDemographic' :: Maybe Text
appVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:locale:EndpointDemographic' :: Maybe Text
locale = forall a. Maybe a
Prelude.Nothing,
      $sel:make:EndpointDemographic' :: Maybe Text
make = forall a. Maybe a
Prelude.Nothing,
      $sel:model:EndpointDemographic' :: Maybe Text
model = forall a. Maybe a
Prelude.Nothing,
      $sel:modelVersion:EndpointDemographic' :: Maybe Text
modelVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:platform:EndpointDemographic' :: Maybe Text
platform = forall a. Maybe a
Prelude.Nothing,
      $sel:platformVersion:EndpointDemographic' :: Maybe Text
platformVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:timezone:EndpointDemographic' :: Maybe Text
timezone = forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the app that\'s associated with the endpoint.
endpointDemographic_appVersion :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_appVersion :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_appVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
appVersion :: Maybe Text
$sel:appVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
appVersion} -> Maybe Text
appVersion) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:appVersion:EndpointDemographic' :: Maybe Text
appVersion = Maybe Text
a} :: EndpointDemographic)

-- | The locale of the endpoint, in the following format: the ISO 639-1
-- alpha-2 code, followed by an underscore (_), followed by an ISO 3166-1
-- alpha-2 value.
endpointDemographic_locale :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_locale :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_locale = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
locale :: Maybe Text
$sel:locale:EndpointDemographic' :: EndpointDemographic -> Maybe Text
locale} -> Maybe Text
locale) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:locale:EndpointDemographic' :: Maybe Text
locale = Maybe Text
a} :: EndpointDemographic)

-- | The manufacturer of the endpoint device, such as apple or samsung.
endpointDemographic_make :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_make :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_make = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
make :: Maybe Text
$sel:make:EndpointDemographic' :: EndpointDemographic -> Maybe Text
make} -> Maybe Text
make) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:make:EndpointDemographic' :: Maybe Text
make = Maybe Text
a} :: EndpointDemographic)

-- | The model name or number of the endpoint device, such as iPhone or
-- SM-G900F.
endpointDemographic_model :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_model :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_model = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
model :: Maybe Text
$sel:model:EndpointDemographic' :: EndpointDemographic -> Maybe Text
model} -> Maybe Text
model) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:model:EndpointDemographic' :: Maybe Text
model = Maybe Text
a} :: EndpointDemographic)

-- | The model version of the endpoint device.
endpointDemographic_modelVersion :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_modelVersion :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_modelVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
modelVersion :: Maybe Text
$sel:modelVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
modelVersion} -> Maybe Text
modelVersion) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:modelVersion:EndpointDemographic' :: Maybe Text
modelVersion = Maybe Text
a} :: EndpointDemographic)

-- | The platform of the endpoint device, such as ios.
endpointDemographic_platform :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_platform :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_platform = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
platform :: Maybe Text
$sel:platform:EndpointDemographic' :: EndpointDemographic -> Maybe Text
platform} -> Maybe Text
platform) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:platform:EndpointDemographic' :: Maybe Text
platform = Maybe Text
a} :: EndpointDemographic)

-- | The platform version of the endpoint device.
endpointDemographic_platformVersion :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_platformVersion :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_platformVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
platformVersion :: Maybe Text
$sel:platformVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
platformVersion} -> Maybe Text
platformVersion) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:platformVersion:EndpointDemographic' :: Maybe Text
platformVersion = Maybe Text
a} :: EndpointDemographic)

-- | The time zone of the endpoint, specified as a tz database name value,
-- such as America\/Los_Angeles.
endpointDemographic_timezone :: Lens.Lens' EndpointDemographic (Prelude.Maybe Prelude.Text)
endpointDemographic_timezone :: Lens' EndpointDemographic (Maybe Text)
endpointDemographic_timezone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDemographic' {Maybe Text
timezone :: Maybe Text
$sel:timezone:EndpointDemographic' :: EndpointDemographic -> Maybe Text
timezone} -> Maybe Text
timezone) (\s :: EndpointDemographic
s@EndpointDemographic' {} Maybe Text
a -> EndpointDemographic
s {$sel:timezone:EndpointDemographic' :: Maybe Text
timezone = Maybe Text
a} :: EndpointDemographic)

instance Data.FromJSON EndpointDemographic where
  parseJSON :: Value -> Parser EndpointDemographic
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EndpointDemographic"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> EndpointDemographic
EndpointDemographic'
            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
"AppVersion")
            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
"Locale")
            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
"Make")
            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
"Model")
            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
"ModelVersion")
            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
"Platform")
            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
"PlatformVersion")
            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
"Timezone")
      )

instance Prelude.Hashable EndpointDemographic where
  hashWithSalt :: Int -> EndpointDemographic -> Int
hashWithSalt Int
_salt EndpointDemographic' {Maybe Text
timezone :: Maybe Text
platformVersion :: Maybe Text
platform :: Maybe Text
modelVersion :: Maybe Text
model :: Maybe Text
make :: Maybe Text
locale :: Maybe Text
appVersion :: Maybe Text
$sel:timezone:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:platformVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:platform:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:modelVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:model:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:make:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:locale:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:appVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
locale
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
make
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
model
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
modelVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
platform
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
platformVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timezone

instance Prelude.NFData EndpointDemographic where
  rnf :: EndpointDemographic -> ()
rnf EndpointDemographic' {Maybe Text
timezone :: Maybe Text
platformVersion :: Maybe Text
platform :: Maybe Text
modelVersion :: Maybe Text
model :: Maybe Text
make :: Maybe Text
locale :: Maybe Text
appVersion :: Maybe Text
$sel:timezone:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:platformVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:platform:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:modelVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:model:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:make:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:locale:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:appVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
locale
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
make
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
model
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
modelVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
platform
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
platformVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timezone

instance Data.ToJSON EndpointDemographic where
  toJSON :: EndpointDemographic -> Value
toJSON EndpointDemographic' {Maybe Text
timezone :: Maybe Text
platformVersion :: Maybe Text
platform :: Maybe Text
modelVersion :: Maybe Text
model :: Maybe Text
make :: Maybe Text
locale :: Maybe Text
appVersion :: Maybe Text
$sel:timezone:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:platformVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:platform:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:modelVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:model:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:make:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:locale:EndpointDemographic' :: EndpointDemographic -> Maybe Text
$sel:appVersion:EndpointDemographic' :: EndpointDemographic -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AppVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
appVersion,
            (Key
"Locale" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
locale,
            (Key
"Make" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
make,
            (Key
"Model" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
model,
            (Key
"ModelVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
modelVersion,
            (Key
"Platform" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
platform,
            (Key
"PlatformVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
platformVersion,
            (Key
"Timezone" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
timezone
          ]
      )