{-# 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.Chime.Types.AppInstanceAdmin
-- 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.Chime.Types.AppInstanceAdmin where

import Amazonka.Chime.Types.Identity
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of an @AppInstanceAdmin@.
--
-- /See:/ 'newAppInstanceAdmin' smart constructor.
data AppInstanceAdmin = AppInstanceAdmin'
  { -- | The @AppInstanceAdmin@ data.
    AppInstanceAdmin -> Maybe Identity
admin :: Prelude.Maybe Identity,
    -- | The ARN of the @AppInstance@ for which the user is an administrator.
    AppInstanceAdmin -> Maybe Text
appInstanceArn :: Prelude.Maybe Prelude.Text,
    -- | The time at which an administrator was created.
    AppInstanceAdmin -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (AppInstanceAdmin -> AppInstanceAdmin -> Bool
(AppInstanceAdmin -> AppInstanceAdmin -> Bool)
-> (AppInstanceAdmin -> AppInstanceAdmin -> Bool)
-> Eq AppInstanceAdmin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppInstanceAdmin -> AppInstanceAdmin -> Bool
$c/= :: AppInstanceAdmin -> AppInstanceAdmin -> Bool
== :: AppInstanceAdmin -> AppInstanceAdmin -> Bool
$c== :: AppInstanceAdmin -> AppInstanceAdmin -> Bool
Prelude.Eq, Int -> AppInstanceAdmin -> ShowS
[AppInstanceAdmin] -> ShowS
AppInstanceAdmin -> String
(Int -> AppInstanceAdmin -> ShowS)
-> (AppInstanceAdmin -> String)
-> ([AppInstanceAdmin] -> ShowS)
-> Show AppInstanceAdmin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppInstanceAdmin] -> ShowS
$cshowList :: [AppInstanceAdmin] -> ShowS
show :: AppInstanceAdmin -> String
$cshow :: AppInstanceAdmin -> String
showsPrec :: Int -> AppInstanceAdmin -> ShowS
$cshowsPrec :: Int -> AppInstanceAdmin -> ShowS
Prelude.Show, (forall x. AppInstanceAdmin -> Rep AppInstanceAdmin x)
-> (forall x. Rep AppInstanceAdmin x -> AppInstanceAdmin)
-> Generic AppInstanceAdmin
forall x. Rep AppInstanceAdmin x -> AppInstanceAdmin
forall x. AppInstanceAdmin -> Rep AppInstanceAdmin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppInstanceAdmin x -> AppInstanceAdmin
$cfrom :: forall x. AppInstanceAdmin -> Rep AppInstanceAdmin x
Prelude.Generic)

-- |
-- Create a value of 'AppInstanceAdmin' 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:
--
-- 'admin', 'appInstanceAdmin_admin' - The @AppInstanceAdmin@ data.
--
-- 'appInstanceArn', 'appInstanceAdmin_appInstanceArn' - The ARN of the @AppInstance@ for which the user is an administrator.
--
-- 'createdTimestamp', 'appInstanceAdmin_createdTimestamp' - The time at which an administrator was created.
newAppInstanceAdmin ::
  AppInstanceAdmin
newAppInstanceAdmin :: AppInstanceAdmin
newAppInstanceAdmin =
  AppInstanceAdmin' :: Maybe Identity -> Maybe Text -> Maybe POSIX -> AppInstanceAdmin
AppInstanceAdmin'
    { $sel:admin:AppInstanceAdmin' :: Maybe Identity
admin = Maybe Identity
forall a. Maybe a
Prelude.Nothing,
      $sel:appInstanceArn:AppInstanceAdmin' :: Maybe Text
appInstanceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:AppInstanceAdmin' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The @AppInstanceAdmin@ data.
appInstanceAdmin_admin :: Lens.Lens' AppInstanceAdmin (Prelude.Maybe Identity)
appInstanceAdmin_admin :: (Maybe Identity -> f (Maybe Identity))
-> AppInstanceAdmin -> f AppInstanceAdmin
appInstanceAdmin_admin = (AppInstanceAdmin -> Maybe Identity)
-> (AppInstanceAdmin -> Maybe Identity -> AppInstanceAdmin)
-> Lens
     AppInstanceAdmin AppInstanceAdmin (Maybe Identity) (Maybe Identity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceAdmin' {Maybe Identity
admin :: Maybe Identity
$sel:admin:AppInstanceAdmin' :: AppInstanceAdmin -> Maybe Identity
admin} -> Maybe Identity
admin) (\s :: AppInstanceAdmin
s@AppInstanceAdmin' {} Maybe Identity
a -> AppInstanceAdmin
s {$sel:admin:AppInstanceAdmin' :: Maybe Identity
admin = Maybe Identity
a} :: AppInstanceAdmin)

-- | The ARN of the @AppInstance@ for which the user is an administrator.
appInstanceAdmin_appInstanceArn :: Lens.Lens' AppInstanceAdmin (Prelude.Maybe Prelude.Text)
appInstanceAdmin_appInstanceArn :: (Maybe Text -> f (Maybe Text))
-> AppInstanceAdmin -> f AppInstanceAdmin
appInstanceAdmin_appInstanceArn = (AppInstanceAdmin -> Maybe Text)
-> (AppInstanceAdmin -> Maybe Text -> AppInstanceAdmin)
-> Lens AppInstanceAdmin AppInstanceAdmin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceAdmin' {Maybe Text
appInstanceArn :: Maybe Text
$sel:appInstanceArn:AppInstanceAdmin' :: AppInstanceAdmin -> Maybe Text
appInstanceArn} -> Maybe Text
appInstanceArn) (\s :: AppInstanceAdmin
s@AppInstanceAdmin' {} Maybe Text
a -> AppInstanceAdmin
s {$sel:appInstanceArn:AppInstanceAdmin' :: Maybe Text
appInstanceArn = Maybe Text
a} :: AppInstanceAdmin)

