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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(JsonOptions -> JsonOptions -> Bool)
-> (JsonOptions -> JsonOptions -> Bool) -> Eq JsonOptions
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]
(Int -> ReadS JsonOptions)
-> ReadS [JsonOptions]
-> ReadPrec JsonOptions
-> ReadPrec [JsonOptions]
-> Read 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
(Int -> JsonOptions -> ShowS)
-> (JsonOptions -> String)
-> ([JsonOptions] -> ShowS)
-> Show JsonOptions
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. JsonOptions -> Rep JsonOptions x)
-> (forall x. Rep JsonOptions x -> JsonOptions)
-> Generic JsonOptions
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' :: Maybe Bool -> JsonOptions
JsonOptions' {$sel:multiLine:JsonOptions' :: Maybe Bool
multiLine = Maybe Bool
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 :: (Maybe Bool -> f (Maybe Bool)) -> JsonOptions -> f JsonOptions
jsonOptions_multiLine = (JsonOptions -> Maybe Bool)
-> (JsonOptions -> Maybe Bool -> JsonOptions)
-> Lens JsonOptions JsonOptions (Maybe Bool) (Maybe Bool)
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 Core.FromJSON JsonOptions where
  parseJSON :: Value -> Parser JsonOptions
parseJSON =
    String
-> (Object -> Parser JsonOptions) -> Value -> Parser JsonOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JsonOptions"
      ( \Object
x ->
          Maybe Bool -> JsonOptions
JsonOptions' (Maybe Bool -> JsonOptions)
-> Parser (Maybe Bool) -> Parser JsonOptions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MultiLine")
      )

instance Prelude.Hashable JsonOptions

instance Prelude.NFData JsonOptions

instance Core.ToJSON JsonOptions where
  toJSON :: JsonOptions -> Value
toJSON JsonOptions' {Maybe Bool
multiLine :: Maybe Bool
$sel:multiLine:JsonOptions' :: JsonOptions -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"MultiLine" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
multiLine]
      )