{-# 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.AlexaBusiness.Types.UserData
-- 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.AlexaBusiness.Types.UserData where

import Amazonka.AlexaBusiness.Types.EnrollmentStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information related to a user.
--
-- /See:/ 'newUserData' smart constructor.
data UserData = UserData'
  { -- | The email of a user.
    UserData -> Maybe Text
email :: Prelude.Maybe Prelude.Text,
    -- | The last name of a user.
    UserData -> Maybe Text
lastName :: Prelude.Maybe Prelude.Text,
    -- | The enrollment ARN of a user.
    UserData -> Maybe Text
enrollmentId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of a user.
    UserData -> Maybe Text
userArn :: Prelude.Maybe Prelude.Text,
    -- | The first name of a user.
    UserData -> Maybe Text
firstName :: Prelude.Maybe Prelude.Text,
    -- | The enrollment status of a user.
    UserData -> Maybe EnrollmentStatus
enrollmentStatus :: Prelude.Maybe EnrollmentStatus
  }
  deriving (UserData -> UserData -> Bool
(UserData -> UserData -> Bool)
-> (UserData -> UserData -> Bool) -> Eq UserData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserData -> UserData -> Bool
$c/= :: UserData -> UserData -> Bool
== :: UserData -> UserData -> Bool
$c== :: UserData -> UserData -> Bool
Prelude.Eq, ReadPrec [UserData]
ReadPrec UserData
Int -> ReadS UserData
ReadS [UserData]
(Int -> ReadS UserData)
-> ReadS [UserData]
-> ReadPrec UserData
-> ReadPrec [UserData]
-> Read UserData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserData]
$creadListPrec :: ReadPrec [UserData]
readPrec :: ReadPrec UserData
$creadPrec :: ReadPrec UserData
readList :: ReadS [UserData]
$creadList :: ReadS [UserData]
readsPrec :: Int -> ReadS UserData
$creadsPrec :: Int -> ReadS UserData
Prelude.Read, Int -> UserData -> ShowS
[UserData] -> ShowS
UserData -> String
(Int -> UserData -> ShowS)
-> (UserData -> String) -> ([UserData] -> ShowS) -> Show UserData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserData] -> ShowS
$cshowList :: [UserData] -> ShowS
show :: UserData -> String
$cshow :: UserData -> String
showsPrec :: Int -> UserData -> ShowS
$cshowsPrec :: Int -> UserData -> ShowS
Prelude.Show, (forall x. UserData -> Rep UserData x)
-> (forall x. Rep UserData x -> UserData) -> Generic UserData
forall x. Rep UserData x -> UserData
forall x. UserData -> Rep UserData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserData x -> UserData
$cfrom :: forall x. UserData -> Rep UserData x
Prelude.Generic)

-- |
-- Create a value of 'UserData' 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:
--
-- 'email', 'userData_email' - The email of a user.
--
-- 'lastName', 'userData_lastName' - The last name of a user.
--
-- 'enrollmentId', 'userData_enrollmentId' - The enrollment ARN of a user.
--
-- 'userArn', 'userData_userArn' - The ARN of a user.
--
-- 'firstName', 'userData_firstName' - The first name of a user.
--
-- 'enrollmentStatus', 'userData_enrollmentStatus' - The enrollment status of a user.
newUserData ::
  UserData
newUserData :: UserData
newUserData =
  UserData' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EnrollmentStatus
-> UserData
UserData'
    { $sel:email:UserData' :: Maybe Text
email = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastName:UserData' :: Maybe Text
lastName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enrollmentId:UserData' :: Maybe Text
enrollmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userArn:UserData' :: Maybe Text
userArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firstName:UserData' :: Maybe Text
firstName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enrollmentStatus:UserData' :: Maybe EnrollmentStatus
enrollmentStatus = Maybe EnrollmentStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The email of a user.
userData_email :: Lens.Lens' UserData (Prelude.Maybe Prelude.Text)
userData_email :: (Maybe Text -> f (Maybe Text)) -> UserData -> f UserData
userData_email = (UserData -> Maybe Text)
-> (UserData -> Maybe Text -> UserData)
-> Lens UserData UserData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserData' {Maybe Text
email :: Maybe Text
$sel:email:UserData' :: UserData -> Maybe Text
email} -> Maybe Text
email) (\s :: UserData
s@UserData' {} Maybe Text
a -> UserData
s {$sel:email:UserData' :: Maybe Text
email = Maybe Text
a} :: UserData)

-- | The last name of a user.
userData_lastName :: Lens.Lens' UserData (Prelude.Maybe Prelude.Text)
userData_lastName :: (Maybe Text -> f (Maybe Text)) -> UserData -> f UserData
userData_lastName = (UserData -> Maybe Text)
-> (UserData -> Maybe Text -> UserData)
-> Lens UserData UserData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserData' {Maybe Text
lastName :: Maybe Text
$sel:lastName:UserData' :: UserData -> Maybe Text
lastName} -> Maybe Text
lastName) (\s :: UserData
s@UserData' {} Maybe Text
a -> UserData
s {$sel:lastName:UserData' :: Maybe Text
lastName = Maybe Text
a} :: UserData)

