{-# 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.Glue.Types.FillMissingValues
-- 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.Glue.Types.FillMissingValues 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

-- | Specifies a transform that locates records in the dataset that have
-- missing values and adds a new field with a value determined by
-- imputation. The input data set is used to train the machine learning
-- model that determines what the missing value should be.
--
-- /See:/ 'newFillMissingValues' smart constructor.
data FillMissingValues = FillMissingValues'
  { -- | A JSON path to a variable in the data structure for the dataset that is
    -- filled.
    FillMissingValues -> Maybe Text
filledPath :: Prelude.Maybe Prelude.Text,
    -- | The name of the transform node.
    FillMissingValues -> Text
name :: Prelude.Text,
    -- | The data inputs identified by their node names.
    FillMissingValues -> NonEmpty Text
inputs :: Prelude.NonEmpty Prelude.Text,
    -- | A JSON path to a variable in the data structure for the dataset that is
    -- imputed.
    FillMissingValues -> Text
imputedPath :: Prelude.Text
  }
  deriving (FillMissingValues -> FillMissingValues -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FillMissingValues -> FillMissingValues -> Bool
$c/= :: FillMissingValues -> FillMissingValues -> Bool
== :: FillMissingValues -> FillMissingValues -> Bool
$c== :: FillMissingValues -> FillMissingValues -> Bool
Prelude.Eq, ReadPrec [FillMissingValues]
ReadPrec FillMissingValues
Int -> ReadS FillMissingValues
ReadS [FillMissingValues]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FillMissingValues]
$creadListPrec :: ReadPrec [FillMissingValues]
readPrec :: ReadPrec FillMissingValues
$creadPrec :: ReadPrec FillMissingValues
readList :: ReadS [FillMissingValues]
$creadList :: ReadS [FillMissingValues]
readsPrec :: Int -> ReadS FillMissingValues
$creadsPrec :: Int -> ReadS FillMissingValues
Prelude.Read, Int -> FillMissingValues -> ShowS
[FillMissingValues] -> ShowS
FillMissingValues -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FillMissingValues] -> ShowS
$cshowList :: [FillMissingValues] -> ShowS
show :: FillMissingValues -> String
$cshow :: FillMissingValues -> String
showsPrec :: Int -> FillMissingValues -> ShowS
$cshowsPrec :: Int -> FillMissingValues -> ShowS
Prelude.Show, forall x. Rep FillMissingValues x -> FillMissingValues
forall x. FillMissingValues -> Rep FillMissingValues x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FillMissingValues x -> FillMissingValues
$cfrom :: forall x. FillMissingValues -> Rep FillMissingValues x
Prelude.Generic)

-- |
-- Create a value of 'FillMissingValues' 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:
--
-- 'filledPath', 'fillMissingValues_filledPath' - A JSON path to a variable in the data structure for the dataset that is
-- filled.
--
-- 'name', 'fillMissingValues_name' - The name of the transform node.
--
-- 'inputs', 'fillMissingValues_inputs' - The data inputs identified by their node names.
--
-- 'imputedPath', 'fillMissingValues_imputedPath' - A JSON path to a variable in the data structure for the dataset that is
-- imputed.
newFillMissingValues ::
  -- | 'name'
  Prelude.Text ->
  -- | 'inputs'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'imputedPath'
  Prelude.Text ->
  FillMissingValues
newFillMissingValues :: Text -> NonEmpty Text -> Text -> FillMissingValues
newFillMissingValues Text
pName_ NonEmpty Text
pInputs_ Text
pImputedPath_ =
  FillMissingValues'
    { $sel:filledPath:FillMissingValues' :: Maybe Text
filledPath = forall a. Maybe a
Prelude.Nothing,
      $sel:name:FillMissingValues' :: Text
name = Text
pName_,
      $sel:inputs:FillMissingValues' :: NonEmpty Text
inputs = 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 Text
pInputs_,
      $sel:imputedPath:FillMissingValues' :: Text
imputedPath = Text
pImputedPath_
    }

-- | A JSON path to a variable in the data structure for the dataset that is
-- filled.
fillMissingValues_filledPath :: Lens.Lens' FillMissingValues (Prelude.Maybe Prelude.Text)
fillMissingValues_filledPath :: Lens' FillMissingValues (Maybe Text)
fillMissingValues_filledPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FillMissingValues' {Maybe Text
filledPath :: Maybe Text
$sel:filledPath:FillMissingValues' :: FillMissingValues -> Maybe Text
filledPath} -> Maybe Text
filledPath) (\s :: FillMissingValues
s@FillMissingValues' {} Maybe Text
a -> FillMissingValues
s {$sel:filledPath:FillMissingValues' :: Maybe Text
filledPath = Maybe Text
a} :: FillMissingValues)

