{-# 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.Connect.Types.Reference where
import Amazonka.Connect.Types.ReferenceType
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 Reference = Reference'
{
Reference -> Text
value :: Prelude.Text,
Reference -> ReferenceType
type' :: ReferenceType
}
deriving (Reference -> Reference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Reference -> Reference -> Bool
$c/= :: Reference -> Reference -> Bool
== :: Reference -> Reference -> Bool
$c== :: Reference -> Reference -> Bool
Prelude.Eq, ReadPrec [Reference]
ReadPrec Reference
Int -> ReadS Reference
ReadS [Reference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Reference]
$creadListPrec :: ReadPrec [Reference]
readPrec :: ReadPrec Reference
$creadPrec :: ReadPrec Reference
readList :: ReadS [Reference]
$creadList :: ReadS [Reference]
readsPrec :: Int -> ReadS Reference
$creadsPrec :: Int -> ReadS Reference
Prelude.Read, Int -> Reference -> ShowS
[Reference] -> ShowS
Reference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Reference] -> ShowS
$cshowList :: [Reference] -> ShowS
show :: Reference -> String
$cshow :: Reference -> String
showsPrec :: Int -> Reference -> ShowS
$cshowsPrec :: Int -> Reference -> ShowS
Prelude.Show, forall x. Rep Reference x -> Reference
forall x. Reference -> Rep Reference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Reference x -> Reference
$cfrom :: forall x. Reference -> Rep Reference x
Prelude.Generic)
newReference ::
Prelude.Text ->
ReferenceType ->
Reference
newReference :: Text -> ReferenceType -> Reference
newReference Text
pValue_ ReferenceType
pType_ =
Reference' {$sel:value:Reference' :: Text
value = Text
pValue_, $sel:type':Reference' :: ReferenceType
type' = ReferenceType
pType_}
reference_value :: Lens.Lens' Reference Prelude.Text
reference_value :: Lens' Reference Text
reference_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Reference' {Text
value :: Text
$sel:value:Reference' :: Reference -> Text
value} -> Text
value) (\s :: Reference
s@Reference' {} Text
a -> Reference
s {$sel:value:Reference' :: Text
value = Text
a} :: Reference)
reference_type :: Lens.Lens' Reference ReferenceType
reference_type :: Lens' Reference ReferenceType
reference_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Reference' {ReferenceType
type' :: ReferenceType
$sel:type':Reference' :: Reference -> ReferenceType
type'} -> ReferenceType
type') (\s :: Reference
s@Reference' {} ReferenceType
a -> Reference
s {$sel:type':Reference' :: ReferenceType
type' = ReferenceType
a} :: Reference)
instance Data.FromJSON Reference where
parseJSON :: Value -> Parser Reference
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Reference"
( \Object
x ->
Text -> ReferenceType -> Reference
Reference'
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
"Value")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
)
instance Prelude.Hashable Reference where
hashWithSalt :: Int -> Reference -> Int
hashWithSalt Int
_salt Reference' {Text
ReferenceType
type' :: ReferenceType
value :: Text
$sel:type':Reference' :: Reference -> ReferenceType
$sel:value:Reference' :: Reference -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ReferenceType
type'
instance Prelude.NFData Reference where
rnf :: Reference -> ()
rnf Reference' {Text
ReferenceType
type' :: ReferenceType
value :: Text
$sel:type':Reference' :: Reference -> ReferenceType
$sel:value:Reference' :: Reference -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
value seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ReferenceType
type'
instance Data.ToJSON Reference where
toJSON :: Reference -> Value
toJSON Reference' {Text
ReferenceType
type' :: ReferenceType
value :: Text
$sel:type':Reference' :: Reference -> ReferenceType
$sel:value:Reference' :: Reference -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value),
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ReferenceType
type')
]
)