-- | The enrollment ARN of a user.
userData_enrollmentId :: Lens.Lens' UserData (Prelude.Maybe Prelude.Text)
userData_enrollmentId :: (Maybe Text -> f (Maybe Text)) -> UserData -> f UserData
userData_enrollmentId = (UserData -> Maybe Text)
-> (UserData -> Maybe Text -> UserData)
-> Lens UserData UserData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserData' {Maybe Text
enrollmentId :: Maybe Text
$sel:enrollmentId:UserData' :: UserData -> Maybe Text
enrollmentId} -> Maybe Text
enrollmentId) (\s :: UserData
s@UserData' {} Maybe Text
a -> UserData
s {$sel:enrollmentId:UserData' :: Maybe Text
enrollmentId = Maybe Text
a} :: UserData)

-- | The ARN of a user.
userData_userArn :: Lens.Lens' UserData (Prelude.Maybe Prelude.Text)
userData_userArn :: (Maybe Text -> f (Maybe Text)) -> UserData -> f UserData
userData_userArn = (UserData -> Maybe Text)
-> (UserData -> Maybe Text -> UserData)
-> Lens UserData UserData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserData' {Maybe Text
userArn :: Maybe Text
$sel:userArn:UserData' :: UserData -> Maybe Text
userArn} -> Maybe Text
userArn) (\s :: UserData
s@UserData' {} Maybe Text
a -> UserData
s {$sel:userArn:UserData' :: Maybe Text
userArn = Maybe Text
a} :: UserData)

-- | The first name of a user.
userData_firstName :: Lens.Lens' UserData (Prelude.Maybe Prelude.Text)
userData_firstName :: (Maybe Text -> f (Maybe Text)) -> UserData -> f UserData
userData_firstName = (UserData -> Maybe Text)
-> (UserData -> Maybe Text -> UserData)
-> Lens UserData UserData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserData' {Maybe Text
firstName :: Maybe Text
$sel:firstName:UserData' :: UserData -> Maybe Text
firstName} -> Maybe Text
firstName) (\s :: UserData
s@UserData' {} Maybe Text
a -> UserData
s {$sel:firstName:UserData' :: Maybe Text
firstName = Maybe Text
a} :: UserData)

-- | The enrollment status of a user.
userData_enrollmentStatus :: Lens.Lens' UserData (Prelude.Maybe EnrollmentStatus)
userData_enrollmentStatus :: (Maybe EnrollmentStatus -> f (Maybe EnrollmentStatus))
-> UserData -> f UserData
userData_enrollmentStatus = (UserData -> Maybe EnrollmentStatus)
-> (UserData -> Maybe EnrollmentStatus -> UserData)
-> Lens
     UserData UserData (Maybe EnrollmentStatus) (Maybe EnrollmentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserData' {Maybe EnrollmentStatus
enrollmentStatus :: Maybe EnrollmentStatus
$sel:enrollmentStatus:UserData' :: UserData -> Maybe EnrollmentStatus
enrollmentStatus} -> Maybe EnrollmentStatus
enrollmentStatus) (\s :: UserData
s@UserData' {} Maybe EnrollmentStatus
a -> UserData
s {$sel:enrollmentStatus:UserData' :: Maybe EnrollmentStatus
enrollmentStatus = Maybe EnrollmentStatus
a} :: UserData)

instance Core.FromJSON UserData where
  parseJSON :: Value -> Parser UserData
parseJSON =
    String -> (Object -> Parser UserData) -> Value -> Parser UserData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserData"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EnrollmentStatus
-> UserData
UserData'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe EnrollmentStatus
 -> UserData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe EnrollmentStatus
      -> UserData)
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
"Email")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe EnrollmentStatus
   -> UserData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe EnrollmentStatus -> UserData)
forall (f :: * -> *) a b. Applicative f => 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
"LastName")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe EnrollmentStatus -> UserData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe EnrollmentStatus -> UserData)
forall (f :: * -> *) a b. Applicative f => 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
"EnrollmentId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe EnrollmentStatus -> UserData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe EnrollmentStatus -> UserData)
forall (f :: * -> *) a b. Applicative f => 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
"UserArn")
            Parser (Maybe Text -> Maybe EnrollmentStatus -> UserData)
-> Parser (Maybe Text)
-> Parser (Maybe EnrollmentStatus -> UserData)
forall (f :: * -> *) a b. Applicative f => 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
"FirstName")
            Parser (Maybe EnrollmentStatus -> UserData)
-> Parser (Maybe EnrollmentStatus) -> Parser UserData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EnrollmentStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EnrollmentStatus")
      )

instance Prelude.Hashable UserData

instance Prelude.NFData UserData