{-# 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.SigninDelegateGroup
-- 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.SigninDelegateGroup where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An Active Directory (AD) group whose members are granted permission to
-- act as delegates.
--
-- /See:/ 'newSigninDelegateGroup' smart constructor.
data SigninDelegateGroup = SigninDelegateGroup'
  { -- | The group name.
    SigninDelegateGroup -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (SigninDelegateGroup -> SigninDelegateGroup -> Bool
(SigninDelegateGroup -> SigninDelegateGroup -> Bool)
-> (SigninDelegateGroup -> SigninDelegateGroup -> Bool)
-> Eq SigninDelegateGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigninDelegateGroup -> SigninDelegateGroup -> Bool
$c/= :: SigninDelegateGroup -> SigninDelegateGroup -> Bool
== :: SigninDelegateGroup -> SigninDelegateGroup -> Bool
$c== :: SigninDelegateGroup -> SigninDelegateGroup -> Bool
Prelude.Eq, ReadPrec [SigninDelegateGroup]
ReadPrec SigninDelegateGroup
Int -> ReadS SigninDelegateGroup
ReadS [SigninDelegateGroup]
(Int -> ReadS SigninDelegateGroup)
-> ReadS [SigninDelegateGroup]
-> ReadPrec SigninDelegateGroup
-> ReadPrec [SigninDelegateGroup]
-> Read SigninDelegateGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SigninDelegateGroup]
$creadListPrec :: ReadPrec [SigninDelegateGroup]
readPrec :: ReadPrec SigninDelegateGroup
$creadPrec :: ReadPrec SigninDelegateGroup
readList :: ReadS [SigninDelegateGroup]
$creadList :: ReadS [SigninDelegateGroup]
readsPrec :: Int -> ReadS SigninDelegateGroup
$creadsPrec :: Int -> ReadS SigninDelegateGroup
Prelude.Read, Int -> SigninDelegateGroup -> ShowS
[SigninDelegateGroup] -> ShowS
SigninDelegateGroup -> String
(Int -> SigninDelegateGroup -> ShowS)
-> (SigninDelegateGroup -> String)
-> ([SigninDelegateGroup] -> ShowS)
-> Show SigninDelegateGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigninDelegateGroup] -> ShowS
$cshowList :: [SigninDelegateGroup] -> ShowS
show :: SigninDelegateGroup -> String
$cshow :: SigninDelegateGroup -> String
showsPrec :: Int -> SigninDelegateGroup -> ShowS
$cshowsPrec :: Int -> SigninDelegateGroup -> ShowS
Prelude.Show, (forall x. SigninDelegateGroup -> Rep SigninDelegateGroup x)
-> (forall x. Rep SigninDelegateGroup x -> SigninDelegateGroup)
-> Generic SigninDelegateGroup
forall x. Rep SigninDelegateGroup x -> SigninDelegateGroup
forall x. SigninDelegateGroup -> Rep SigninDelegateGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SigninDelegateGroup x -> SigninDelegateGroup
$cfrom :: forall x. SigninDelegateGroup -> Rep SigninDelegateGroup x
Prelude.Generic)

-- |
-- Create a value of 'SigninDelegateGroup' 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:
--
-- 'groupName', 'signinDelegateGroup_groupName' - The group name.
newSigninDelegateGroup ::
  SigninDelegateGroup
newSigninDelegateGroup :: SigninDelegateGroup
newSigninDelegateGroup =
  SigninDelegateGroup' :: Maybe Text -> SigninDelegateGroup
SigninDelegateGroup' {$sel:groupName:SigninDelegateGroup' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The group name.
signinDelegateGroup_groupName :: Lens.Lens' SigninDelegateGroup (Prelude.Maybe Prelude.Text)
signinDelegateGroup_groupName :: (Maybe Text -> f (Maybe Text))
-> SigninDelegateGroup -> f SigninDelegateGroup
signinDelegateGroup_groupName = (SigninDelegateGroup -> Maybe Text)
-> (SigninDelegateGroup -> Maybe Text -> SigninDelegateGroup)
-> Lens
     SigninDelegateGroup SigninDelegateGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigninDelegateGroup' {Maybe Text
groupName :: Maybe Text
$sel:groupName:SigninDelegateGroup' :: SigninDelegateGroup -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: SigninDelegateGroup
s@SigninDelegateGroup' {} Maybe Text
a -> SigninDelegateGroup
s {$sel:groupName:SigninDelegateGroup' :: Maybe Text
groupName = Maybe Text
a} :: SigninDelegateGroup)

instance Core.FromJSON SigninDelegateGroup where
  parseJSON :: Value -> Parser SigninDelegateGroup
parseJSON =
    String
-> (Object -> Parser SigninDelegateGroup)
-> Value
-> Parser SigninDelegateGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SigninDelegateGroup"
      ( \Object
x ->
          Maybe Text -> SigninDelegateGroup
SigninDelegateGroup'
            (Maybe Text -> SigninDelegateGroup)
-> Parser (Maybe Text) -> Parser SigninDelegateGroup
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
"GroupName")
      )

instance Prelude.Hashable SigninDelegateGroup

instance Prelude.NFData SigninDelegateGroup

instance Core.ToJSON SigninDelegateGroup where
  toJSON :: SigninDelegateGroup -> Value
toJSON SigninDelegateGroup' {Maybe Text
groupName :: Maybe Text
$sel:groupName:SigninDelegateGroup' :: SigninDelegateGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"GroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
groupName]
      )