{-# 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.DataBrew.Types.JsonOptions
-- 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.DataBrew.Types.JsonOptions 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

-- | Represents the JSON-specific options that define how input is to be
-- interpreted by Glue DataBrew.
--
-- /See:/ 'newJsonOptions' smart constructor.
data JsonOptions = JsonOptions'
  { -- | A value that specifies whether JSON input contains embedded new line
    -- characters.
    JsonOptions -> Maybe Bool
multiLine :: Prelude.Maybe Prelude.Bool
  }
  deriving (JsonOptions -> JsonOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JsonOptions -> JsonOptions -> Bool
$c/= :: JsonOptions -> JsonOptions -> Bool
== :: JsonOptions -> JsonOptions -> Bool
$c== :: JsonOptions -> JsonOptions -> Bool
Prelude.Eq, ReadPrec [JsonOptions]
ReadPrec JsonOptions
Int -> ReadS JsonOptions
ReadS [JsonOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JsonOptions]
$creadListPrec :: ReadPrec [JsonOptions]
readPrec :: ReadPrec JsonOptions
$creadPrec :: ReadPrec JsonOptions
readList :: ReadS [JsonOptions]
$creadList :: ReadS [JsonOptions]
readsPrec :: Int -> ReadS JsonOptions
$creadsPrec :: Int -> ReadS JsonOptions
Prelude.Read, Int -> JsonOptions -> ShowS
[JsonOptions] -> ShowS
JsonOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JsonOptions] -> ShowS
$cshowList :: [JsonOptions] -> ShowS
show :: JsonOptions -> String
$cshow :: JsonOptions -> String
showsPrec :: Int -> JsonOptions -> ShowS
$cshowsPrec :: Int -> JsonOptions -> ShowS
Prelude.Show, forall x. Rep JsonOptions x -> JsonOptions
forall x. JsonOptions -> Rep JsonOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JsonOptions x -> JsonOptions
$cfrom :: forall x. JsonOptions -> Rep JsonOptions x
Prelude.Generic)

-- |
-- Create a value of 'JsonOptions' 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:
--
-- 'multiLine', 'jsonOptions_multiLine' - A value that specifies whether JSON input contains embedded new line
-- characters.
newJsonOptions ::
  JsonOptions
newJsonOptions :: JsonOptions
newJsonOptions =
  JsonOptions' {$sel:multiLine:JsonOptions' :: Maybe Bool
multiLine = forall a. Maybe a
Prelude.Nothing}

-- | A value that specifies whether JSON input contains embedded new line
-- characters.
jsonOptions_multiLine :: Lens.Lens' JsonOptions (Prelude.Maybe Prelude.Bool)
jsonOptions_multiLine :: Lens' JsonOptions (Maybe Bool)
jsonOptions_multiLine = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JsonOptions' {Maybe Bool
multiLine :: Maybe Bool
$sel:multiLine:JsonOptions' :: JsonOptions -> Maybe Bool
multiLine} -> Maybe Bool
multiLine) (\s :: JsonOptions
s@JsonOptions' {} Maybe Bool
a -> JsonOptions
s {$sel:multiLine:JsonOptions' :: Maybe Bool
multiLine = Maybe Bool
a} :: JsonOptions)

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

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

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

instance Data.ToJSON JsonOptions where
  toJSON :: JsonOptions -> Value
toJSON JsonOptions' {Maybe Bool
multiLine :: Maybe Bool
$sel:multiLine:JsonOptions' :: JsonOptions -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"MultiLine" 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
multiLine]
      )