{-# 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.BotFilter 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.BotFilterName
import Amazonka.LexV2Models.Types.BotFilterOperator
import qualified Amazonka.Prelude as Prelude
data BotFilter = BotFilter'
{
BotFilter -> BotFilterName
name :: BotFilterName,
BotFilter -> NonEmpty Text
values :: Prelude.NonEmpty Prelude.Text,
BotFilter -> BotFilterOperator
operator :: BotFilterOperator
}
deriving (BotFilter -> BotFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotFilter -> BotFilter -> Bool
$c/= :: BotFilter -> BotFilter -> Bool
== :: BotFilter -> BotFilter -> Bool
$c== :: BotFilter -> BotFilter -> Bool
Prelude.Eq, ReadPrec [BotFilter]
ReadPrec BotFilter
Int -> ReadS BotFilter
ReadS [BotFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotFilter]
$creadListPrec :: ReadPrec [BotFilter]
readPrec :: ReadPrec BotFilter
$creadPrec :: ReadPrec BotFilter
readList :: ReadS [BotFilter]
$creadList :: ReadS [BotFilter]
readsPrec :: Int -> ReadS BotFilter
$creadsPrec :: Int -> ReadS BotFilter
Prelude.Read, Int -> BotFilter -> ShowS
[BotFilter] -> ShowS
BotFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotFilter] -> ShowS
$cshowList :: [BotFilter] -> ShowS
show :: BotFilter -> String
$cshow :: BotFilter -> String
showsPrec :: Int -> BotFilter -> ShowS
$cshowsPrec :: Int -> BotFilter -> ShowS
Prelude.Show, forall x. Rep BotFilter x -> BotFilter
forall x. BotFilter -> Rep BotFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BotFilter x -> BotFilter
$cfrom :: forall x. BotFilter -> Rep BotFilter x
Prelude.Generic)
newBotFilter ::
BotFilterName ->
Prelude.NonEmpty Prelude.Text ->
BotFilterOperator ->
BotFilter
newBotFilter :: BotFilterName -> NonEmpty Text -> BotFilterOperator -> BotFilter
newBotFilter BotFilterName
pName_ NonEmpty Text
pValues_ BotFilterOperator
pOperator_ =
BotFilter'
{ $sel:name:BotFilter' :: BotFilterName
name = BotFilterName
pName_,
$sel:values:BotFilter' :: 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:BotFilter' :: BotFilterOperator
operator = BotFilterOperator
pOperator_
}
botFilter_name :: Lens.Lens' BotFilter BotFilterName
botFilter_name :: Lens' BotFilter BotFilterName
botFilter_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotFilter' {BotFilterName
name :: BotFilterName
$sel:name:BotFilter' :: BotFilter -> BotFilterName
name} -> BotFilterName
name) (\s :: BotFilter
s@BotFilter' {} BotFilterName
a -> BotFilter
s {$sel:name:BotFilter' :: BotFilterName
name = BotFilterName
a} :: BotFilter)
botFilter_values :: Lens.Lens' BotFilter (Prelude.NonEmpty Prelude.Text)
botFilter_values :: Lens' BotFilter (NonEmpty Text)
botFilter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotFilter' {NonEmpty Text
values :: NonEmpty Text
$sel:values:BotFilter' :: BotFilter -> NonEmpty Text
values} -> NonEmpty Text
values) (\s :: BotFilter
s@BotFilter' {} NonEmpty Text
a -> BotFilter
s {$sel:values:BotFilter' :: NonEmpty Text
values = NonEmpty Text
a} :: BotFilter) 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
botFilter_operator :: Lens.Lens' BotFilter BotFilterOperator
botFilter_operator :: Lens' BotFilter BotFilterOperator
botFilter_operator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotFilter' {BotFilterOperator
operator :: BotFilterOperator
$sel:operator:BotFilter' :: BotFilter -> BotFilterOperator
operator} -> BotFilterOperator
operator) (\s :: BotFilter
s@BotFilter' {} BotFilterOperator
a -> BotFilter
s {$sel:operator:BotFilter' :: BotFilterOperator
operator = BotFilterOperator
a} :: BotFilter)
instance Prelude.Hashable BotFilter where
hashWithSalt :: Int -> BotFilter -> Int
hashWithSalt Int
_salt BotFilter' {NonEmpty Text
BotFilterName
BotFilterOperator
operator :: BotFilterOperator
values :: NonEmpty Text
name :: BotFilterName
$sel:operator:BotFilter' :: BotFilter -> BotFilterOperator
$sel:values:BotFilter' :: BotFilter -> NonEmpty Text
$sel:name:BotFilter' :: BotFilter -> BotFilterName
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BotFilterName
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
values
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BotFilterOperator
operator
instance Prelude.NFData BotFilter where
rnf :: BotFilter -> ()
rnf BotFilter' {NonEmpty Text
BotFilterName
BotFilterOperator
operator :: BotFilterOperator
values :: NonEmpty Text
name :: BotFilterName
$sel:operator:BotFilter' :: BotFilter -> BotFilterOperator
$sel:values:BotFilter' :: BotFilter -> NonEmpty Text
$sel:name:BotFilter' :: BotFilter -> BotFilterName
..} =
forall a. NFData a => a -> ()
Prelude.rnf BotFilterName
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 BotFilterOperator
operator
instance Data.ToJSON BotFilter where
toJSON :: BotFilter -> Value
toJSON BotFilter' {NonEmpty Text
BotFilterName
BotFilterOperator
operator :: BotFilterOperator
values :: NonEmpty Text
name :: BotFilterName
$sel:operator:BotFilter' :: BotFilter -> BotFilterOperator
$sel:values:BotFilter' :: BotFilter -> NonEmpty Text
$sel:name:BotFilter' :: BotFilter -> BotFilterName
..} =
[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..= BotFilterName
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..= BotFilterOperator
operator)
]
)