{-# 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.AlexaBusiness.Types.Category 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 Category = Category'
{
Category -> Maybe Natural
categoryId :: Prelude.Maybe Prelude.Natural,
Category -> Maybe Text
categoryName :: Prelude.Maybe Prelude.Text
}
deriving (Category -> Category -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Category -> Category -> Bool
$c/= :: Category -> Category -> Bool
== :: Category -> Category -> Bool
$c== :: Category -> Category -> Bool
Prelude.Eq, ReadPrec [Category]
ReadPrec Category
Int -> ReadS Category
ReadS [Category]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Category]
$creadListPrec :: ReadPrec [Category]
readPrec :: ReadPrec Category
$creadPrec :: ReadPrec Category
readList :: ReadS [Category]
$creadList :: ReadS [Category]
readsPrec :: Int -> ReadS Category
$creadsPrec :: Int -> ReadS Category
Prelude.Read, Int -> Category -> ShowS
[Category] -> ShowS
Category -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Category] -> ShowS
$cshowList :: [Category] -> ShowS
show :: Category -> String
$cshow :: Category -> String
showsPrec :: Int -> Category -> ShowS
$cshowsPrec :: Int -> Category -> ShowS
Prelude.Show, forall x. Rep Category x -> Category
forall x. Category -> Rep Category x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Category x -> Category
$cfrom :: forall x. Category -> Rep Category x
Prelude.Generic)
newCategory ::
Category
newCategory :: Category
newCategory =
Category'
{ $sel:categoryId:Category' :: Maybe Natural
categoryId = forall a. Maybe a
Prelude.Nothing,
$sel:categoryName:Category' :: Maybe Text
categoryName = forall a. Maybe a
Prelude.Nothing
}
category_categoryId :: Lens.Lens' Category (Prelude.Maybe Prelude.Natural)
category_categoryId :: Lens' Category (Maybe Natural)
category_categoryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Category' {Maybe Natural
categoryId :: Maybe Natural
$sel:categoryId:Category' :: Category -> Maybe Natural
categoryId} -> Maybe Natural
categoryId) (\s :: Category
s@Category' {} Maybe Natural
a -> Category
s {$sel:categoryId:Category' :: Maybe Natural
categoryId = Maybe Natural
a} :: Category)
category_categoryName :: Lens.Lens' Category (Prelude.Maybe Prelude.Text)
category_categoryName :: Lens' Category (Maybe Text)
category_categoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Category' {Maybe Text
categoryName :: Maybe Text
$sel:categoryName:Category' :: Category -> Maybe Text
categoryName} -> Maybe Text
categoryName) (\s :: Category
s@Category' {} Maybe Text
a -> Category
s {$sel:categoryName:Category' :: Maybe Text
categoryName = Maybe Text
a} :: Category)
instance Data.FromJSON Category where
parseJSON :: Value -> Parser Category
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Category"
( \Object
x ->
Maybe Natural -> Maybe Text -> Category
Category'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CategoryId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CategoryName")
)
instance Prelude.Hashable Category where
hashWithSalt :: Int -> Category -> Int
hashWithSalt Int
_salt Category' {Maybe Natural
Maybe Text
categoryName :: Maybe Text
categoryId :: Maybe Natural
$sel:categoryName:Category' :: Category -> Maybe Text
$sel:categoryId:Category' :: Category -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
categoryId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
categoryName
instance Prelude.NFData Category where
rnf :: Category -> ()
rnf Category' {Maybe Natural
Maybe Text
categoryName :: Maybe Text
categoryId :: Maybe Natural
$sel:categoryName:Category' :: Category -> Maybe Text
$sel:categoryId:Category' :: Category -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
categoryId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
categoryName