{-# 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.HealthLake.Types.PreloadDataConfig
-- 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.HealthLake.Types.PreloadDataConfig where

import qualified Amazonka.Core as Core
import Amazonka.HealthLake.Types.PreloadDataType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The input properties for the preloaded Data Store. Only data preloaded
-- from Synthea is supported.
--
-- /See:/ 'newPreloadDataConfig' smart constructor.
data PreloadDataConfig = PreloadDataConfig'
  { -- | The type of preloaded data. Only Synthea preloaded data is supported.
    PreloadDataConfig -> PreloadDataType
preloadDataType :: PreloadDataType
  }
  deriving (PreloadDataConfig -> PreloadDataConfig -> Bool
(PreloadDataConfig -> PreloadDataConfig -> Bool)
-> (PreloadDataConfig -> PreloadDataConfig -> Bool)
-> Eq PreloadDataConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PreloadDataConfig -> PreloadDataConfig -> Bool
$c/= :: PreloadDataConfig -> PreloadDataConfig -> Bool
== :: PreloadDataConfig -> PreloadDataConfig -> Bool
$c== :: PreloadDataConfig -> PreloadDataConfig -> Bool
Prelude.Eq, ReadPrec [PreloadDataConfig]
ReadPrec PreloadDataConfig
Int -> ReadS PreloadDataConfig
ReadS [PreloadDataConfig]
(Int -> ReadS PreloadDataConfig)
-> ReadS [PreloadDataConfig]
-> ReadPrec PreloadDataConfig
-> ReadPrec [PreloadDataConfig]
-> Read PreloadDataConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PreloadDataConfig]
$creadListPrec :: ReadPrec [PreloadDataConfig]
readPrec :: ReadPrec PreloadDataConfig
$creadPrec :: ReadPrec PreloadDataConfig
readList :: ReadS [PreloadDataConfig]
$creadList :: ReadS [PreloadDataConfig]
readsPrec :: Int -> ReadS PreloadDataConfig
$creadsPrec :: Int -> ReadS PreloadDataConfig
Prelude.Read, Int -> PreloadDataConfig -> ShowS
[PreloadDataConfig] -> ShowS
PreloadDataConfig -> String
(Int -> PreloadDataConfig -> ShowS)
-> (PreloadDataConfig -> String)
-> ([PreloadDataConfig] -> ShowS)
-> Show PreloadDataConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PreloadDataConfig] -> ShowS
$cshowList :: [PreloadDataConfig] -> ShowS
show :: PreloadDataConfig -> String
$cshow :: PreloadDataConfig -> String
showsPrec :: Int -> PreloadDataConfig -> ShowS
$cshowsPrec :: Int -> PreloadDataConfig -> ShowS
Prelude.Show, (forall x. PreloadDataConfig -> Rep PreloadDataConfig x)
-> (forall x. Rep PreloadDataConfig x -> PreloadDataConfig)
-> Generic PreloadDataConfig
forall x. Rep PreloadDataConfig x -> PreloadDataConfig
forall x. PreloadDataConfig -> Rep PreloadDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PreloadDataConfig x -> PreloadDataConfig
$cfrom :: forall x. PreloadDataConfig -> Rep PreloadDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'PreloadDataConfig' 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:
--
-- 'preloadDataType', 'preloadDataConfig_preloadDataType' - The type of preloaded data. Only Synthea preloaded data is supported.
newPreloadDataConfig ::
  -- | 'preloadDataType'
  PreloadDataType ->
  PreloadDataConfig
newPreloadDataConfig :: PreloadDataType -> PreloadDataConfig
newPreloadDataConfig PreloadDataType
pPreloadDataType_ =
  PreloadDataConfig' :: PreloadDataType -> PreloadDataConfig
PreloadDataConfig'
    { $sel:preloadDataType:PreloadDataConfig' :: PreloadDataType
preloadDataType =
        PreloadDataType
pPreloadDataType_
    }

-- | The type of preloaded data. Only Synthea preloaded data is supported.
preloadDataConfig_preloadDataType :: Lens.Lens' PreloadDataConfig PreloadDataType
preloadDataConfig_preloadDataType :: (PreloadDataType -> f PreloadDataType)
-> PreloadDataConfig -> f PreloadDataConfig
preloadDataConfig_preloadDataType = (PreloadDataConfig -> PreloadDataType)
-> (PreloadDataConfig -> PreloadDataType -> PreloadDataConfig)
-> Lens
     PreloadDataConfig PreloadDataConfig PreloadDataType PreloadDataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PreloadDataConfig' {PreloadDataType
preloadDataType :: PreloadDataType
$sel:preloadDataType:PreloadDataConfig' :: PreloadDataConfig -> PreloadDataType
preloadDataType} -> PreloadDataType
preloadDataType) (\s :: PreloadDataConfig
s@PreloadDataConfig' {} PreloadDataType
a -> PreloadDataConfig
s {$sel:preloadDataType:PreloadDataConfig' :: PreloadDataType
preloadDataType = PreloadDataType
a} :: PreloadDataConfig)

instance Core.FromJSON PreloadDataConfig where
  parseJSON :: Value -> Parser PreloadDataConfig
parseJSON =
    String
-> (Object -> Parser PreloadDataConfig)
-> Value
-> Parser PreloadDataConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PreloadDataConfig"
      ( \Object
x ->
          PreloadDataType -> PreloadDataConfig
PreloadDataConfig'
            (PreloadDataType -> PreloadDataConfig)
-> Parser PreloadDataType -> Parser PreloadDataConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser PreloadDataType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PreloadDataType")
      )

instance Prelude.Hashable PreloadDataConfig

instance Prelude.NFData PreloadDataConfig

instance Core.ToJSON PreloadDataConfig where
  toJSON :: PreloadDataConfig -> Value
toJSON PreloadDataConfig' {PreloadDataType
preloadDataType :: PreloadDataType
$sel:preloadDataType:PreloadDataConfig' :: PreloadDataConfig -> PreloadDataType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PreloadDataType" Text -> PreloadDataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PreloadDataType
preloadDataType)
          ]
      )