-- | The time at which an administrator was created.
appInstanceAdmin_createdTimestamp :: Lens.Lens' AppInstanceAdmin (Prelude.Maybe Prelude.UTCTime)
appInstanceAdmin_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstanceAdmin -> f AppInstanceAdmin
appInstanceAdmin_createdTimestamp = (AppInstanceAdmin -> Maybe POSIX)
-> (AppInstanceAdmin -> Maybe POSIX -> AppInstanceAdmin)
-> Lens
     AppInstanceAdmin AppInstanceAdmin (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceAdmin' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:AppInstanceAdmin' :: AppInstanceAdmin -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: AppInstanceAdmin
s@AppInstanceAdmin' {} Maybe POSIX
a -> AppInstanceAdmin
s {$sel:createdTimestamp:AppInstanceAdmin' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: AppInstanceAdmin) ((Maybe POSIX -> f (Maybe POSIX))
 -> AppInstanceAdmin -> f AppInstanceAdmin)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstanceAdmin
-> f AppInstanceAdmin
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON AppInstanceAdmin where
  parseJSON :: Value -> Parser AppInstanceAdmin
parseJSON =
    String
-> (Object -> Parser AppInstanceAdmin)
-> Value
-> Parser AppInstanceAdmin
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AppInstanceAdmin"
      ( \Object
x ->
          Maybe Identity -> Maybe Text -> Maybe POSIX -> AppInstanceAdmin
AppInstanceAdmin'
            (Maybe Identity -> Maybe Text -> Maybe POSIX -> AppInstanceAdmin)
-> Parser (Maybe Identity)
-> Parser (Maybe Text -> Maybe POSIX -> AppInstanceAdmin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Identity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Admin")
            Parser (Maybe Text -> Maybe POSIX -> AppInstanceAdmin)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> AppInstanceAdmin)
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
"AppInstanceArn")
            Parser (Maybe POSIX -> AppInstanceAdmin)
-> Parser (Maybe POSIX) -> Parser AppInstanceAdmin
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTimestamp")
      )

instance Prelude.Hashable AppInstanceAdmin

instance Prelude.NFData AppInstanceAdmin