{-# 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.TransformSortCriteria
-- 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.TransformSortCriteria where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.SortDirectionType
import Amazonka.Glue.Types.TransformSortColumnType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The sorting criteria that are associated with the machine learning
-- transform.
--
-- /See:/ 'newTransformSortCriteria' smart constructor.
data TransformSortCriteria = TransformSortCriteria'
  { -- | The column to be used in the sorting criteria that are associated with
    -- the machine learning transform.
    TransformSortCriteria -> TransformSortColumnType
column :: TransformSortColumnType,
    -- | The sort direction to be used in the sorting criteria that are
    -- associated with the machine learning transform.
    TransformSortCriteria -> SortDirectionType
sortDirection :: SortDirectionType
  }
  deriving (TransformSortCriteria -> TransformSortCriteria -> Bool
(TransformSortCriteria -> TransformSortCriteria -> Bool)
-> (TransformSortCriteria -> TransformSortCriteria -> Bool)
-> Eq TransformSortCriteria
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransformSortCriteria -> TransformSortCriteria -> Bool
$c/= :: TransformSortCriteria -> TransformSortCriteria -> Bool
== :: TransformSortCriteria -> TransformSortCriteria -> Bool
$c== :: TransformSortCriteria -> TransformSortCriteria -> Bool
Prelude.Eq, ReadPrec [TransformSortCriteria]
ReadPrec TransformSortCriteria
Int -> ReadS TransformSortCriteria
ReadS [TransformSortCriteria]
(Int -> ReadS TransformSortCriteria)
-> ReadS [TransformSortCriteria]
-> ReadPrec TransformSortCriteria
-> ReadPrec [TransformSortCriteria]
-> Read TransformSortCriteria
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransformSortCriteria]
$creadListPrec :: ReadPrec [TransformSortCriteria]
readPrec :: ReadPrec TransformSortCriteria
$creadPrec :: ReadPrec TransformSortCriteria
readList :: ReadS [TransformSortCriteria]
$creadList :: ReadS [TransformSortCriteria]
readsPrec :: Int -> ReadS TransformSortCriteria
$creadsPrec :: Int -> ReadS TransformSortCriteria
Prelude.Read, Int -> TransformSortCriteria -> ShowS
[TransformSortCriteria] -> ShowS
TransformSortCriteria -> String
(Int -> TransformSortCriteria -> ShowS)
-> (TransformSortCriteria -> String)
-> ([TransformSortCriteria] -> ShowS)
-> Show TransformSortCriteria
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransformSortCriteria] -> ShowS
$cshowList :: [TransformSortCriteria] -> ShowS
show :: TransformSortCriteria -> String
$cshow :: TransformSortCriteria -> String
showsPrec :: Int -> TransformSortCriteria -> ShowS
$cshowsPrec :: Int -> TransformSortCriteria -> ShowS
Prelude.Show, (forall x. TransformSortCriteria -> Rep TransformSortCriteria x)
-> (forall x. Rep TransformSortCriteria x -> TransformSortCriteria)
-> Generic TransformSortCriteria
forall x. Rep TransformSortCriteria x -> TransformSortCriteria
forall x. TransformSortCriteria -> Rep TransformSortCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransformSortCriteria x -> TransformSortCriteria
$cfrom :: forall x. TransformSortCriteria -> Rep TransformSortCriteria x
Prelude.Generic)

-- |
-- Create a value of 'TransformSortCriteria' 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:
--
-- 'column', 'transformSortCriteria_column' - The column to be used in the sorting criteria that are associated with
-- the machine learning transform.
--
-- 'sortDirection', 'transformSortCriteria_sortDirection' - The sort direction to be used in the sorting criteria that are
-- associated with the machine learning transform.
newTransformSortCriteria ::
  -- | 'column'
  TransformSortColumnType ->
  -- | 'sortDirection'
  SortDirectionType ->
  TransformSortCriteria
newTransformSortCriteria :: TransformSortColumnType
-> SortDirectionType -> TransformSortCriteria
newTransformSortCriteria TransformSortColumnType
pColumn_ SortDirectionType
pSortDirection_ =
  TransformSortCriteria' :: TransformSortColumnType
-> SortDirectionType -> TransformSortCriteria
TransformSortCriteria'
    { $sel:column:TransformSortCriteria' :: TransformSortColumnType
column = TransformSortColumnType
pColumn_,
      $sel:sortDirection:TransformSortCriteria' :: SortDirectionType
sortDirection = SortDirectionType
pSortDirection_
    }

-- | The column to be used in the sorting criteria that are associated with
-- the machine learning transform.
transformSortCriteria_column :: Lens.Lens' TransformSortCriteria TransformSortColumnType
transformSortCriteria_column :: (TransformSortColumnType -> f TransformSortColumnType)
-> TransformSortCriteria -> f TransformSortCriteria
transformSortCriteria_column = (TransformSortCriteria -> TransformSortColumnType)
-> (TransformSortCriteria
    -> TransformSortColumnType -> TransformSortCriteria)
-> Lens
     TransformSortCriteria
     TransformSortCriteria
     TransformSortColumnType
     TransformSortColumnType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformSortCriteria' {TransformSortColumnType
column :: TransformSortColumnType
$sel:column:TransformSortCriteria' :: TransformSortCriteria -> TransformSortColumnType
column} -> TransformSortColumnType
column) (\s :: TransformSortCriteria
s@TransformSortCriteria' {} TransformSortColumnType
a -> TransformSortCriteria
s {$sel:column:TransformSortCriteria' :: TransformSortColumnType
column = TransformSortColumnType
a} :: TransformSortCriteria)

-- | The sort direction to be used in the sorting criteria that are
-- associated with the machine learning transform.
transformSortCriteria_sortDirection :: Lens.Lens' TransformSortCriteria SortDirectionType
transformSortCriteria_sortDirection :: (SortDirectionType -> f SortDirectionType)
-> TransformSortCriteria -> f TransformSortCriteria
transformSortCriteria_sortDirection = (TransformSortCriteria -> SortDirectionType)
-> (TransformSortCriteria
    -> SortDirectionType -> TransformSortCriteria)
-> Lens
     TransformSortCriteria
     TransformSortCriteria
     SortDirectionType
     SortDirectionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformSortCriteria' {SortDirectionType
sortDirection :: SortDirectionType
$sel:sortDirection:TransformSortCriteria' :: TransformSortCriteria -> SortDirectionType
sortDirection} -> SortDirectionType
sortDirection) (\s :: TransformSortCriteria
s@TransformSortCriteria' {} SortDirectionType
a -> TransformSortCriteria
s {$sel:sortDirection:TransformSortCriteria' :: SortDirectionType
sortDirection = SortDirectionType
a} :: TransformSortCriteria)

instance Prelude.Hashable TransformSortCriteria

instance Prelude.NFData TransformSortCriteria

instance Core.ToJSON TransformSortCriteria where
  toJSON :: TransformSortCriteria -> Value
toJSON TransformSortCriteria' {SortDirectionType
TransformSortColumnType
sortDirection :: SortDirectionType
column :: TransformSortColumnType
$sel:sortDirection:TransformSortCriteria' :: TransformSortCriteria -> SortDirectionType
$sel:column:TransformSortCriteria' :: TransformSortCriteria -> TransformSortColumnType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Column" Text -> TransformSortColumnType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TransformSortColumnType
column),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SortDirection" Text -> SortDirectionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SortDirectionType
sortDirection)
          ]
      )