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

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

-- | The column group schema.
--
-- /See:/ 'newColumnGroupSchema' smart constructor.
data ColumnGroupSchema = ColumnGroupSchema'
  { -- | A structure containing the list of schemas for column group columns.
    ColumnGroupSchema -> Maybe [ColumnGroupColumnSchema]
columnGroupColumnSchemaList :: Prelude.Maybe [ColumnGroupColumnSchema],
    -- | The name of the column group schema.
    ColumnGroupSchema -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ColumnGroupSchema -> ColumnGroupSchema -> Bool
(ColumnGroupSchema -> ColumnGroupSchema -> Bool)
-> (ColumnGroupSchema -> ColumnGroupSchema -> Bool)
-> Eq ColumnGroupSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnGroupSchema -> ColumnGroupSchema -> Bool
$c/= :: ColumnGroupSchema -> ColumnGroupSchema -> Bool
== :: ColumnGroupSchema -> ColumnGroupSchema -> Bool
$c== :: ColumnGroupSchema -> ColumnGroupSchema -> Bool
Prelude.Eq, ReadPrec [ColumnGroupSchema]
ReadPrec ColumnGroupSchema
Int -> ReadS ColumnGroupSchema
ReadS [ColumnGroupSchema]
(Int -> ReadS ColumnGroupSchema)
-> ReadS [ColumnGroupSchema]
-> ReadPrec ColumnGroupSchema
-> ReadPrec [ColumnGroupSchema]
-> Read ColumnGroupSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColumnGroupSchema]
$creadListPrec :: ReadPrec [ColumnGroupSchema]
readPrec :: ReadPrec ColumnGroupSchema
$creadPrec :: ReadPrec ColumnGroupSchema
readList :: ReadS [ColumnGroupSchema]
$creadList :: ReadS [ColumnGroupSchema]
readsPrec :: Int -> ReadS ColumnGroupSchema
$creadsPrec :: Int -> ReadS ColumnGroupSchema
Prelude.Read, Int -> ColumnGroupSchema -> ShowS
[ColumnGroupSchema] -> ShowS
ColumnGroupSchema -> String
(Int -> ColumnGroupSchema -> ShowS)
-> (ColumnGroupSchema -> String)
-> ([ColumnGroupSchema] -> ShowS)
-> Show ColumnGroupSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnGroupSchema] -> ShowS
$cshowList :: [ColumnGroupSchema] -> ShowS
show :: ColumnGroupSchema -> String
$cshow :: ColumnGroupSchema -> String
showsPrec :: Int -> ColumnGroupSchema -> ShowS
$cshowsPrec :: Int -> ColumnGroupSchema -> ShowS
Prelude.Show, (forall x. ColumnGroupSchema -> Rep ColumnGroupSchema x)
-> (forall x. Rep ColumnGroupSchema x -> ColumnGroupSchema)
-> Generic ColumnGroupSchema
forall x. Rep ColumnGroupSchema x -> ColumnGroupSchema
forall x. ColumnGroupSchema -> Rep ColumnGroupSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnGroupSchema x -> ColumnGroupSchema
$cfrom :: forall x. ColumnGroupSchema -> Rep ColumnGroupSchema x
Prelude.Generic)

-- |
-- Create a value of 'ColumnGroupSchema' 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:
--
-- 'columnGroupColumnSchemaList', 'columnGroupSchema_columnGroupColumnSchemaList' - A structure containing the list of schemas for column group columns.
--
-- 'name', 'columnGroupSchema_name' - The name of the column group schema.
newColumnGroupSchema ::
  ColumnGroupSchema
newColumnGroupSchema :: ColumnGroupSchema
newColumnGroupSchema =
  ColumnGroupSchema' :: Maybe [ColumnGroupColumnSchema] -> Maybe Text -> ColumnGroupSchema
