{-# 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.Support.Types.SupportService
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Support.Types.SupportService 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
import Amazonka.Support.Types.Category

-- | Information about an Amazon Web Services service returned by the
-- DescribeServices operation.
--
-- /See:/ 'newSupportService' smart constructor.
data SupportService = SupportService'
  { -- | A list of categories that describe the type of support issue a case
    -- describes. Categories consist of a category name and a category code.
    -- Category names and codes are passed to Amazon Web Services Support when
    -- you call CreateCase.
    SupportService -> Maybe [Category]
categories :: Prelude.Maybe [Category],
    -- | The code for an Amazon Web Services service returned by the
    -- DescribeServices response. The @name@ element contains the corresponding
    -- friendly name.
    SupportService -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | The friendly name for an Amazon Web Services service. The @code@ element
    -- contains the corresponding code.
    SupportService -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (SupportService -> SupportService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SupportService -> SupportService -> Bool
$c/= :: SupportService -> SupportService -> Bool
== :: SupportService -> SupportService -> Bool
$c== :: SupportService -> SupportService -> Bool
Prelude.Eq, ReadPrec [SupportService]
ReadPrec SupportService
Int -> ReadS SupportService
ReadS [SupportService]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SupportService]
$creadListPrec :: ReadPrec [SupportService]
readPrec :: ReadPrec SupportService
$creadPrec :: ReadPrec SupportService
readList :: ReadS [SupportService]
$creadList :: ReadS [SupportService]
readsPrec :: Int -> ReadS SupportService
$creadsPrec :: Int -> ReadS SupportService
Prelude.Read, Int -> SupportService -> ShowS
[SupportService] -> ShowS
SupportService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SupportService] -> ShowS
$cshowList :: [SupportService] -> ShowS
show :: SupportService -> String
$cshow :: SupportService -> String
showsPrec :: Int -> SupportService -> ShowS
$cshowsPrec :: Int -> SupportService -> ShowS
Prelude.Show, forall x. Rep SupportService x -> SupportService
forall x. SupportService -> Rep SupportService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SupportService x -> SupportService
$cfrom :: forall x. SupportService -> Rep SupportService x
Prelude.Generic)

-- |
-- Create a value of 'SupportService' 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:
--
-- 'categories', 'supportService_categories' - A list of categories that describe the type of support issue a case
-- describes. Categories consist of a category name and a category code.
-- Category names and codes are passed to Amazon Web Services Support when
-- you call CreateCase.
--
-- 'code', 'supportService_code' - The code for an Amazon Web Services service returned by the
-- DescribeServices response. The @name@ element contains the corresponding
-- friendly name.
--
-- 'name', 'supportService_name' - The friendly name for an Amazon Web Services service. The @code@ element
-- contains the corresponding code.
newSupportService ::
  SupportService
newSupportService :: SupportService
newSupportService =
  SupportService'
    { $sel:categories:SupportService' :: Maybe [Category]
categories = forall a. Maybe a
Prelude.Nothing,
      $sel:code:SupportService' :: Maybe Text
code = forall a. Maybe a
Prelude.Nothing,
      $sel:name:SupportService' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of categories that describe the type of support issue a case
-- describes. Categories consist of a category name and a category code.
-- Category names and codes are passed to Amazon Web Services Support when
-- you call CreateCase.
supportService_categories :: Lens.Lens' SupportService (Prelude.Maybe [Category])
supportService_categories :: Lens' SupportService (Maybe [Category])
supportService_categories = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SupportService' {Maybe [Category]
categories :: Maybe [Category]
$sel:categories:SupportService' :: SupportService -> Maybe [Category]
categories} -> Maybe [Category]
categories) (\s :: SupportService
s@SupportService' {} Maybe [Category]
a -> SupportService
s {$sel:categories:SupportService' :: Maybe [Category]
categories = Maybe [Category]
a} :: SupportService) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The code for an Amazon Web Services service returned by the
-- DescribeServices response. The @name@ element contains the corresponding
-- friendly name.
supportService_code :: Lens.Lens' SupportService (Prelude.Maybe Prelude.Text)
supportService_code :: Lens' SupportService (Maybe Text)
supportService_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SupportService' {Maybe Text
code :: Maybe Text
$sel:code:SupportService' :: SupportService -> Maybe Text
code} -> Maybe Text
code) (\s :: SupportService
s@SupportService' {} Maybe Text
a -> SupportService
s {$sel:code:SupportService' :: Maybe Text
code = Maybe Text
a} :: SupportService)

-- | The friendly name for an Amazon Web Services service. The @code@ element
-- contains the corresponding code.
supportService_name :: Lens.Lens' SupportService (Prelude.Maybe Prelude.Text)
supportService_name :: Lens' SupportService (Maybe Text)
supportService_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SupportService' {Maybe Text
name :: Maybe Text
$sel:name:SupportService' :: SupportService -> Maybe Text
name} -> Maybe Text
name) (\s :: SupportService
s@SupportService' {} Maybe Text
a -> SupportService
s {$sel:name:SupportService' :: Maybe Text
name = Maybe Text
a} :: SupportService)

instance Data.FromJSON SupportService where
  parseJSON :: Value -> Parser SupportService
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SupportService"
      ( \Object
x ->
          Maybe [Category] -> Maybe Text -> Maybe Text -> SupportService
SupportService'
            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
"categories" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"code")
            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
"name")
      )

instance Prelude.Hashable SupportService where
  hashWithSalt :: Int -> SupportService -> Int
hashWithSalt Int
_salt SupportService' {Maybe [Category]
Maybe Text
name :: Maybe Text
code :: Maybe Text
categories :: Maybe [Category]
$sel:name:SupportService' :: SupportService -> Maybe Text
$sel:code:SupportService' :: SupportService -> Maybe Text
$sel:categories:SupportService' :: SupportService -> Maybe [Category]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Category]
categories
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData SupportService where
  rnf :: SupportService -> ()
rnf SupportService' {Maybe [Category]
Maybe Text
name :: Maybe Text
code :: Maybe Text
categories :: Maybe [Category]
$sel:name:SupportService' :: SupportService -> Maybe Text
$sel:code:SupportService' :: SupportService -> Maybe Text
$sel:categories:SupportService' :: SupportService -> Maybe [Category]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Category]
categories
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
code
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name