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

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

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

-- |
-- Create a value of 'DataSetSchema' 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:
--
-- 'columnSchemaList', 'dataSetSchema_columnSchemaList' - A structure containing the list of column schemas.
newDataSetSchema ::
  DataSetSchema
newDataSetSchema :: DataSetSchema
newDataSetSchema =
  DataSetSchema' :: Maybe [ColumnSchema] -> DataSetSchema
DataSetSchema' {$sel:columnSchemaList:DataSetSchema' :: Maybe [ColumnSchema]
columnSchemaList = Maybe [ColumnSchema]
forall a. Maybe a
Prelude.Nothing}

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

instance Core.FromJSON DataSetSchema where
  parseJSON :: Value -> Parser DataSetSchema
parseJSON =
    String
-> (Object -> Parser DataSetSchema)
-> Value
-> Parser DataSetSchema
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataSetSchema"
      ( \Object
x ->
          Maybe [ColumnSchema] -> DataSetSchema
DataSetSchema'
            (Maybe [ColumnSchema] -> DataSetSchema)
-> Parser (Maybe [ColumnSchema]) -> Parser DataSetSchema
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ColumnSchema]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ColumnSchemaList"
                            Parser (Maybe (Maybe [ColumnSchema]))
-> Maybe [ColumnSchema] -> Parser (Maybe [ColumnSchema])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ColumnSchema]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable DataSetSchema

instance Prelude.NFData DataSetSchema