{-# 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-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.Support.Types.SupportService where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Support.Types.Category

-- | Information about an AWS 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 AWS Support when you call
    -- CreateCase.
    SupportService -> Maybe [Category]
categories :: Prelude.Maybe [Category],
    -- | The friendly name for an AWS service. The @code@ element contains the
    -- corresponding code.
    SupportService -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The code for an AWS service returned by the DescribeServices response.
    -- The @name@ element contains the corresponding friendly name.
    SupportService -> Maybe Text
code :: Prelude.Maybe Prelude.Text
  }
  deriving (SupportService -> SupportService -> Bool
(SupportService -> SupportService -> Bool)
-> (SupportService -> SupportService -> Bool) -> Eq SupportService
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]
(Int -> ReadS SupportService)
-> ReadS [SupportService]
-> ReadPrec SupportService
-> ReadPrec [SupportService]
-> Read 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
(Int -> SupportService -> ShowS)
-> (SupportService -> String)
-> ([SupportService] -> ShowS)
-> Show SupportService
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. SupportService -> Rep SupportService x)
-> (forall x. Rep SupportService x -> SupportService)
-> Generic SupportService
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 AWS Support when you call
-- CreateCase.
--
-- 'name', 'supportService_name' - The friendly name for an AWS service. The @code@ element contains the
-- corresponding code.
--
-- 'code', 'supportService_code' - The code for an AWS service returned by the DescribeServices response.
-- The @name@ element contains the corresponding friendly name.
newSupportService ::
  SupportService
newSupportService :: SupportService
newSupportService =
  SupportService' :: Maybe [Category] -> Maybe Text -> Maybe Text -> SupportService
SupportService'
    { $sel:categories:SupportService' :: Maybe [Category]
categories = Maybe [Category]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SupportService' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:code:SupportService' :: Maybe Text
code = Maybe Text
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 AWS Support when you call
-- CreateCase.
supportService_categories :: Lens.Lens' SupportService (Prelude.Maybe [Category])
supportService_categories :: (Maybe [Category] -> f (Maybe [Category]))
-> SupportService -> f SupportService
supportService_categories = (SupportService -> Maybe [Category])
-> (SupportService -> Maybe [Category] -> SupportService)
-> Lens
     SupportService SupportService (Maybe [Category]) (Maybe [Category])
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) ((Maybe [Category] -> f (Maybe [Category]))
 -> SupportService -> f SupportService)
-> ((Maybe [Category] -> f (Maybe [Category]))
    -> Maybe [Category] -> f (Maybe [Category]))
-> (Maybe [Category] -> f (Maybe [Category]))
-> SupportService
-> f SupportService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Category] [Category] [Category] [Category]
-> Iso
     (Maybe [Category])
     (Maybe [Category])
     (Maybe [Category])
     (Maybe [Category])
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 AnIso [Category] [Category] [Category] [Category]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The friendly name for an AWS service. The @code@ element contains the
-- corresponding code.
supportService_name :: Lens.Lens' SupportService (Prelude.Maybe Prelude.Text)
supportService_name :: (Maybe Text -> f (Maybe Text))
-> SupportService -> f SupportService
supportService_name = (SupportService -> Maybe Text)
-> (SupportService -> Maybe Text -> SupportService)
-> Lens SupportService SupportService (Maybe Text) (Maybe Text)
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)

-- | The code for an AWS 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 :: (Maybe Text -> f (Maybe Text))
-> SupportService -> f SupportService
supportService_code = (SupportService -> Maybe Text)
-> (SupportService -> Maybe Text -> SupportService)
-> Lens SupportService SupportService (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable SupportService

instance Prelude.NFData SupportService