ColumnGroupSchema'
    { $sel:columnGroupColumnSchemaList:ColumnGroupSchema' :: Maybe [ColumnGroupColumnSchema]
columnGroupColumnSchemaList =
        Maybe [ColumnGroupColumnSchema]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ColumnGroupSchema' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A structure containing the list of schemas for column group columns.
columnGroupSchema_columnGroupColumnSchemaList :: Lens.Lens' ColumnGroupSchema (Prelude.Maybe [ColumnGroupColumnSchema])
columnGroupSchema_columnGroupColumnSchemaList :: (Maybe [ColumnGroupColumnSchema]
 -> f (Maybe [ColumnGroupColumnSchema]))
-> ColumnGroupSchema -> f ColumnGroupSchema
columnGroupSchema_columnGroupColumnSchemaList = (ColumnGroupSchema -> Maybe [ColumnGroupColumnSchema])
-> (ColumnGroupSchema
    -> Maybe [ColumnGroupColumnSchema] -> ColumnGroupSchema)
-> Lens
     ColumnGroupSchema
     ColumnGroupSchema
     (Maybe [ColumnGroupColumnSchema])
     (Maybe [ColumnGroupColumnSchema])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnGroupSchema' {Maybe [ColumnGroupColumnSchema]
columnGroupColumnSchemaList :: Maybe [ColumnGroupColumnSchema]
$sel:columnGroupColumnSchemaList:ColumnGroupSchema' :: ColumnGroupSchema -> Maybe [ColumnGroupColumnSchema]
columnGroupColumnSchemaList} -> Maybe [ColumnGroupColumnSchema]
columnGroupColumnSchemaList) (\s :: ColumnGroupSchema
s@ColumnGroupSchema' {} Maybe [ColumnGroupColumnSchema]
a -> ColumnGroupSchema
s {$sel:columnGroupColumnSchemaList:ColumnGroupSchema' :: Maybe [ColumnGroupColumnSchema]
columnGroupColumnSchemaList = Maybe [ColumnGroupColumnSchema]
a} :: ColumnGroupSchema) ((Maybe [ColumnGroupColumnSchema]
  -> f (Maybe [ColumnGroupColumnSchema]))
 -> ColumnGroupSchema -> f ColumnGroupSchema)
-> ((Maybe [ColumnGroupColumnSchema]
     -> f (Maybe [ColumnGroupColumnSchema]))
    -> Maybe [ColumnGroupColumnSchema]
    -> f (Maybe [ColumnGroupColumnSchema]))
-> (Maybe [ColumnGroupColumnSchema]
    -> f (Maybe [ColumnGroupColumnSchema]))
-> ColumnGroupSchema
-> f ColumnGroupSchema
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ColumnGroupColumnSchema]
  [ColumnGroupColumnSchema]
  [ColumnGroupColumnSchema]
  [ColumnGroupColumnSchema]
-> Iso
     (Maybe [ColumnGroupColumnSchema])
     (Maybe [ColumnGroupColumnSchema])
     (Maybe [ColumnGroupColumnSchema])
     (Maybe [ColumnGroupColumnSchema])
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
  [ColumnGroupColumnSchema]
  [ColumnGroupColumnSchema]
  [ColumnGroupColumnSchema]
  [ColumnGroupColumnSchema]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Core.FromJSON ColumnGroupSchema where
  parseJSON :: Value -> Parser ColumnGroupSchema
parseJSON =
    String
-> (Object -> Parser ColumnGroupSchema)
-> Value
-> Parser ColumnGroupSchema
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ColumnGroupSchema"
      ( \Object
x ->
          Maybe [ColumnGroupColumnSchema] -> Maybe Text -> ColumnGroupSchema
ColumnGroupSchema'
            (Maybe [ColumnGroupColumnSchema]
 -> Maybe Text -> ColumnGroupSchema)
-> Parser (Maybe [ColumnGroupColumnSchema])
-> Parser (Maybe Text -> ColumnGroupSchema)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ColumnGroupColumnSchema]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ColumnGroupColumnSchemaList"
                            Parser (Maybe (Maybe [ColumnGroupColumnSchema]))
-> Maybe [ColumnGroupColumnSchema]
-> Parser (Maybe [ColumnGroupColumnSchema])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ColumnGroupColumnSchema]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> ColumnGroupSchema)
-> Parser (Maybe Text) -> Parser ColumnGroupSchema
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")
      )

instance Prelude.Hashable ColumnGroupSchema

instance Prelude.NFData ColumnGroupSchema