{-# 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.Pinpoint.Types.SegmentCondition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data SegmentCondition = SegmentCondition'
{
SegmentCondition -> Text
segmentId :: Prelude.Text
}
deriving (SegmentCondition -> SegmentCondition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SegmentCondition -> SegmentCondition -> Bool
$c/= :: SegmentCondition -> SegmentCondition -> Bool
== :: SegmentCondition -> SegmentCondition -> Bool
$c== :: SegmentCondition -> SegmentCondition -> Bool
Prelude.Eq, ReadPrec [SegmentCondition]
ReadPrec SegmentCondition
Int -> ReadS SegmentCondition
ReadS [SegmentCondition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SegmentCondition]
$creadListPrec :: ReadPrec [SegmentCondition]
readPrec :: ReadPrec SegmentCondition
$creadPrec :: ReadPrec SegmentCondition
readList :: ReadS [SegmentCondition]
$creadList :: ReadS [SegmentCondition]
readsPrec :: Int -> ReadS SegmentCondition
$creadsPrec :: Int -> ReadS SegmentCondition
Prelude.Read, Int -> SegmentCondition -> ShowS
[SegmentCondition] -> ShowS
SegmentCondition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SegmentCondition] -> ShowS
$cshowList :: [SegmentCondition] -> ShowS
show :: SegmentCondition -> String
$cshow :: SegmentCondition -> String
showsPrec :: Int -> SegmentCondition -> ShowS
$cshowsPrec :: Int -> SegmentCondition -> ShowS
Prelude.Show, forall x. Rep SegmentCondition x -> SegmentCondition
forall x. SegmentCondition -> Rep SegmentCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SegmentCondition x -> SegmentCondition
$cfrom :: forall x. SegmentCondition -> Rep SegmentCondition x
Prelude.Generic)
newSegmentCondition ::
Prelude.Text ->
SegmentCondition
newSegmentCondition :: Text -> SegmentCondition
newSegmentCondition Text
pSegmentId_ =
SegmentCondition' {$sel:segmentId:SegmentCondition' :: Text
segmentId = Text
pSegmentId_}
segmentCondition_segmentId :: Lens.Lens' SegmentCondition Prelude.Text
segmentCondition_segmentId :: Lens' SegmentCondition Text
segmentCondition_segmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentCondition' {Text
segmentId :: Text
$sel:segmentId:SegmentCondition' :: SegmentCondition -> Text
segmentId} -> Text
segmentId) (\s :: SegmentCondition
s@SegmentCondition' {} Text
a -> SegmentCondition
s {$sel:segmentId:SegmentCondition' :: Text
segmentId = Text
a} :: SegmentCondition)
instance Data.FromJSON SegmentCondition where
parseJSON :: Value -> Parser SegmentCondition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SegmentCondition"
( \Object
x ->
Text -> SegmentCondition
SegmentCondition'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SegmentId")
)
instance Prelude.Hashable SegmentCondition where
hashWithSalt :: Int -> SegmentCondition -> Int
hashWithSalt Int
_salt SegmentCondition' {Text
segmentId :: Text
$sel:segmentId:SegmentCondition' :: SegmentCondition -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
segmentId
instance Prelude.NFData SegmentCondition where
rnf :: SegmentCondition -> ()
rnf SegmentCondition' {Text
segmentId :: Text
$sel:segmentId:SegmentCondition' :: SegmentCondition -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
segmentId
instance Data.ToJSON SegmentCondition where
toJSON :: SegmentCondition -> Value
toJSON SegmentCondition' {Text
segmentId :: Text
$sel:segmentId:SegmentCondition' :: SegmentCondition -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"SegmentId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
segmentId)]
)