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

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

-- | The column schema.
--
-- /See:/ 'newColumnSchema' smart constructor.
data ColumnSchema = ColumnSchema'
  { -- | The geographic role of the column schema.
    ColumnSchema -> Maybe Text
geographicRole :: Prelude.Maybe Prelude.Text,
    -- | The name of the column schema.
    ColumnSchema -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The data type of the column schema.
    ColumnSchema -> Maybe Text
dataType :: Prelude.Maybe Prelude.Text
  }
  deriving (ColumnSchema -> ColumnSchema -> Bool
(ColumnSchema -> ColumnSchema -> Bool)
-> (ColumnSchema -> ColumnSchema -> Bool) -> Eq ColumnSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnSchema -> ColumnSchema -> Bool
$c/= :: ColumnSchema -> ColumnSchema -> Bool
== :: ColumnSchema -> ColumnSchema -> Bool
$c== :: ColumnSchema -> ColumnSchema -> Bool
Prelude.Eq, ReadPrec [ColumnSchema]
ReadPrec ColumnSchema
Int -> ReadS ColumnSchema
ReadS [ColumnSchema]
(Int -> ReadS ColumnSchema)
-> ReadS [ColumnSchema]
-> ReadPrec ColumnSchema
-> ReadPrec [ColumnSchema]
-> Read ColumnSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColumnSchema]
$creadListPrec :: ReadPrec [ColumnSchema]
readPrec :: ReadPrec ColumnSchema
$creadPrec :: ReadPrec ColumnSchema
readList :: ReadS [ColumnSchema]
$creadList :: ReadS [ColumnSchema]
readsPrec :: Int -> ReadS ColumnSchema
$creadsPrec :: Int -> ReadS ColumnSchema
Prelude.Read, Int -> ColumnSchema -> ShowS
[ColumnSchema] -> ShowS
ColumnSchema -> String
(Int -> ColumnSchema -> ShowS)
-> (ColumnSchema -> String)
-> ([ColumnSchema] -> ShowS)
-> Show ColumnSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnSchema] -> ShowS
$cshowList :: [ColumnSchema] -> ShowS
show :: ColumnSchema -> String
$cshow :: ColumnSchema -> String
showsPrec :: Int -> ColumnSchema -> ShowS
$cshowsPrec :: Int -> ColumnSchema -> ShowS
Prelude.Show, (forall x. ColumnSchema -> Rep ColumnSchema x)
-> (forall x. Rep ColumnSchema x -> ColumnSchema)
-> Generic ColumnSchema
forall x. Rep ColumnSchema x -> ColumnSchema
forall x. ColumnSchema -> Rep ColumnSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnSchema x -> ColumnSchema
$cfrom :: forall x. ColumnSchema -> Rep ColumnSchema x
Prelude.Generic)

-- |
-- Create a value of 'ColumnSchema' 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:
--
-- 'geographicRole', 'columnSchema_geographicRole' - The geographic role of the column schema.
--
-- 'name', 'columnSchema_name' - The name of the column schema.
--
-- 'dataType', 'columnSchema_dataType' - The data type of the column schema.
newColumnSchema ::
  ColumnSchema
newColumnSchema :: ColumnSchema
newColumnSchema =
  ColumnSchema' :: Maybe Text -> Maybe Text -> Maybe Text -> ColumnSchema
ColumnSchema'
    { $sel:geographicRole:ColumnSchema' :: Maybe Text
geographicRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ColumnSchema' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataType:ColumnSchema' :: Maybe Text
dataType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The geographic role of the column schema.
columnSchema_geographicRole :: Lens.Lens' ColumnSchema (Prelude.Maybe Prelude.Text)
columnSchema_geographicRole :: (Maybe Text -> f (Maybe Text)) -> ColumnSchema -> f ColumnSchema
columnSchema_geographicRole = (ColumnSchema -> Maybe Text)
-> (ColumnSchema -> Maybe Text -> ColumnSchema)
-> Lens ColumnSchema ColumnSchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnSchema' {Maybe Text
geographicRole :: Maybe Text
$sel:geographicRole:ColumnSchema' :: ColumnSchema -> Maybe Text
geographicRole} -> Maybe Text
geographicRole) (\s :: ColumnSchema
s@ColumnSchema' {} Maybe Text
a -> ColumnSchema
s {$sel:geographicRole:ColumnSchema' :: Maybe Text
geographicRole = Maybe Text
a} :: ColumnSchema)

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

-- | The data type of the column schema.
columnSchema_dataType :: Lens.Lens' ColumnSchema (Prelude.Maybe Prelude.Text)
columnSchema_dataType :: (Maybe Text -> f (Maybe Text)) -> ColumnSchema -> f ColumnSchema
columnSchema_dataType = (ColumnSchema -> Maybe Text)
-> (ColumnSchema -> Maybe Text -> ColumnSchema)
-> Lens ColumnSchema ColumnSchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnSchema' {Maybe Text
dataType :: Maybe Text
$sel:dataType:ColumnSchema' :: ColumnSchema -> Maybe Text
dataType} -> Maybe Text
dataType) (\s :: ColumnSchema
s@ColumnSchema' {} Maybe Text
a -> ColumnSchema
s {$sel:dataType:ColumnSchema' :: Maybe Text
dataType = Maybe Text
a} :: ColumnSchema)

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

instance Prelude.Hashable ColumnSchema

instance Prelude.NFData ColumnSchema