{-# 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.LexV2Models.Types.BuiltInSlotTypeSortBy
-- 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.LexV2Models.Types.BuiltInSlotTypeSortBy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.BuiltInSlotTypeSortAttribute
import Amazonka.LexV2Models.Types.SortOrder
import qualified Amazonka.Prelude as Prelude

-- | Specifies attributes for sorting a list of built-in slot types.
--
-- /See:/ 'newBuiltInSlotTypeSortBy' smart constructor.
data BuiltInSlotTypeSortBy = BuiltInSlotTypeSortBy'
  { -- | The attribute to use to sort the list of built-in intents.
    BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortAttribute
attribute :: BuiltInSlotTypeSortAttribute,
    -- | The order to sort the list. You can choose ascending or descending.
    BuiltInSlotTypeSortBy -> SortOrder
order :: SortOrder
  }
  deriving (BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortBy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortBy -> Bool
$c/= :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortBy -> Bool
== :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortBy -> Bool
$c== :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortBy -> Bool
Prelude.Eq, ReadPrec [BuiltInSlotTypeSortBy]
ReadPrec BuiltInSlotTypeSortBy
Int -> ReadS BuiltInSlotTypeSortBy
ReadS [BuiltInSlotTypeSortBy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuiltInSlotTypeSortBy]
$creadListPrec :: ReadPrec [BuiltInSlotTypeSortBy]
readPrec :: ReadPrec BuiltInSlotTypeSortBy
$creadPrec :: ReadPrec BuiltInSlotTypeSortBy
readList :: ReadS [BuiltInSlotTypeSortBy]
$creadList :: ReadS [BuiltInSlotTypeSortBy]
readsPrec :: Int -> ReadS BuiltInSlotTypeSortBy
$creadsPrec :: Int -> ReadS BuiltInSlotTypeSortBy
Prelude.Read, Int -> BuiltInSlotTypeSortBy -> ShowS
[BuiltInSlotTypeSortBy] -> ShowS
BuiltInSlotTypeSortBy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuiltInSlotTypeSortBy] -> ShowS
$cshowList :: [BuiltInSlotTypeSortBy] -> ShowS
show :: BuiltInSlotTypeSortBy -> String
$cshow :: BuiltInSlotTypeSortBy -> String
showsPrec :: Int -> BuiltInSlotTypeSortBy -> ShowS
$cshowsPrec :: Int -> BuiltInSlotTypeSortBy -> ShowS
Prelude.Show, forall x. Rep BuiltInSlotTypeSortBy x -> BuiltInSlotTypeSortBy
forall x. BuiltInSlotTypeSortBy -> Rep BuiltInSlotTypeSortBy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuiltInSlotTypeSortBy x -> BuiltInSlotTypeSortBy
$cfrom :: forall x. BuiltInSlotTypeSortBy -> Rep BuiltInSlotTypeSortBy x
Prelude.Generic)

-- |
-- Create a value of 'BuiltInSlotTypeSortBy' 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:
--
-- 'attribute', 'builtInSlotTypeSortBy_attribute' - The attribute to use to sort the list of built-in intents.
--
-- 'order', 'builtInSlotTypeSortBy_order' - The order to sort the list. You can choose ascending or descending.
newBuiltInSlotTypeSortBy ::
  -- | 'attribute'
  BuiltInSlotTypeSortAttribute ->
  -- | 'order'
  SortOrder ->
  BuiltInSlotTypeSortBy
newBuiltInSlotTypeSortBy :: BuiltInSlotTypeSortAttribute -> SortOrder -> BuiltInSlotTypeSortBy
newBuiltInSlotTypeSortBy BuiltInSlotTypeSortAttribute
pAttribute_ SortOrder
pOrder_ =
  BuiltInSlotTypeSortBy'
    { $sel:attribute:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortAttribute
attribute = BuiltInSlotTypeSortAttribute
pAttribute_,
      $sel:order:BuiltInSlotTypeSortBy' :: SortOrder
order = SortOrder
pOrder_
    }

-- | The attribute to use to sort the list of built-in intents.
builtInSlotTypeSortBy_attribute :: Lens.Lens' BuiltInSlotTypeSortBy BuiltInSlotTypeSortAttribute
builtInSlotTypeSortBy_attribute :: Lens' BuiltInSlotTypeSortBy BuiltInSlotTypeSortAttribute
builtInSlotTypeSortBy_attribute = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuiltInSlotTypeSortBy' {BuiltInSlotTypeSortAttribute
attribute :: BuiltInSlotTypeSortAttribute
$sel:attribute:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortAttribute
attribute} -> BuiltInSlotTypeSortAttribute
attribute) (\s :: BuiltInSlotTypeSortBy
s@BuiltInSlotTypeSortBy' {} BuiltInSlotTypeSortAttribute
a -> BuiltInSlotTypeSortBy
s {$sel:attribute:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortAttribute
attribute = BuiltInSlotTypeSortAttribute
a} :: BuiltInSlotTypeSortBy)

-- | The order to sort the list. You can choose ascending or descending.
builtInSlotTypeSortBy_order :: Lens.Lens' BuiltInSlotTypeSortBy SortOrder
builtInSlotTypeSortBy_order :: Lens' BuiltInSlotTypeSortBy SortOrder
builtInSlotTypeSortBy_order = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuiltInSlotTypeSortBy' {SortOrder
order :: SortOrder
$sel:order:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> SortOrder
order} -> SortOrder
order) (\s :: BuiltInSlotTypeSortBy
s@BuiltInSlotTypeSortBy' {} SortOrder
a -> BuiltInSlotTypeSortBy
s {$sel:order:BuiltInSlotTypeSortBy' :: SortOrder
order = SortOrder
a} :: BuiltInSlotTypeSortBy)

instance Prelude.Hashable BuiltInSlotTypeSortBy where
  hashWithSalt :: Int -> BuiltInSlotTypeSortBy -> Int
hashWithSalt Int
_salt BuiltInSlotTypeSortBy' {BuiltInSlotTypeSortAttribute
SortOrder
order :: SortOrder
attribute :: BuiltInSlotTypeSortAttribute
$sel:order:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> SortOrder
$sel:attribute:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortAttribute
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BuiltInSlotTypeSortAttribute
attribute
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SortOrder
order

instance Prelude.NFData BuiltInSlotTypeSortBy where
  rnf :: BuiltInSlotTypeSortBy -> ()
rnf BuiltInSlotTypeSortBy' {BuiltInSlotTypeSortAttribute
SortOrder
order :: SortOrder
attribute :: BuiltInSlotTypeSortAttribute
$sel:order:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> SortOrder
$sel:attribute:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortAttribute
..} =
    forall a. NFData a => a -> ()
Prelude.rnf BuiltInSlotTypeSortAttribute
attribute
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SortOrder
order

instance Data.ToJSON BuiltInSlotTypeSortBy where
  toJSON :: BuiltInSlotTypeSortBy -> Value
toJSON BuiltInSlotTypeSortBy' {BuiltInSlotTypeSortAttribute
SortOrder
order :: SortOrder
attribute :: BuiltInSlotTypeSortAttribute
$sel:order:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> SortOrder
$sel:attribute:BuiltInSlotTypeSortBy' :: BuiltInSlotTypeSortBy -> BuiltInSlotTypeSortAttribute
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"attribute" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= BuiltInSlotTypeSortAttribute
attribute),
            forall a. a -> Maybe a
Prelude.Just (Key
"order" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SortOrder
order)
          ]
      )