{-# 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.TemplateSourceAnalysis
-- 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.TemplateSourceAnalysis 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.DataSetReference

-- | The source analysis of the template.
--
-- /See:/ 'newTemplateSourceAnalysis' smart constructor.
data TemplateSourceAnalysis = TemplateSourceAnalysis'
  { -- | The Amazon Resource Name (ARN) of the resource.
    TemplateSourceAnalysis -> Text
arn :: Prelude.Text,
    -- | A structure containing information about the dataset references used as
    -- placeholders in the template.
    TemplateSourceAnalysis -> NonEmpty DataSetReference
dataSetReferences :: Prelude.NonEmpty DataSetReference
  }
  deriving (TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
$c/= :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
== :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
$c== :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
Prelude.Eq, ReadPrec [TemplateSourceAnalysis]
ReadPrec TemplateSourceAnalysis
Int -> ReadS TemplateSourceAnalysis
ReadS [TemplateSourceAnalysis]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateSourceAnalysis]
$creadListPrec :: ReadPrec [TemplateSourceAnalysis]
readPrec :: ReadPrec TemplateSourceAnalysis
$creadPrec :: ReadPrec TemplateSourceAnalysis
readList :: ReadS [TemplateSourceAnalysis]
$creadList :: ReadS [TemplateSourceAnalysis]
readsPrec :: Int -> ReadS TemplateSourceAnalysis
$creadsPrec :: Int -> ReadS TemplateSourceAnalysis
Prelude.Read, Int -> TemplateSourceAnalysis -> ShowS
[TemplateSourceAnalysis] -> ShowS
TemplateSourceAnalysis -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateSourceAnalysis] -> ShowS
$cshowList :: [TemplateSourceAnalysis] -> ShowS
show :: TemplateSourceAnalysis -> String
$cshow :: TemplateSourceAnalysis -> String
showsPrec :: Int -> TemplateSourceAnalysis -> ShowS
$cshowsPrec :: Int -> TemplateSourceAnalysis -> ShowS
Prelude.Show, forall x. Rep TemplateSourceAnalysis x -> TemplateSourceAnalysis
forall x. TemplateSourceAnalysis -> Rep TemplateSourceAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateSourceAnalysis x -> TemplateSourceAnalysis
$cfrom :: forall x. TemplateSourceAnalysis -> Rep TemplateSourceAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'TemplateSourceAnalysis' 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:
--
-- 'arn', 'templateSourceAnalysis_arn' - The Amazon Resource Name (ARN) of the resource.
--
-- 'dataSetReferences', 'templateSourceAnalysis_dataSetReferences' - A structure containing information about the dataset references used as
-- placeholders in the template.
newTemplateSourceAnalysis ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'dataSetReferences'
  Prelude.NonEmpty DataSetReference ->
  TemplateSourceAnalysis
newTemplateSourceAnalysis :: Text -> NonEmpty DataSetReference -> TemplateSourceAnalysis
newTemplateSourceAnalysis Text
pArn_ NonEmpty DataSetReference
pDataSetReferences_ =
  TemplateSourceAnalysis'
    { $sel:arn:TemplateSourceAnalysis' :: Text
arn = Text
pArn_,
      $sel:dataSetReferences:TemplateSourceAnalysis' :: NonEmpty DataSetReference
dataSetReferences =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty DataSetReference
pDataSetReferences_
    }

-- | The Amazon Resource Name (ARN) of the resource.
templateSourceAnalysis_arn :: Lens.Lens' TemplateSourceAnalysis Prelude.Text
templateSourceAnalysis_arn :: Lens' TemplateSourceAnalysis Text
templateSourceAnalysis_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSourceAnalysis' {Text
arn :: Text
$sel:arn:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> Text
arn} -> Text
arn) (\s :: TemplateSourceAnalysis
s@TemplateSourceAnalysis' {} Text
a -> TemplateSourceAnalysis
s {$sel:arn:TemplateSourceAnalysis' :: Text
arn = Text
a} :: TemplateSourceAnalysis)

-- | A structure containing information about the dataset references used as
-- placeholders in the template.
templateSourceAnalysis_dataSetReferences :: Lens.Lens' TemplateSourceAnalysis (Prelude.NonEmpty DataSetReference)
templateSourceAnalysis_dataSetReferences :: Lens' TemplateSourceAnalysis (NonEmpty DataSetReference)
templateSourceAnalysis_dataSetReferences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSourceAnalysis' {NonEmpty DataSetReference
dataSetReferences :: NonEmpty DataSetReference
$sel:dataSetReferences:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> NonEmpty DataSetReference
dataSetReferences} -> NonEmpty DataSetReference
dataSetReferences) (\s :: TemplateSourceAnalysis
s@TemplateSourceAnalysis' {} NonEmpty DataSetReference
a -> TemplateSourceAnalysis
s {$sel:dataSetReferences:TemplateSourceAnalysis' :: NonEmpty DataSetReference
dataSetReferences = NonEmpty DataSetReference
a} :: TemplateSourceAnalysis) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable TemplateSourceAnalysis where
  hashWithSalt :: Int -> TemplateSourceAnalysis -> Int
hashWithSalt Int
_salt TemplateSourceAnalysis' {NonEmpty DataSetReference
Text
dataSetReferences :: NonEmpty DataSetReference
arn :: Text
$sel:dataSetReferences:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> NonEmpty DataSetReference
$sel:arn:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty DataSetReference
dataSetReferences

instance Prelude.NFData TemplateSourceAnalysis where
  rnf :: TemplateSourceAnalysis -> ()
rnf TemplateSourceAnalysis' {NonEmpty DataSetReference
Text
dataSetReferences :: NonEmpty DataSetReference
arn :: Text
$sel:dataSetReferences:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> NonEmpty DataSetReference
$sel:arn:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty DataSetReference
dataSetReferences

instance Data.ToJSON TemplateSourceAnalysis where
  toJSON :: TemplateSourceAnalysis -> Value
toJSON TemplateSourceAnalysis' {NonEmpty DataSetReference
Text
dataSetReferences :: NonEmpty DataSetReference
arn :: Text
$sel:dataSetReferences:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> NonEmpty DataSetReference
$sel:arn:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DataSetReferences" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty DataSetReference
dataSetReferences)
          ]
      )