-- | The name of the transform node.
fillMissingValues_name :: Lens.Lens' FillMissingValues Prelude.Text
fillMissingValues_name :: Lens' FillMissingValues Text
fillMissingValues_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FillMissingValues' {Text
name :: Text
$sel:name:FillMissingValues' :: FillMissingValues -> Text
name} -> Text
name) (\s :: FillMissingValues
s@FillMissingValues' {} Text
a -> FillMissingValues
s {$sel:name:FillMissingValues' :: Text
name = Text
a} :: FillMissingValues)

-- | The data inputs identified by their node names.
fillMissingValues_inputs :: Lens.Lens' FillMissingValues (Prelude.NonEmpty Prelude.Text)
fillMissingValues_inputs :: Lens' FillMissingValues (NonEmpty Text)
fillMissingValues_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FillMissingValues' {NonEmpty Text
inputs :: NonEmpty Text
$sel:inputs:FillMissingValues' :: FillMissingValues -> NonEmpty Text
inputs} -> NonEmpty Text
inputs) (\s :: FillMissingValues
s@FillMissingValues' {} NonEmpty Text
a -> FillMissingValues
s {$sel:inputs:FillMissingValues' :: NonEmpty Text
inputs = NonEmpty Text
a} :: FillMissingValues) 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

-- | A JSON path to a variable in the data structure for the dataset that is
-- imputed.
fillMissingValues_imputedPath :: Lens.Lens' FillMissingValues Prelude.Text
fillMissingValues_imputedPath :: Lens' FillMissingValues Text
fillMissingValues_imputedPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FillMissingValues' {Text
imputedPath :: Text
$sel:imputedPath:FillMissingValues' :: FillMissingValues -> Text
imputedPath} -> Text
imputedPath) (\s :: FillMissingValues
s@FillMissingValues' {} Text
a -> FillMissingValues
s {$sel:imputedPath:FillMissingValues' :: Text
imputedPath = Text
a} :: FillMissingValues)

instance Data.FromJSON FillMissingValues where
  parseJSON :: Value -> Parser FillMissingValues
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FillMissingValues"
      ( \Object
x ->
          Maybe Text -> Text -> NonEmpty Text -> Text -> FillMissingValues
FillMissingValues'
            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
"FilledPath")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Inputs")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ImputedPath")
      )

instance Prelude.Hashable FillMissingValues where
  hashWithSalt :: Int -> FillMissingValues -> Int
hashWithSalt Int
_salt FillMissingValues' {Maybe Text
NonEmpty Text
Text
imputedPath :: Text
inputs :: NonEmpty Text
name :: Text
filledPath :: Maybe Text
$sel:imputedPath:FillMissingValues' :: FillMissingValues -> Text
$sel:inputs:FillMissingValues' :: FillMissingValues -> NonEmpty Text
$sel:name:FillMissingValues' :: FillMissingValues -> Text
$sel:filledPath:FillMissingValues' :: FillMissingValues -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
filledPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
inputs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imputedPath

instance Prelude.NFData FillMissingValues where
  rnf :: FillMissingValues -> ()
rnf FillMissingValues' {Maybe Text
NonEmpty Text
Text
imputedPath :: Text
inputs :: NonEmpty Text
name :: Text
filledPath :: Maybe Text
$sel:imputedPath:FillMissingValues' :: FillMissingValues -> Text
$sel:inputs:FillMissingValues' :: FillMissingValues -> NonEmpty Text
$sel:name:FillMissingValues' :: FillMissingValues -> Text
$sel:filledPath:FillMissingValues' :: FillMissingValues -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
filledPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
inputs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
imputedPath

instance Data.ToJSON FillMissingValues where
  toJSON :: FillMissingValues -> Value
toJSON FillMissingValues' {Maybe Text
NonEmpty Text
Text
imputedPath :: Text
inputs :: NonEmpty Text
name :: Text
filledPath :: Maybe Text
$sel:imputedPath:FillMissingValues' :: FillMissingValues -> Text
$sel:inputs:FillMissingValues' :: FillMissingValues -> NonEmpty Text
$sel:name:FillMissingValues' :: FillMissingValues -> Text
$sel:filledPath:FillMissingValues' :: FillMissingValues -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"FilledPath" 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 Text
filledPath,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Inputs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
inputs),
            forall a. a -> Maybe a
Prelude.Just (Key
"ImputedPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
imputedPath)
          ]
      )