{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.Types.Category
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AlexaBusiness.Types.Category where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The skill store category that is shown. Alexa skills are assigned a
-- specific skill category during creation, such as News, Social, and
-- Sports.
--
-- /See:/ 'newCategory' smart constructor.
data Category = Category'
  { -- | The name of the skill store category.
    Category -> Maybe Text
categoryName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the skill store category.
    Category -> Maybe Natural
categoryId :: Prelude.Maybe Prelude.Natural
  }
  deriving (Category -> Category -> Bool
(Category -> Category -> Bool)
-> (Category -> Category -> Bool) -> Eq Category
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]
(Int -> ReadS Category)
-> ReadS [Category]
-> ReadPrec Category
-> ReadPrec [Category]
-> Read 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
(Int -> Category -> ShowS)
-> (Category -> String) -> ([Category] -> ShowS) -> Show Category
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. Category -> Rep Category x)
-> (forall x. Rep Category x -> Category) -> Generic Category
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)

-- |
-- Create a value of 'Category' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'categoryName', 'category_categoryName' - The name of the skill store category.
--
-- 'categoryId', 'category_categoryId' - The ID of the skill store category.
newCategory ::
  Category
newCategory :: Category
newCategory =
  Category' :: Maybe Text -> Maybe Natural -> Category
Category'
    { $sel:categoryName:Category' :: Maybe Text
categoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:categoryId:Category' :: Maybe Natural
categoryId = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the skill store category.
category_categoryName :: Lens.Lens' Category (Prelude.Maybe Prelude.Text)
category_categoryName :: (Maybe Text -> f (Maybe Text)) -> Category -> f Category
category_categoryName = (Category -> Maybe Text)
-> (Category -> Maybe Text -> Category)
-> Lens Category Category (Maybe Text) (Maybe Text)
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)

-- | The ID of the skill store category.
category_categoryId :: Lens.Lens' Category (Prelude.Maybe Prelude.Natural)
category_categoryId :: (Maybe Natural -> f (Maybe Natural)) -> Category -> f Category
category_categoryId = (Category -> Maybe Natural)
-> (Category -> Maybe Natural -> Category)
-> Lens Category Category (Maybe Natural) (Maybe Natural)
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)

instance Core.FromJSON Category where
  parseJSON :: Value -> Parser Category
parseJSON =
    String -> (Object -> Parser Category) -> Value -> Parser Category
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Category"
      ( \Object
x ->
          Maybe Text -> Maybe Natural -> Category
Category'
            (Maybe Text -> Maybe Natural -> Category)
-> Parser (Maybe Text) -> Parser (Maybe Natural -> Category)
forall (f :: * -> *) a b. Functor 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
"CategoryName")
            Parser (Maybe Natural -> Category)
-> Parser (Maybe Natural) -> Parser Category
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CategoryId")
      )

instance Prelude.Hashable Category

instance Prelude.NFData Category