{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.OutputColumn where

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

-- | Output column.
--
-- /See:/ 'newOutputColumn' smart constructor.
data OutputColumn = OutputColumn'
  { -- | A description for a column.
    OutputColumn -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A display name for the dataset.
    OutputColumn -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Type.
    OutputColumn -> Maybe ColumnDataType
type' :: Prelude.Maybe ColumnDataType
  }
  deriving (OutputColumn -> OutputColumn -> Bool
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]
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
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. 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:
--
-- 'description', 'outputColumn_description' - A description for a column.
--
-- 'name', 'outputColumn_name' - A display name for the dataset.
--
-- 'type'', 'outputColumn_type' - Type.
newOutputColumn ::
  OutputColumn
newOutputColumn :: OutputColumn
newOutputColumn =
  OutputColumn'
    { $sel:description:OutputColumn' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:OutputColumn' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:type':OutputColumn' :: Maybe ColumnDataType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | A description for a column.
outputColumn_description :: Lens.Lens' OutputColumn (Prelude.Maybe Prelude.Text)
outputColumn_description :: Lens' OutputColumn (Maybe Text)
outputColumn_description = 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)

-- | A display name for the dataset.
outputColumn_name :: Lens.Lens' OutputColumn (Prelude.Maybe Prelude.Text)
outputColumn_name :: Lens' OutputColumn (Maybe Text)
outputColumn_name = 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 :: Lens' OutputColumn (Maybe ColumnDataType)
outputColumn_type = 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)

instance Data.FromJSON OutputColumn where
  parseJSON :: Value -> Parser OutputColumn
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputColumn"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe ColumnDataType -> OutputColumn
OutputColumn'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
      )

instance Prelude.Hashable OutputColumn where
  hashWithSalt :: Int -> OutputColumn -> Int
hashWithSalt Int
_salt OutputColumn' {Maybe Text
Maybe ColumnDataType
type' :: Maybe ColumnDataType
name :: Maybe Text
description :: Maybe Text
$sel:type':OutputColumn' :: OutputColumn -> Maybe ColumnDataType
$sel:name:OutputColumn' :: OutputColumn -> Maybe Text
$sel:description:OutputColumn' :: OutputColumn -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ColumnDataType
type'

instance Prelude.NFData OutputColumn where
  rnf :: OutputColumn -> ()
rnf OutputColumn' {Maybe Text
Maybe ColumnDataType
type' :: Maybe ColumnDataType
name :: Maybe Text
description :: Maybe Text
$sel:type':OutputColumn' :: OutputColumn -> Maybe ColumnDataType
$sel:name:OutputColumn' :: OutputColumn -> Maybe Text
$sel:description:OutputColumn' :: OutputColumn -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ColumnDataType
type'