{-# 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.WorkDocs.Types.GroupMetadata
-- 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.WorkDocs.Types.GroupMetadata where

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

-- | Describes the metadata of a user group.
--
-- /See:/ 'newGroupMetadata' smart constructor.
data GroupMetadata = GroupMetadata'
  { -- | The name of the group.
    GroupMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the user group.
    GroupMetadata -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (GroupMetadata -> GroupMetadata -> Bool
(GroupMetadata -> GroupMetadata -> Bool)
-> (GroupMetadata -> GroupMetadata -> Bool) -> Eq GroupMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupMetadata -> GroupMetadata -> Bool
$c/= :: GroupMetadata -> GroupMetadata -> Bool
== :: GroupMetadata -> GroupMetadata -> Bool
$c== :: GroupMetadata -> GroupMetadata -> Bool
Prelude.Eq, ReadPrec [GroupMetadata]
ReadPrec GroupMetadata
Int -> ReadS GroupMetadata
ReadS [GroupMetadata]
(Int -> ReadS GroupMetadata)
-> ReadS [GroupMetadata]
-> ReadPrec GroupMetadata
-> ReadPrec [GroupMetadata]
-> Read GroupMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupMetadata]
$creadListPrec :: ReadPrec [GroupMetadata]
readPrec :: ReadPrec GroupMetadata
$creadPrec :: ReadPrec GroupMetadata
readList :: ReadS [GroupMetadata]
$creadList :: ReadS [GroupMetadata]
readsPrec :: Int -> ReadS GroupMetadata
$creadsPrec :: Int -> ReadS GroupMetadata
Prelude.Read, Int -> GroupMetadata -> ShowS
[GroupMetadata] -> ShowS
GroupMetadata -> String
(Int -> GroupMetadata -> ShowS)
-> (GroupMetadata -> String)
-> ([GroupMetadata] -> ShowS)
-> Show GroupMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupMetadata] -> ShowS
$cshowList :: [GroupMetadata] -> ShowS
show :: GroupMetadata -> String
$cshow :: GroupMetadata -> String
showsPrec :: Int -> GroupMetadata -> ShowS
$cshowsPrec :: Int -> GroupMetadata -> ShowS
Prelude.Show, (forall x. GroupMetadata -> Rep GroupMetadata x)
-> (forall x. Rep GroupMetadata x -> GroupMetadata)
-> Generic GroupMetadata
forall x. Rep GroupMetadata x -> GroupMetadata
forall x. GroupMetadata -> Rep GroupMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GroupMetadata x -> GroupMetadata
$cfrom :: forall x. GroupMetadata -> Rep GroupMetadata x
Prelude.Generic)

-- |
-- Create a value of 'GroupMetadata' 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:
--
-- 'name', 'groupMetadata_name' - The name of the group.
--
-- 'id', 'groupMetadata_id' - The ID of the user group.
newGroupMetadata ::
  GroupMetadata
newGroupMetadata :: GroupMetadata
newGroupMetadata =
  GroupMetadata' :: Maybe Text -> Maybe Text -> GroupMetadata
GroupMetadata'
    { $sel:name:GroupMetadata' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:GroupMetadata' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The ID of the user group.
groupMetadata_id :: Lens.Lens' GroupMetadata (Prelude.Maybe Prelude.Text)
groupMetadata_id :: (Maybe Text -> f (Maybe Text)) -> GroupMetadata -> f GroupMetadata
groupMetadata_id = (GroupMetadata -> Maybe Text)
-> (GroupMetadata -> Maybe Text -> GroupMetadata)
-> Lens GroupMetadata GroupMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupMetadata' {Maybe Text
id :: Maybe Text
$sel:id:GroupMetadata' :: GroupMetadata -> Maybe Text
id} -> Maybe Text
id) (\s :: GroupMetadata
s@GroupMetadata' {} Maybe Text
a -> GroupMetadata
s {$sel:id:GroupMetadata' :: Maybe Text
id = Maybe Text
a} :: GroupMetadata)

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

instance Prelude.Hashable GroupMetadata

instance Prelude.NFData GroupMetadata