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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure containing the column name and column importance score for a
-- column.
--
-- Column importance helps you understand how columns contribute to your
-- model, by identifying which columns in your records are more important
-- than others.
--
-- /See:/ 'newColumnImportance' smart constructor.
data ColumnImportance = ColumnImportance'
  { -- | The column importance score for the column, as a decimal.
    ColumnImportance -> Maybe Double
importance :: Prelude.Maybe Prelude.Double,
    -- | The name of a column.
    ColumnImportance -> Maybe Text
columnName :: Prelude.Maybe Prelude.Text
  }
  deriving (ColumnImportance -> ColumnImportance -> Bool
(ColumnImportance -> ColumnImportance -> Bool)
-> (ColumnImportance -> ColumnImportance -> Bool)
-> Eq ColumnImportance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnImportance -> ColumnImportance -> Bool
$c/= :: ColumnImportance -> ColumnImportance -> Bool
== :: ColumnImportance -> ColumnImportance -> Bool
$c== :: ColumnImportance -> ColumnImportance -> Bool
Prelude.Eq, ReadPrec [ColumnImportance]
ReadPrec ColumnImportance
Int -> ReadS ColumnImportance
ReadS [ColumnImportance]
(Int -> ReadS ColumnImportance)
-> ReadS [ColumnImportance]
-> ReadPrec ColumnImportance
-> ReadPrec [ColumnImportance]
-> Read ColumnImportance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColumnImportance]
$creadListPrec :: ReadPrec [ColumnImportance]
readPrec :: ReadPrec ColumnImportance
$creadPrec :: ReadPrec ColumnImportance
readList :: ReadS [ColumnImportance]
$creadList :: ReadS [ColumnImportance]
readsPrec :: Int -> ReadS ColumnImportance
$creadsPrec :: Int -> ReadS ColumnImportance
Prelude.Read, Int -> ColumnImportance -> ShowS
[ColumnImportance] -> ShowS
ColumnImportance -> String
(Int -> ColumnImportance -> ShowS)
-> (ColumnImportance -> String)
-> ([ColumnImportance] -> ShowS)
-> Show ColumnImportance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnImportance] -> ShowS
$cshowList :: [ColumnImportance] -> ShowS
show :: ColumnImportance -> String
$cshow :: ColumnImportance -> String
showsPrec :: Int -> ColumnImportance -> ShowS
$cshowsPrec :: Int -> ColumnImportance -> ShowS
Prelude.Show, (forall x. ColumnImportance -> Rep ColumnImportance x)
-> (forall x. Rep ColumnImportance x -> ColumnImportance)
-> Generic ColumnImportance
forall x. Rep ColumnImportance x -> ColumnImportance
forall x. ColumnImportance -> Rep ColumnImportance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnImportance x -> ColumnImportance
$cfrom :: forall x. ColumnImportance -> Rep ColumnImportance x
Prelude.Generic)

-- |
-- Create a value of 'ColumnImportance' 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:
--
-- 'importance', 'columnImportance_importance' - The column importance score for the column, as a decimal.
--
-- 'columnName', 'columnImportance_columnName' - The name of a column.
newColumnImportance ::
  ColumnImportance
newColumnImportance :: ColumnImportance
newColumnImportance =
  ColumnImportance' :: Maybe Double -> Maybe Text -> ColumnImportance
ColumnImportance'
    { $sel:importance:ColumnImportance' :: Maybe Double
importance = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:columnName:ColumnImportance' :: Maybe Text
columnName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The column importance score for the column, as a decimal.
columnImportance_importance :: Lens.Lens' ColumnImportance (Prelude.Maybe Prelude.Double)
columnImportance_importance :: (Maybe Double -> f (Maybe Double))
-> ColumnImportance -> f ColumnImportance
columnImportance_importance = (ColumnImportance -> Maybe Double)
-> (ColumnImportance -> Maybe Double -> ColumnImportance)
-> Lens
     ColumnImportance ColumnImportance (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnImportance' {Maybe Double
importance :: Maybe Double
$sel:importance:ColumnImportance' :: ColumnImportance -> Maybe Double
importance} -> Maybe Double
importance) (\s :: ColumnImportance
s@ColumnImportance' {} Maybe Double
a -> ColumnImportance
s {$sel:importance:ColumnImportance' :: Maybe Double
importance = Maybe Double
a} :: ColumnImportance)

-- | The name of a column.
columnImportance_columnName :: Lens.Lens' ColumnImportance (Prelude.Maybe Prelude.Text)
columnImportance_columnName :: (Maybe Text -> f (Maybe Text))
-> ColumnImportance -> f ColumnImportance
columnImportance_columnName = (ColumnImportance -> Maybe Text)
-> (ColumnImportance -> Maybe Text -> ColumnImportance)
-> Lens ColumnImportance ColumnImportance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnImportance' {Maybe Text
columnName :: Maybe Text
$sel:columnName:ColumnImportance' :: ColumnImportance -> Maybe Text
columnName} -> Maybe Text
columnName) (\s :: ColumnImportance
s@ColumnImportance' {} Maybe Text
a -> ColumnImportance
s {$sel:columnName:ColumnImportance' :: Maybe Text
columnName = Maybe Text
a} :: ColumnImportance)

instance Core.FromJSON ColumnImportance where
  parseJSON :: Value -> Parser ColumnImportance
parseJSON =
    String
-> (Object -> Parser ColumnImportance)
-> Value
-> Parser ColumnImportance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ColumnImportance"
      ( \Object
x ->
          Maybe Double -> Maybe Text -> ColumnImportance
ColumnImportance'
            (Maybe Double -> Maybe Text -> ColumnImportance)
-> Parser (Maybe Double) -> Parser (Maybe Text -> ColumnImportance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Importance")
            Parser (Maybe Text -> ColumnImportance)
-> Parser (Maybe Text) -> Parser ColumnImportance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ColumnName")
      )

instance Prelude.Hashable ColumnImportance

instance Prelude.NFData ColumnImportance