{-# 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 #-}
module Amazonka.LexV2Models.Types.SlotFilter 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.SlotFilterName
import Amazonka.LexV2Models.Types.SlotFilterOperator
import qualified Amazonka.Prelude as Prelude
data SlotFilter = SlotFilter'
{
SlotFilter -> SlotFilterName
name :: SlotFilterName,
SlotFilter -> NonEmpty Text
values :: Prelude.NonEmpty Prelude.Text,
SlotFilter -> SlotFilterOperator
operator :: SlotFilterOperator
}
deriving (SlotFilter -> SlotFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlotFilter -> SlotFilter -> Bool
$c/= :: SlotFilter -> SlotFilter -> Bool
== :: SlotFilter -> SlotFilter -> Bool
$c== :: SlotFilter -> SlotFilter -> Bool
Prelude.Eq, ReadPrec [SlotFilter]
ReadPrec SlotFilter
Int -> ReadS SlotFilter
ReadS [SlotFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlotFilter]
$creadListPrec :: ReadPrec [SlotFilter]
readPrec :: ReadPrec SlotFilter
$creadPrec :: ReadPrec SlotFilter
readList :: ReadS [SlotFilter]
$creadList :: ReadS [SlotFilter]
readsPrec :: Int -> ReadS SlotFilter
$creadsPrec :: Int -> ReadS SlotFilter
Prelude.Read, Int -> SlotFilter -> ShowS
[SlotFilter] -> ShowS
SlotFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlotFilter] -> ShowS
$cshowList :: [SlotFilter] -> ShowS
show :: SlotFilter -> String
$cshow :: SlotFilter -> String
showsPrec :: Int -> SlotFilter -> ShowS
$cshowsPrec :: Int -> SlotFilter -> ShowS
Prelude.Show, forall x. Rep SlotFilter x -> SlotFilter
forall x. SlotFilter -> Rep SlotFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlotFilter x -> SlotFilter
$cfrom :: forall x. SlotFilter -> Rep SlotFilter x
Prelude.Generic)
newSlotFilter ::
SlotFilterName ->
Prelude.NonEmpty Prelude.Text ->
SlotFilterOperator ->
SlotFilter
newSlotFilter :: SlotFilterName -> NonEmpty Text -> SlotFilterOperator -> SlotFilter
newSlotFilter SlotFilterName
pName_ NonEmpty Text
pValues_ SlotFilterOperator
pOperator_ =
SlotFilter'
{ $sel:name:SlotFilter' :: SlotFilterName
name = SlotFilterName
pName_,
$sel:values:SlotFilter' :: NonEmpty Text
values = 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
pValues_,
$sel:operator:SlotFilter' :: SlotFilterOperator
operator = SlotFilterOperator
pOperator_
}
slotFilter_name :: Lens.Lens' SlotFilter SlotFilterName
slotFilter_name :: Lens' SlotFilter SlotFilterName
slotFilter_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotFilter' {SlotFilterName
name :: SlotFilterName
$sel:name:SlotFilter' :: SlotFilter -> SlotFilterName
name} -> SlotFilterName
name) (\s :: SlotFilter
s@SlotFilter' {} SlotFilterName
a -> SlotFilter
s {$sel:name:SlotFilter' :: SlotFilterName
name = SlotFilterName
a} :: SlotFilter)
slotFilter_values :: Lens.Lens' SlotFilter (Prelude.NonEmpty Prelude.Text)
slotFilter_values :: Lens' SlotFilter (NonEmpty Text)
slotFilter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotFilter' {NonEmpty Text
values :: NonEmpty Text
$sel:values:SlotFilter' :: SlotFilter -> NonEmpty Text
values} -> NonEmpty Text
values) (\s :: SlotFilter
s@SlotFilter' {} NonEmpty Text
a -> SlotFilter
s {$sel:values:SlotFilter' :: NonEmpty Text
values = NonEmpty Text
a} :: SlotFilter) 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
slotFilter_operator :: Lens.Lens' SlotFilter SlotFilterOperator
slotFilter_operator :: Lens' SlotFilter SlotFilterOperator
slotFilter_operator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotFilter' {SlotFilterOperator
operator :: SlotFilterOperator
$sel:operator:SlotFilter' :: SlotFilter -> SlotFilterOperator
operator} -> SlotFilterOperator
operator) (\s :: SlotFilter
s@SlotFilter' {} SlotFilterOperator
a -> SlotFilter
s {$sel:operator:SlotFilter' :: SlotFilterOperator
operator = SlotFilterOperator
a} :: SlotFilter)
instance Prelude.Hashable SlotFilter where
hashWithSalt :: Int -> SlotFilter -> Int
hashWithSalt Int
_salt SlotFilter' {NonEmpty Text
SlotFilterName
SlotFilterOperator
operator :: SlotFilterOperator
values :: NonEmpty Text
name :: SlotFilterName
$sel:operator:SlotFilter' :: SlotFilter -> SlotFilterOperator
$sel:values:SlotFilter' :: SlotFilter -> NonEmpty Text
$sel:name:SlotFilter' :: SlotFilter -> SlotFilterName
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SlotFilterName
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
values
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SlotFilterOperator
operator
instance Prelude.NFData SlotFilter where
rnf :: SlotFilter -> ()
rnf SlotFilter' {NonEmpty Text
SlotFilterName
SlotFilterOperator
operator :: SlotFilterOperator
values :: NonEmpty Text
name :: SlotFilterName
$sel:operator:SlotFilter' :: SlotFilter -> SlotFilterOperator
$sel:values:SlotFilter' :: SlotFilter -> NonEmpty Text
$sel:name:SlotFilter' :: SlotFilter -> SlotFilterName
..} =
forall a. NFData a => a -> ()
Prelude.rnf SlotFilterName
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
values
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SlotFilterOperator
operator
instance Data.ToJSON SlotFilter where
toJSON :: SlotFilter -> Value
toJSON SlotFilter' {NonEmpty Text
SlotFilterName
SlotFilterOperator
operator :: SlotFilterOperator
values :: NonEmpty Text
name :: SlotFilterName
$sel:operator:SlotFilter' :: SlotFilter -> SlotFilterOperator
$sel:values:SlotFilter' :: SlotFilter -> NonEmpty Text
$sel:name:SlotFilter' :: SlotFilter -> SlotFilterName
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SlotFilterName
name),
forall a. a -> Maybe a
Prelude.Just (Key
"values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
values),
forall a. a -> Maybe a
Prelude.Just (Key
"operator" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SlotFilterOperator
operator)
]
)