{-# 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.CloudDirectory.Types.Facet where
import Amazonka.CloudDirectory.Types.FacetStyle
import Amazonka.CloudDirectory.Types.ObjectType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Facet = Facet'
{
Facet -> Maybe FacetStyle
facetStyle :: Prelude.Maybe FacetStyle,
Facet -> Maybe ObjectType
objectType :: Prelude.Maybe ObjectType,
Facet -> Maybe Text
name :: Prelude.Maybe Prelude.Text
}
deriving (Facet -> Facet -> Bool
(Facet -> Facet -> Bool) -> (Facet -> Facet -> Bool) -> Eq Facet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Facet -> Facet -> Bool
$c/= :: Facet -> Facet -> Bool
== :: Facet -> Facet -> Bool
$c== :: Facet -> Facet -> Bool
Prelude.Eq, ReadPrec [Facet]
ReadPrec Facet
Int -> ReadS Facet
ReadS [Facet]
(Int -> ReadS Facet)
-> ReadS [Facet]
-> ReadPrec Facet
-> ReadPrec [Facet]
-> Read Facet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Facet]
$creadListPrec :: ReadPrec [Facet]
readPrec :: ReadPrec Facet
$creadPrec :: ReadPrec Facet
readList :: ReadS [Facet]
$creadList :: ReadS [Facet]
readsPrec :: Int -> ReadS Facet
$creadsPrec :: Int -> ReadS Facet
Prelude.Read, Int -> Facet -> ShowS
[Facet] -> ShowS
Facet -> String
(Int -> Facet -> ShowS)
-> (Facet -> String) -> ([Facet] -> ShowS) -> Show Facet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Facet] -> ShowS
$cshowList :: [Facet] -> ShowS
show :: Facet -> String
$cshow :: Facet -> String
showsPrec :: Int -> Facet -> ShowS
$cshowsPrec :: Int -> Facet -> ShowS
Prelude.Show, (forall x. Facet -> Rep Facet x)
-> (forall x. Rep Facet x -> Facet) -> Generic Facet
forall x. Rep Facet x -> Facet
forall x. Facet -> Rep Facet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Facet x -> Facet
$cfrom :: forall x. Facet -> Rep Facet x
Prelude.Generic)
newFacet ::
Facet
newFacet :: Facet
newFacet =
Facet' :: Maybe FacetStyle -> Maybe ObjectType -> Maybe Text -> Facet
Facet'
{ $sel:facetStyle:Facet' :: Maybe FacetStyle
facetStyle = Maybe FacetStyle
forall a. Maybe a
Prelude.Nothing,
$sel:objectType:Facet' :: Maybe ObjectType
objectType = Maybe ObjectType
forall a. Maybe a
Prelude.Nothing,
$sel:name:Facet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
facet_facetStyle :: Lens.Lens' Facet (Prelude.Maybe FacetStyle)
facet_facetStyle :: (Maybe FacetStyle -> f (Maybe FacetStyle)) -> Facet -> f Facet
facet_facetStyle = (Facet -> Maybe FacetStyle)
-> (Facet -> Maybe FacetStyle -> Facet)
-> Lens Facet Facet (Maybe FacetStyle) (Maybe FacetStyle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Facet' {Maybe FacetStyle
facetStyle :: Maybe FacetStyle
$sel:facetStyle:Facet' :: Facet -> Maybe FacetStyle
facetStyle} -> Maybe FacetStyle
facetStyle) (\s :: Facet
s@Facet' {} Maybe FacetStyle
a -> Facet
s {$sel:facetStyle:Facet' :: Maybe FacetStyle
facetStyle = Maybe FacetStyle
a} :: Facet)
facet_objectType :: Lens.Lens' Facet (Prelude.Maybe ObjectType)
facet_objectType :: (Maybe ObjectType -> f (Maybe ObjectType)) -> Facet -> f Facet
facet_objectType = (Facet -> Maybe ObjectType)
-> (Facet -> Maybe ObjectType -> Facet)
-> Lens Facet Facet (Maybe ObjectType) (Maybe ObjectType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Facet' {Maybe ObjectType
objectType :: Maybe ObjectType
$sel:objectType:Facet' :: Facet -> Maybe ObjectType
objectType} -> Maybe ObjectType
objectType) (\s :: Facet
s@Facet' {} Maybe ObjectType
a -> Facet
s {$sel:objectType:Facet' :: Maybe ObjectType
objectType = Maybe ObjectType
a} :: Facet)
facet_name :: Lens.Lens' Facet (Prelude.Maybe Prelude.Text)
facet_name :: (Maybe Text -> f (Maybe Text)) -> Facet -> f Facet
facet_name = (Facet -> Maybe Text)
-> (Facet -> Maybe Text -> Facet)
-> Lens Facet Facet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Facet' {Maybe Text
name :: Maybe Text
$sel:name:Facet' :: Facet -> Maybe Text
name} -> Maybe Text
name) (\s :: Facet
s@Facet' {} Maybe Text
a -> Facet
s {$sel:name:Facet' :: Maybe Text
name = Maybe Text
a} :: Facet)
instance Core.FromJSON Facet where
parseJSON :: Value -> Parser Facet
parseJSON =
String -> (Object -> Parser Facet) -> Value -> Parser Facet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Facet"
( \Object
x ->
Maybe FacetStyle -> Maybe ObjectType -> Maybe Text -> Facet
Facet'
(Maybe FacetStyle -> Maybe ObjectType -> Maybe Text -> Facet)
-> Parser (Maybe FacetStyle)
-> Parser (Maybe ObjectType -> Maybe Text -> Facet)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FacetStyle)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FacetStyle")
Parser (Maybe ObjectType -> Maybe Text -> Facet)
-> Parser (Maybe ObjectType) -> Parser (Maybe Text -> Facet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ObjectType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ObjectType")
Parser (Maybe Text -> Facet) -> Parser (Maybe Text) -> Parser Facet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
)
instance Prelude.Hashable Facet
instance Prelude.NFData Facet