{-# 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.Transcribe.Types.Rule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transcribe.Types.InterruptionFilter
import Amazonka.Transcribe.Types.NonTalkTimeFilter
import Amazonka.Transcribe.Types.SentimentFilter
import Amazonka.Transcribe.Types.TranscriptFilter
data Rule = Rule'
{
Rule -> Maybe NonTalkTimeFilter
nonTalkTimeFilter :: Prelude.Maybe NonTalkTimeFilter,
Rule -> Maybe TranscriptFilter
transcriptFilter :: Prelude.Maybe TranscriptFilter,
Rule -> Maybe SentimentFilter
sentimentFilter :: Prelude.Maybe SentimentFilter,
Rule -> Maybe InterruptionFilter
interruptionFilter :: Prelude.Maybe InterruptionFilter
}
deriving (Rule -> Rule -> Bool
(Rule -> Rule -> Bool) -> (Rule -> Rule -> Bool) -> Eq Rule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Rule -> Rule -> Bool
$c/= :: Rule -> Rule -> Bool
== :: Rule -> Rule -> Bool
$c== :: Rule -> Rule -> Bool
Prelude.Eq, ReadPrec [Rule]
ReadPrec Rule
Int -> ReadS Rule
ReadS [Rule]
(Int -> ReadS Rule)
-> ReadS [Rule] -> ReadPrec Rule -> ReadPrec [Rule] -> Read Rule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Rule]
$creadListPrec :: ReadPrec [Rule]
readPrec :: ReadPrec Rule
$creadPrec :: ReadPrec Rule
readList :: ReadS [Rule]
$creadList :: ReadS [Rule]
readsPrec :: Int -> ReadS Rule
$creadsPrec :: Int -> ReadS Rule
Prelude.Read, Int -> Rule -> ShowS
[Rule] -> ShowS
Rule -> String
(Int -> Rule -> ShowS)
-> (Rule -> String) -> ([Rule] -> ShowS) -> Show Rule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Rule] -> ShowS
$cshowList :: [Rule] -> ShowS
show :: Rule -> String
$cshow :: Rule -> String
showsPrec :: Int -> Rule -> ShowS
$cshowsPrec :: Int -> Rule -> ShowS
Prelude.Show, (forall x. Rule -> Rep Rule x)
-> (forall x. Rep Rule x -> Rule) -> Generic Rule
forall x. Rep Rule x -> Rule
forall x. Rule -> Rep Rule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Rule x -> Rule
$cfrom :: forall x. Rule -> Rep Rule x
Prelude.Generic)
newRule ::
Rule
newRule :: Rule
newRule =
Rule' :: Maybe NonTalkTimeFilter
-> Maybe TranscriptFilter
-> Maybe SentimentFilter
-> Maybe InterruptionFilter
-> Rule
Rule'
{ $sel:nonTalkTimeFilter:Rule' :: Maybe NonTalkTimeFilter
nonTalkTimeFilter = Maybe NonTalkTimeFilter
forall a. Maybe a
Prelude.Nothing,
$sel:transcriptFilter:Rule' :: Maybe TranscriptFilter
transcriptFilter = Maybe TranscriptFilter
forall a. Maybe a
Prelude.Nothing,
$sel:sentimentFilter:Rule' :: Maybe SentimentFilter
sentimentFilter = Maybe SentimentFilter
forall a. Maybe a
Prelude.Nothing,
$sel:interruptionFilter:Rule' :: Maybe InterruptionFilter
interruptionFilter = Maybe InterruptionFilter
forall a. Maybe a
Prelude.Nothing
}
rule_nonTalkTimeFilter :: Lens.Lens' Rule (Prelude.Maybe NonTalkTimeFilter)
rule_nonTalkTimeFilter :: (Maybe NonTalkTimeFilter -> f (Maybe NonTalkTimeFilter))
-> Rule -> f Rule
rule_nonTalkTimeFilter = (Rule -> Maybe NonTalkTimeFilter)
-> (Rule -> Maybe NonTalkTimeFilter -> Rule)
-> Lens
Rule Rule (Maybe NonTalkTimeFilter) (Maybe NonTalkTimeFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe NonTalkTimeFilter
nonTalkTimeFilter :: Maybe NonTalkTimeFilter
$sel:nonTalkTimeFilter:Rule' :: Rule -> Maybe NonTalkTimeFilter
nonTalkTimeFilter} -> Maybe NonTalkTimeFilter
nonTalkTimeFilter) (\s :: Rule
s@Rule' {} Maybe NonTalkTimeFilter
a -> Rule
s {$sel:nonTalkTimeFilter:Rule' :: Maybe NonTalkTimeFilter
nonTalkTimeFilter = Maybe NonTalkTimeFilter
a} :: Rule)
rule_transcriptFilter :: Lens.Lens' Rule (Prelude.Maybe TranscriptFilter)
rule_transcriptFilter :: (Maybe TranscriptFilter -> f (Maybe TranscriptFilter))
-> Rule -> f Rule
rule_transcriptFilter = (Rule -> Maybe TranscriptFilter)
-> (Rule -> Maybe TranscriptFilter -> Rule)
-> Lens Rule Rule (Maybe TranscriptFilter) (Maybe TranscriptFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe TranscriptFilter
transcriptFilter :: Maybe TranscriptFilter
$sel:transcriptFilter:Rule' :: Rule -> Maybe TranscriptFilter
transcriptFilter} -> Maybe TranscriptFilter
transcriptFilter) (\s :: Rule
s@Rule' {} Maybe TranscriptFilter
a -> Rule
s {$sel:transcriptFilter:Rule' :: Maybe TranscriptFilter
transcriptFilter = Maybe TranscriptFilter
a} :: Rule)
rule_sentimentFilter :: Lens.Lens' Rule (Prelude.Maybe SentimentFilter)
rule_sentimentFilter :: (Maybe SentimentFilter -> f (Maybe SentimentFilter))
-> Rule -> f Rule
rule_sentimentFilter = (Rule -> Maybe SentimentFilter)
-> (Rule -> Maybe SentimentFilter -> Rule)
-> Lens Rule Rule (Maybe SentimentFilter) (Maybe SentimentFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe SentimentFilter
sentimentFilter :: Maybe SentimentFilter
$sel:sentimentFilter:Rule' :: Rule -> Maybe SentimentFilter
sentimentFilter} -> Maybe SentimentFilter
sentimentFilter) (\s :: Rule
s@Rule' {} Maybe SentimentFilter
a -> Rule
s {$sel:sentimentFilter:Rule' :: Maybe SentimentFilter
sentimentFilter = Maybe SentimentFilter
a} :: Rule)
rule_interruptionFilter :: Lens.Lens' Rule (Prelude.Maybe InterruptionFilter)
rule_interruptionFilter :: (Maybe InterruptionFilter -> f (Maybe InterruptionFilter))
-> Rule -> f Rule
rule_interruptionFilter = (Rule -> Maybe InterruptionFilter)
-> (Rule -> Maybe InterruptionFilter -> Rule)
-> Lens
Rule Rule (Maybe InterruptionFilter) (Maybe InterruptionFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe InterruptionFilter
interruptionFilter :: Maybe InterruptionFilter
$sel:interruptionFilter:Rule' :: Rule -> Maybe InterruptionFilter
interruptionFilter} -> Maybe InterruptionFilter
interruptionFilter) (\s :: Rule
s@Rule' {} Maybe InterruptionFilter
a -> Rule
s {$sel:interruptionFilter:Rule' :: Maybe InterruptionFilter
interruptionFilter = Maybe InterruptionFilter
a} :: Rule)
instance Core.FromJSON Rule where
parseJSON :: Value -> Parser Rule
parseJSON =
String -> (Object -> Parser Rule) -> Value -> Parser Rule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Rule"
( \Object
x ->
Maybe NonTalkTimeFilter
-> Maybe TranscriptFilter
-> Maybe SentimentFilter
-> Maybe InterruptionFilter
-> Rule
Rule'
(Maybe NonTalkTimeFilter
-> Maybe TranscriptFilter
-> Maybe SentimentFilter
-> Maybe InterruptionFilter
-> Rule)
-> Parser (Maybe NonTalkTimeFilter)
-> Parser
(Maybe TranscriptFilter
-> Maybe SentimentFilter -> Maybe InterruptionFilter -> Rule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NonTalkTimeFilter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonTalkTimeFilter")
Parser
(Maybe TranscriptFilter
-> Maybe SentimentFilter -> Maybe InterruptionFilter -> Rule)
-> Parser (Maybe TranscriptFilter)
-> Parser
(Maybe SentimentFilter -> Maybe InterruptionFilter -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TranscriptFilter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TranscriptFilter")
Parser (Maybe SentimentFilter -> Maybe InterruptionFilter -> Rule)
-> Parser (Maybe SentimentFilter)
-> Parser (Maybe InterruptionFilter -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SentimentFilter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SentimentFilter")
Parser (Maybe InterruptionFilter -> Rule)
-> Parser (Maybe InterruptionFilter) -> Parser Rule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InterruptionFilter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InterruptionFilter")
)
instance Prelude.Hashable Rule
instance Prelude.NFData Rule
instance Core.ToJSON Rule where
toJSON :: Rule -> Value
toJSON Rule' {Maybe NonTalkTimeFilter
Maybe InterruptionFilter
Maybe SentimentFilter
Maybe TranscriptFilter
interruptionFilter :: Maybe InterruptionFilter
sentimentFilter :: Maybe SentimentFilter
transcriptFilter :: Maybe TranscriptFilter
nonTalkTimeFilter :: Maybe NonTalkTimeFilter
$sel:interruptionFilter:Rule' :: Rule -> Maybe InterruptionFilter
$sel:sentimentFilter:Rule' :: Rule -> Maybe SentimentFilter
$sel:transcriptFilter:Rule' :: Rule -> Maybe TranscriptFilter
$sel:nonTalkTimeFilter:Rule' :: Rule -> Maybe NonTalkTimeFilter
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NonTalkTimeFilter" Text -> NonTalkTimeFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonTalkTimeFilter -> Pair)
-> Maybe NonTalkTimeFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NonTalkTimeFilter
nonTalkTimeFilter,
(Text
"TranscriptFilter" Text -> TranscriptFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(TranscriptFilter -> Pair) -> Maybe TranscriptFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TranscriptFilter
transcriptFilter,
(Text
"SentimentFilter" Text -> SentimentFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SentimentFilter -> Pair) -> Maybe SentimentFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SentimentFilter
sentimentFilter,
(Text
"InterruptionFilter" Text -> InterruptionFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(InterruptionFilter -> Pair)
-> Maybe InterruptionFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InterruptionFilter
interruptionFilter
]
)