{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Reference = Reference'
{
Reference -> Text
value :: Prelude.Text,
Reference -> ReferenceType
type' :: ReferenceType
}
deriving (Reference -> Reference -> Bool
(Reference -> Reference -> Bool)
-> (Reference -> Reference -> Bool) -> Eq Reference
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]
(Int -> ReadS Reference)
-> ReadS [Reference]
-> ReadPrec Reference
-> ReadPrec [Reference]
-> Read 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
(Int -> Reference -> ShowS)
-> (Reference -> String)
-> ([Reference] -> ShowS)
-> Show Reference
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. Reference -> Rep Reference x)
-> (forall x. Rep Reference x -> Reference) -> Generic Reference
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' :: Text -> ReferenceType -> Reference
Reference' {$sel:value:Reference' :: Text
value = Text
pValue_, $sel:type':Reference' :: ReferenceType
type' = ReferenceType
pType_}
reference_value :: Lens.Lens' Reference Prelude.Text
reference_value :: (Text -> f Text) -> Reference -> f Reference
reference_value = (Reference -> Text)
-> (Reference -> Text -> Reference)
-> Lens Reference Reference Text Text
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 :: (ReferenceType -> f ReferenceType) -> Reference -> f Reference
reference_type = (Reference -> ReferenceType)
-> (Reference -> ReferenceType -> Reference)
-> Lens Reference Reference ReferenceType ReferenceType
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 Prelude.Hashable Reference
instance Prelude.NFData Reference
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> ReferenceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReferenceType
type')
]
)