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

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

-- | A folder.
--
-- /See:/ 'newFolder' smart constructor.
data Folder = Folder'
  { -- | The time that the folder was last updated.
    Folder -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Core.POSIX,
    -- | The folder Amazon Resource Name (ARN).
    Folder -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time that the folder was created.
    Folder -> Maybe POSIX
createdTime :: Prelude.Maybe Core.POSIX,
    -- | The folder ID.
    Folder -> Maybe Text
folderId :: Prelude.Maybe Prelude.Text,
    -- | A display name for the folder.
    Folder -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An array of ancestor folder ARN strings.
    Folder -> Maybe (NonEmpty Text)
folderPath :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The type of the folder.
    Folder -> Maybe FolderType
folderType :: Prelude.Maybe FolderType
  }
  deriving (Folder -> Folder -> Bool
(Folder -> Folder -> Bool)
-> (Folder -> Folder -> Bool) -> Eq Folder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Folder -> Folder -> Bool
$c/= :: Folder -> Folder -> Bool
== :: Folder -> Folder -> Bool
$c== :: Folder -> Folder -> Bool
Prelude.Eq, ReadPrec [Folder]
ReadPrec Folder
Int -> ReadS Folder
ReadS [Folder]
(Int -> ReadS Folder)
-> ReadS [Folder]
-> ReadPrec Folder
-> ReadPrec [Folder]
-> Read Folder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Folder]
$creadListPrec :: ReadPrec [Folder]
readPrec :: ReadPrec Folder
$creadPrec :: ReadPrec Folder
readList :: ReadS [Folder]
$creadList :: ReadS [Folder]
readsPrec :: Int -> ReadS Folder
$creadsPrec :: Int -> ReadS Folder
Prelude.Read, Int -> Folder -> ShowS
[Folder] -> ShowS
Folder -> String
(Int -> Folder -> ShowS)
-> (Folder -> String) -> ([Folder] -> ShowS) -> Show Folder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Folder] -> ShowS
$cshowList :: [Folder] -> ShowS
show :: Folder -> String
$cshow :: Folder -> String
showsPrec :: Int -> Folder -> ShowS
$cshowsPrec :: Int -> Folder -> ShowS
Prelude.Show, (forall x. Folder -> Rep Folder x)
-> (forall x. Rep Folder x -> Folder) -> Generic Folder
forall x. Rep Folder x -> Folder
forall x. Folder -> Rep Folder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Folder x -> Folder
$cfrom :: forall x. Folder -> Rep Folder x
Prelude.Generic)

-- |
-- Create a value of 'Folder' 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:
--
-- 'lastUpdatedTime', 'folder_lastUpdatedTime' - The time that the folder was last updated.
--
-- 'arn', 'folder_arn' - The folder Amazon Resource Name (ARN).
--
-- 'createdTime', 'folder_createdTime' - The time that the folder was created.
--
-- 'folderId', 'folder_folderId' - The folder ID.
--
-- 'name', 'folder_name' - A display name for the folder.
--
-- 'folderPath', 'folder_folderPath' - An array of ancestor folder ARN strings.
--
-- 'folderType', 'folder_folderType' - The type of the folder.
newFolder ::
  Folder
newFolder :: Folder
newFolder =
  Folder' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe FolderType
-> Folder
Folder'
    { $sel:lastUpdatedTime:Folder' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Folder' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:Folder' :: Maybe POSIX
createdTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:folderId:Folder' :: Maybe Text
folderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Folder' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:folderPath:Folder' :: Maybe (NonEmpty Text)
folderPath = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:folderType:Folder' :: Maybe FolderType
folderType = Maybe FolderType
forall a. Maybe a
Prelude.Nothing
    }

