{-# 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.JoinKeyProperties
-- 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.JoinKeyProperties 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

-- | Properties associated with the columns participating in a join.
--
-- /See:/ 'newJoinKeyProperties' smart constructor.
data JoinKeyProperties = JoinKeyProperties'
  { -- | A value that indicates that a row in a table is uniquely identified by
    -- the columns in a join key. This is used by Amazon QuickSight to optimize
    -- query performance.
    JoinKeyProperties -> Maybe Bool
uniqueKey :: Prelude.Maybe Prelude.Bool
  }
  deriving (JoinKeyProperties -> JoinKeyProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JoinKeyProperties -> JoinKeyProperties -> Bool
$c/= :: JoinKeyProperties -> JoinKeyProperties -> Bool
== :: JoinKeyProperties -> JoinKeyProperties -> Bool
$c== :: JoinKeyProperties -> JoinKeyProperties -> Bool
Prelude.Eq, ReadPrec [JoinKeyProperties]
ReadPrec JoinKeyProperties
Int -> ReadS JoinKeyProperties
ReadS [JoinKeyProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JoinKeyProperties]
$creadListPrec :: ReadPrec [JoinKeyProperties]
readPrec :: ReadPrec JoinKeyProperties
$creadPrec :: ReadPrec JoinKeyProperties
readList :: ReadS [JoinKeyProperties]
$creadList :: ReadS [JoinKeyProperties]
readsPrec :: Int -> ReadS JoinKeyProperties
$creadsPrec :: Int -> ReadS JoinKeyProperties
Prelude.Read, Int -> JoinKeyProperties -> ShowS
[JoinKeyProperties] -> ShowS
JoinKeyProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JoinKeyProperties] -> ShowS
$cshowList :: [JoinKeyProperties] -> ShowS
show :: JoinKeyProperties -> String
$cshow :: JoinKeyProperties -> String
showsPrec :: Int -> JoinKeyProperties -> ShowS
$cshowsPrec :: Int -> JoinKeyProperties -> ShowS
Prelude.Show, forall x. Rep JoinKeyProperties x -> JoinKeyProperties
forall x. JoinKeyProperties -> Rep JoinKeyProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JoinKeyProperties x -> JoinKeyProperties
$cfrom :: forall x. JoinKeyProperties -> Rep JoinKeyProperties x
Prelude.Generic)

-- |
-- Create a value of 'JoinKeyProperties' 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:
--
-- 'uniqueKey', 'joinKeyProperties_uniqueKey' - A value that indicates that a row in a table is uniquely identified by
-- the columns in a join key. This is used by Amazon QuickSight to optimize
-- query performance.
newJoinKeyProperties ::
  JoinKeyProperties
newJoinKeyProperties :: JoinKeyProperties
newJoinKeyProperties =
  JoinKeyProperties' {$sel:uniqueKey:JoinKeyProperties' :: Maybe Bool
uniqueKey = forall a. Maybe a
Prelude.Nothing}

-- | A value that indicates that a row in a table is uniquely identified by
-- the columns in a join key. This is used by Amazon QuickSight to optimize
-- query performance.
joinKeyProperties_uniqueKey :: Lens.Lens' JoinKeyProperties (Prelude.Maybe Prelude.Bool)
joinKeyProperties_uniqueKey :: Lens' JoinKeyProperties (Maybe Bool)
joinKeyProperties_uniqueKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JoinKeyProperties' {Maybe Bool
uniqueKey :: Maybe Bool
$sel:uniqueKey:JoinKeyProperties' :: JoinKeyProperties -> Maybe Bool
uniqueKey} -> Maybe Bool
uniqueKey) (\s :: JoinKeyProperties
s@JoinKeyProperties' {} Maybe Bool
a -> JoinKeyProperties
s {$sel:uniqueKey:JoinKeyProperties' :: Maybe Bool
uniqueKey = Maybe Bool
a} :: JoinKeyProperties)

instance Data.FromJSON JoinKeyProperties where
  parseJSON :: Value -> Parser JoinKeyProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JoinKeyProperties"
      ( \Object
x ->
          Maybe Bool -> JoinKeyProperties
JoinKeyProperties'
            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
"UniqueKey")
      )

instance Prelude.Hashable JoinKeyProperties where
  hashWithSalt :: Int -> JoinKeyProperties -> Int
hashWithSalt Int
_salt JoinKeyProperties' {Maybe Bool
uniqueKey :: Maybe Bool
$sel:uniqueKey:JoinKeyProperties' :: JoinKeyProperties -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
uniqueKey

instance Prelude.NFData JoinKeyProperties where
  rnf :: JoinKeyProperties -> ()
rnf JoinKeyProperties' {Maybe Bool
uniqueKey :: Maybe Bool
$sel:uniqueKey:JoinKeyProperties' :: JoinKeyProperties -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
uniqueKey

instance Data.ToJSON JoinKeyProperties where
  toJSON :: JoinKeyProperties -> Value
toJSON JoinKeyProperties' {Maybe Bool
uniqueKey :: Maybe Bool
$sel:uniqueKey:JoinKeyProperties' :: JoinKeyProperties -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"UniqueKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
uniqueKey]
      )