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

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

-- | Output column.
--
-- /See:/ 'newOutputColumn' smart constructor.
data OutputColumn = OutputColumn'
  { -- | A display name for the dataset.
    OutputColumn -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Type.
    OutputColumn -> Maybe ColumnDataType
type' :: Prelude.Maybe ColumnDataType,
    -- | A description for a column.
    OutputColumn -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputColumn -> OutputColumn -> Bool
(OutputColumn -> OutputColumn -> Bool)
-> (OutputColumn -> OutputColumn -> Bool) -> Eq OutputColumn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputColumn -> OutputColumn -> Bool
$c/= :: OutputColumn -> OutputColumn -> Bool
== :: OutputColumn -> OutputColumn -> Bool
$c== :: OutputColumn -> OutputColumn -> Bool
Prelude.Eq, ReadPrec [OutputColumn]
ReadPrec OutputColumn
Int -> ReadS OutputColumn
ReadS [OutputColumn]
(Int -> ReadS OutputColumn)
-> ReadS [OutputColumn]
-> ReadPrec OutputColumn
-> ReadPrec [OutputColumn]
-> Read OutputColumn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputColumn]
$creadListPrec :: ReadPrec [OutputColumn]
readPrec :: ReadPrec OutputColumn
$creadPrec :: ReadPrec OutputColumn
readList :: ReadS [OutputColumn]
$creadList :: ReadS [OutputColumn]
readsPrec :: Int -> ReadS OutputColumn
$creadsPrec :: Int -> ReadS OutputColumn
Prelude.Read, Int -> OutputColumn -> ShowS
[OutputColumn] -> ShowS
OutputColumn -> String
(Int -> OutputColumn -> ShowS)
-> (OutputColumn -> String)
-> ([OutputColumn] -> ShowS)
-> Show OutputColumn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputColumn] -> ShowS
$cshowList :: [OutputColumn] -> ShowS
show :: OutputColumn -> String
$cshow :: OutputColumn -> String
showsPrec :: Int -> OutputColumn -> ShowS
$cshowsPrec :: Int -> OutputColumn -> ShowS
Prelude.Show, (forall x. OutputColumn -> Rep OutputColumn x)
-> (forall x. Rep OutputColumn x -> OutputColumn)
-> Generic OutputColumn
forall x. Rep OutputColumn x -> OutputColumn
forall x. OutputColumn -> Rep OutputColumn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputColumn x -> OutputColumn
$cfrom :: forall x. OutputColumn -> Rep OutputColumn x
Prelude.Generic)

-- |
-- Create a value of 'OutputColumn' 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:
--
-- 'name', 'outputColumn_name' - A display name for the dataset.
--
-- 'type'', 'outputColumn_type' - Type.
--
-- 'description', 'outputColumn_description' - A description for a column.
newOutputColumn ::
  OutputColumn
newOutputColumn :: OutputColumn
newOutputColumn =
  OutputColumn' :: Maybe Text -> Maybe ColumnDataType -> Maybe Text -> OutputColumn
OutputColumn'
    { $sel:name:OutputColumn' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':OutputColumn' :: Maybe ColumnDataType
type' = Maybe ColumnDataType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:OutputColumn' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Type.
outputColumn_type :: Lens.Lens' OutputColumn (Prelude.Maybe ColumnDataType)
outputColumn_type :: (Maybe ColumnDataType -> f (Maybe ColumnDataType))
-> OutputColumn -> f OutputColumn
outputColumn_type = (OutputColumn -> Maybe ColumnDataType)
-> (OutputColumn -> Maybe ColumnDataType -> OutputColumn)
-> Lens
     OutputColumn
     OutputColumn
     (Maybe ColumnDataType)
     (Maybe ColumnDataType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputColumn' {Maybe ColumnDataType
type' :: Maybe ColumnDataType
$sel:type':OutputColumn' :: OutputColumn -> Maybe ColumnDataType
type'} -> Maybe ColumnDataType
type') (\s :: OutputColumn
s@OutputColumn' {} Maybe ColumnDataType
a -> OutputColumn
s {$sel:type':OutputColumn' :: Maybe ColumnDataType
type' = Maybe ColumnDataType
a} :: OutputColumn)

-- | A description for a column.
outputColumn_description :: Lens.Lens' OutputColumn (Prelude.Maybe Prelude.Text)
outputColumn_description :: (Maybe Text -> f (Maybe Text)) -> OutputColumn -> f OutputColumn
outputColumn_description = (OutputColumn -> Maybe Text)
-> (OutputColumn -> Maybe Text -> OutputColumn)
-> Lens OutputColumn OutputColumn (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputColumn' {Maybe Text
description :: Maybe Text
$sel:description:OutputColumn' :: OutputColumn -> Maybe Text
description} -> Maybe Text
description) (\s :: OutputColumn
s@OutputColumn' {} Maybe Text
a -> OutputColumn
s {$sel:description:OutputColumn' :: Maybe Text
description = Maybe Text
a} :: OutputColumn)

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

instance Prelude.Hashable OutputColumn

instance Prelude.NFData OutputColumn