-- | The time that the folder was last updated.
folder_lastUpdatedTime :: Lens.Lens' Folder (Prelude.Maybe Prelude.UTCTime)
folder_lastUpdatedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Folder -> f Folder
folder_lastUpdatedTime = (Folder -> Maybe POSIX)
-> (Folder -> Maybe POSIX -> Folder)
-> Lens Folder Folder (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:Folder' :: Folder -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: Folder
s@Folder' {} Maybe POSIX
a -> Folder
s {$sel:lastUpdatedTime:Folder' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: Folder) ((Maybe POSIX -> f (Maybe POSIX)) -> Folder -> f Folder)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Folder
-> f Folder
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

-- | The folder Amazon Resource Name (ARN).
folder_arn :: Lens.Lens' Folder (Prelude.Maybe Prelude.Text)
folder_arn :: (Maybe Text -> f (Maybe Text)) -> Folder -> f Folder
folder_arn = (Folder -> Maybe Text)
-> (Folder -> Maybe Text -> Folder)
-> Lens Folder Folder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe Text
arn :: Maybe Text
$sel:arn:Folder' :: Folder -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Folder
s@Folder' {} Maybe Text
a -> Folder
s {$sel:arn:Folder' :: Maybe Text
arn = Maybe Text
a} :: Folder)

-- | The time that the folder was created.
folder_createdTime :: Lens.Lens' Folder (Prelude.Maybe Prelude.UTCTime)
folder_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Folder -> f Folder
folder_createdTime = (Folder -> Maybe POSIX)
-> (Folder -> Maybe POSIX -> Folder)
-> Lens Folder Folder (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:Folder' :: Folder -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: Folder
s@Folder' {} Maybe POSIX
a -> Folder
s {$sel:createdTime:Folder' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: Folder) ((Maybe POSIX -> f (Maybe POSIX)) -> Folder -> f Folder)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Folder
-> f Folder
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

-- | The folder ID.
folder_folderId :: Lens.Lens' Folder (Prelude.Maybe Prelude.Text)
folder_folderId :: (Maybe Text -> f (Maybe Text)) -> Folder -> f Folder
folder_folderId = (Folder -> Maybe Text)
-> (Folder -> Maybe Text -> Folder)
-> Lens Folder Folder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe Text
folderId :: Maybe Text
$sel:folderId:Folder' :: Folder -> Maybe Text
folderId} -> Maybe Text
folderId) (\s :: Folder
s@Folder' {} Maybe Text
a -> Folder
s {$sel:folderId:Folder' :: Maybe Text
folderId = Maybe Text
a} :: Folder)

-- | A display name for the folder.
folder_name :: Lens.Lens' Folder (Prelude.Maybe Prelude.Text)
folder_name :: (Maybe Text -> f (Maybe Text)) -> Folder -> f Folder
folder_name = (Folder -> Maybe Text)
-> (Folder -> Maybe Text -> Folder)
-> Lens Folder Folder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe Text
name :: Maybe Text
$sel:name:Folder' :: Folder -> Maybe Text
name} -> Maybe Text
name) (\s :: Folder
s@Folder' {} Maybe Text
a -> Folder
s {$sel:name:Folder' :: Maybe Text
name = Maybe Text
a} :: Folder)

-- | An array of ancestor folder ARN strings.
folder_folderPath :: Lens.Lens' Folder (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
folder_folderPath :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Folder -> f Folder
folder_folderPath = (Folder -> Maybe (NonEmpty Text))
-> (Folder -> Maybe (NonEmpty Text) -> Folder)
-> Lens
     Folder Folder (Maybe (NonEmpty Text)) (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe (NonEmpty Text)
folderPath :: Maybe (NonEmpty Text)
$sel:folderPath:Folder' :: Folder -> Maybe (NonEmpty Text)
folderPath} -> Maybe (NonEmpty Text)
folderPath) (\s :: Folder
s@Folder' {} Maybe (NonEmpty Text)
a -> Folder
s {$sel:folderPath:Folder' :: Maybe (NonEmpty Text)
folderPath = Maybe (NonEmpty Text)
a} :: Folder) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> Folder -> f Folder)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Folder
-> f Folder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of the folder.
folder_folderType :: Lens.Lens' Folder (Prelude.Maybe FolderType)
folder_folderType :: (Maybe FolderType -> f (Maybe FolderType)) -> Folder -> f Folder
folder_folderType = (Folder -> Maybe FolderType)
-> (Folder -> Maybe FolderType -> Folder)
-> Lens Folder Folder (Maybe FolderType) (Maybe FolderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Folder' {Maybe FolderType
folderType :: Maybe FolderType
$sel:folderType:Folder' :: Folder -> Maybe FolderType
folderType} -> Maybe FolderType
folderType) (\s :: Folder
s@Folder' {} Maybe FolderType
a -> Folder
s {$sel:folderType:Folder' :: Maybe FolderType
folderType = Maybe FolderType
a} :: Folder)

instance Core.FromJSON Folder where
  parseJSON :: Value -> Parser Folder
parseJSON =
    String -> (Object -> Parser Folder) -> Value -> Parser Folder
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Folder"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe FolderType
-> Folder
Folder'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty Text)
 -> Maybe FolderType
 -> Folder)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty Text)
      -> Maybe FolderType
      -> Folder)
forall (f :: * -> *) a b. Functor 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
"LastUpdatedTime")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty Text)
   -> Maybe FolderType
   -> Folder)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty Text)
      -> Maybe FolderType
      -> Folder)
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
"Arn")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty Text)
   -> Maybe FolderType
   -> Folder)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty Text)
      -> Maybe FolderType
      -> Folder)
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
"CreatedTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty Text)
   -> Maybe FolderType
   -> Folder)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe (NonEmpty Text) -> Maybe FolderType -> Folder)
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
"FolderId")
            Parser
  (Maybe Text -> Maybe (NonEmpty Text) -> Maybe FolderType -> Folder)
-> Parser (Maybe Text)
-> Parser (Maybe (NonEmpty Text) -> Maybe FolderType -> Folder)
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
"Name")
            Parser (Maybe (NonEmpty Text) -> Maybe FolderType -> Folder)
-> Parser (Maybe (NonEmpty Text))
-> Parser (Maybe FolderType -> Folder)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FolderPath")
            Parser (Maybe FolderType -> Folder)
-> Parser (Maybe FolderType) -> Parser Folder
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FolderType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FolderType")
      )

instance Prelude.Hashable Folder

instance Prelude.NFData Folder