{-# 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.GroundStation.Types.DecodeConfig
-- 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.GroundStation.Types.DecodeConfig 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

-- | Information about the decode @Config@.
--
-- /See:/ 'newDecodeConfig' smart constructor.
data DecodeConfig = DecodeConfig'
  { -- | Unvalidated JSON of a decode @Config@.
    DecodeConfig -> Text
unvalidatedJSON :: Prelude.Text
  }
  deriving (DecodeConfig -> DecodeConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecodeConfig -> DecodeConfig -> Bool
$c/= :: DecodeConfig -> DecodeConfig -> Bool
== :: DecodeConfig -> DecodeConfig -> Bool
$c== :: DecodeConfig -> DecodeConfig -> Bool
Prelude.Eq, ReadPrec [DecodeConfig]
ReadPrec DecodeConfig
Int -> ReadS DecodeConfig
ReadS [DecodeConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecodeConfig]
$creadListPrec :: ReadPrec [DecodeConfig]
readPrec :: ReadPrec DecodeConfig
$creadPrec :: ReadPrec DecodeConfig
readList :: ReadS [DecodeConfig]
$creadList :: ReadS [DecodeConfig]
readsPrec :: Int -> ReadS DecodeConfig
$creadsPrec :: Int -> ReadS DecodeConfig
Prelude.Read, Int -> DecodeConfig -> ShowS
[DecodeConfig] -> ShowS
DecodeConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecodeConfig] -> ShowS
$cshowList :: [DecodeConfig] -> ShowS
show :: DecodeConfig -> String
$cshow :: DecodeConfig -> String
showsPrec :: Int -> DecodeConfig -> ShowS
$cshowsPrec :: Int -> DecodeConfig -> ShowS
Prelude.Show, forall x. Rep DecodeConfig x -> DecodeConfig
forall x. DecodeConfig -> Rep DecodeConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DecodeConfig x -> DecodeConfig
$cfrom :: forall x. DecodeConfig -> Rep DecodeConfig x
Prelude.Generic)

-- |
-- Create a value of 'DecodeConfig' 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:
--
-- 'unvalidatedJSON', 'decodeConfig_unvalidatedJSON' - Unvalidated JSON of a decode @Config@.
newDecodeConfig ::
  -- | 'unvalidatedJSON'
  Prelude.Text ->
  DecodeConfig
newDecodeConfig :: Text -> DecodeConfig
newDecodeConfig Text
pUnvalidatedJSON_ =
  DecodeConfig' {$sel:unvalidatedJSON:DecodeConfig' :: Text
unvalidatedJSON = Text
pUnvalidatedJSON_}

-- | Unvalidated JSON of a decode @Config@.
decodeConfig_unvalidatedJSON :: Lens.Lens' DecodeConfig Prelude.Text
decodeConfig_unvalidatedJSON :: Lens' DecodeConfig Text
decodeConfig_unvalidatedJSON = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecodeConfig' {Text
unvalidatedJSON :: Text
$sel:unvalidatedJSON:DecodeConfig' :: DecodeConfig -> Text
unvalidatedJSON} -> Text
unvalidatedJSON) (\s :: DecodeConfig
s@DecodeConfig' {} Text
a -> DecodeConfig
s {$sel:unvalidatedJSON:DecodeConfig' :: Text
unvalidatedJSON = Text
a} :: DecodeConfig)

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

instance Prelude.Hashable DecodeConfig where
  hashWithSalt :: Int -> DecodeConfig -> Int
hashWithSalt Int
_salt DecodeConfig' {Text
unvalidatedJSON :: Text
$sel:unvalidatedJSON:DecodeConfig' :: DecodeConfig -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
unvalidatedJSON

instance Prelude.NFData DecodeConfig where
  rnf :: DecodeConfig -> ()
rnf DecodeConfig' {Text
unvalidatedJSON :: Text
$sel:unvalidatedJSON:DecodeConfig' :: DecodeConfig -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
unvalidatedJSON

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