{-# 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.QuickSight.Types.FolderMember
-- 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.QuickSight.Types.FolderMember where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.MemberType

-- | An asset in a folder, such as a dashboard, analysis, or dataset.
--
-- /See:/ 'newFolderMember' smart constructor.
data FolderMember = FolderMember'
  { -- | The ID of the asset.
    FolderMember -> Maybe Text
memberId :: Prelude.Maybe Prelude.Text,
    -- | The type of the asset.
    FolderMember -> Maybe MemberType
memberType :: Prelude.Maybe MemberType
  }
  deriving (FolderMember -> FolderMember -> Bool
(FolderMember -> FolderMember -> Bool)
-> (FolderMember -> FolderMember -> Bool) -> Eq FolderMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FolderMember -> FolderMember -> Bool
$c/= :: FolderMember -> FolderMember -> Bool
== :: FolderMember -> FolderMember -> Bool
$c== :: FolderMember -> FolderMember -> Bool
Prelude.Eq, ReadPrec [FolderMember]
ReadPrec FolderMember
Int -> ReadS FolderMember
ReadS [FolderMember]
(Int -> ReadS FolderMember)
-> ReadS [FolderMember]
-> ReadPrec FolderMember
-> ReadPrec [FolderMember]
-> Read FolderMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FolderMember]
$creadListPrec :: ReadPrec [FolderMember]
readPrec :: ReadPrec FolderMember
$creadPrec :: ReadPrec FolderMember
readList :: ReadS [FolderMember]
$creadList :: ReadS [FolderMember]
readsPrec :: Int -> ReadS FolderMember
$creadsPrec :: Int -> ReadS FolderMember
Prelude.Read, Int -> FolderMember -> ShowS
[FolderMember] -> ShowS
FolderMember -> String
(Int -> FolderMember -> ShowS)
-> (FolderMember -> String)
-> ([FolderMember] -> ShowS)
-> Show FolderMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FolderMember] -> ShowS
$cshowList :: [FolderMember] -> ShowS
show :: FolderMember -> String
$cshow :: FolderMember -> String
showsPrec :: Int -> FolderMember -> ShowS
$cshowsPrec :: Int -> FolderMember -> ShowS
Prelude.Show, (forall x. FolderMember -> Rep FolderMember x)
-> (forall x. Rep FolderMember x -> FolderMember)
-> Generic FolderMember
forall x. Rep FolderMember x -> FolderMember
forall x. FolderMember -> Rep FolderMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FolderMember x -> FolderMember
$cfrom :: forall x. FolderMember -> Rep FolderMember x
Prelude.Generic)

-- |
-- Create a value of 'FolderMember' 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:
--
-- 'memberId', 'folderMember_memberId' - The ID of the asset.
--
-- 'memberType', 'folderMember_memberType' - The type of the asset.
newFolderMember ::
  FolderMember
newFolderMember :: FolderMember
newFolderMember =
  FolderMember' :: Maybe Text -> Maybe MemberType -> FolderMember
FolderMember'
    { $sel:memberId:FolderMember' :: Maybe Text
memberId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:memberType:FolderMember' :: Maybe MemberType
memberType = Maybe MemberType
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the asset.
folderMember_memberId :: Lens.Lens' FolderMember (Prelude.Maybe Prelude.Text)
folderMember_memberId :: (Maybe Text -> f (Maybe Text)) -> FolderMember -> f FolderMember
folderMember_memberId = (FolderMember -> Maybe Text)
-> (FolderMember -> Maybe Text -> FolderMember)
-> Lens FolderMember FolderMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FolderMember' {Maybe Text
memberId :: Maybe Text
$sel:memberId:FolderMember' :: FolderMember -> Maybe Text
memberId} -> Maybe Text
memberId) (\s :: FolderMember
s@FolderMember' {} Maybe Text
a -> FolderMember
s {$sel:memberId:FolderMember' :: Maybe Text
memberId = Maybe Text
a} :: FolderMember)

-- | The type of the asset.
folderMember_memberType :: Lens.Lens' FolderMember (Prelude.Maybe MemberType)
folderMember_memberType :: (Maybe MemberType -> f (Maybe MemberType))
-> FolderMember -> f FolderMember
folderMember_memberType = (FolderMember -> Maybe MemberType)
-> (FolderMember -> Maybe MemberType -> FolderMember)
-> Lens
     FolderMember FolderMember (Maybe MemberType) (Maybe MemberType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FolderMember' {Maybe MemberType
memberType :: Maybe MemberType
$sel:memberType:FolderMember' :: FolderMember -> Maybe MemberType
memberType} -> Maybe MemberType
memberType) (\s :: FolderMember
s@FolderMember' {} Maybe MemberType
a -> FolderMember
s {$sel:memberType:FolderMember' :: Maybe MemberType
memberType = Maybe MemberType
a} :: FolderMember)

instance Core.FromJSON FolderMember where
  parseJSON :: Value -> Parser FolderMember
parseJSON =
    String
-> (Object -> Parser FolderMember) -> Value -> Parser FolderMember
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FolderMember"
      ( \Object
x ->
          Maybe Text -> Maybe MemberType -> FolderMember
FolderMember'
            (Maybe Text -> Maybe MemberType -> FolderMember)
-> Parser (Maybe Text) -> Parser (Maybe MemberType -> FolderMember)
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
"MemberId")
            Parser (Maybe MemberType -> FolderMember)
-> Parser (Maybe MemberType) -> Parser FolderMember
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MemberType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MemberType")
      )

instance Prelude.Hashable FolderMember

instance Prelude.NFData FolderMember