{-# 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.Connect.Types.UseCase
-- 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.Connect.Types.UseCase where

import Amazonka.Connect.Types.UseCaseType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the use case.
--
-- /See:/ 'newUseCase' smart constructor.
data UseCase = UseCase'
  { -- | The type of use case to associate to the integration association. Each
    -- integration association can have only one of each use case type.
    UseCase -> Maybe UseCaseType
useCaseType :: Prelude.Maybe UseCaseType,
    -- | The Amazon Resource Name (ARN) for the use case.
    UseCase -> Maybe Text
useCaseArn :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the use case.
    UseCase -> Maybe Text
useCaseId :: Prelude.Maybe Prelude.Text
  }
  deriving (UseCase -> UseCase -> Bool
(UseCase -> UseCase -> Bool)
-> (UseCase -> UseCase -> Bool) -> Eq UseCase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UseCase -> UseCase -> Bool
$c/= :: UseCase -> UseCase -> Bool
== :: UseCase -> UseCase -> Bool
$c== :: UseCase -> UseCase -> Bool
Prelude.Eq, ReadPrec [UseCase]
ReadPrec UseCase
Int -> ReadS UseCase
ReadS [UseCase]
(Int -> ReadS UseCase)
-> ReadS [UseCase]
-> ReadPrec UseCase
-> ReadPrec [UseCase]
-> Read UseCase
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UseCase]
$creadListPrec :: ReadPrec [UseCase]
readPrec :: ReadPrec UseCase
$creadPrec :: ReadPrec UseCase
readList :: ReadS [UseCase]
$creadList :: ReadS [UseCase]
readsPrec :: Int -> ReadS UseCase
$creadsPrec :: Int -> ReadS UseCase
Prelude.Read, Int -> UseCase -> ShowS
[UseCase] -> ShowS
UseCase -> String
(Int -> UseCase -> ShowS)
-> (UseCase -> String) -> ([UseCase] -> ShowS) -> Show UseCase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UseCase] -> ShowS
$cshowList :: [UseCase] -> ShowS
show :: UseCase -> String
$cshow :: UseCase -> String
showsPrec :: Int -> UseCase -> ShowS
$cshowsPrec :: Int -> UseCase -> ShowS
Prelude.Show, (forall x. UseCase -> Rep UseCase x)
-> (forall x. Rep UseCase x -> UseCase) -> Generic UseCase
forall x. Rep UseCase x -> UseCase
forall x. UseCase -> Rep UseCase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UseCase x -> UseCase
$cfrom :: forall x. UseCase -> Rep UseCase x
Prelude.Generic)

-- |
-- Create a value of 'UseCase' 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:
--
-- 'useCaseType', 'useCase_useCaseType' - The type of use case to associate to the integration association. Each
-- integration association can have only one of each use case type.
--
-- 'useCaseArn', 'useCase_useCaseArn' - The Amazon Resource Name (ARN) for the use case.
--
-- 'useCaseId', 'useCase_useCaseId' - The identifier for the use case.
newUseCase ::
  UseCase
newUseCase :: UseCase
newUseCase =
  UseCase' :: Maybe UseCaseType -> Maybe Text -> Maybe Text -> UseCase
UseCase'
    { $sel:useCaseType:UseCase' :: Maybe UseCaseType
useCaseType = Maybe UseCaseType
forall a. Maybe a
Prelude.Nothing,
      $sel:useCaseArn:UseCase' :: Maybe Text
useCaseArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:useCaseId:UseCase' :: Maybe Text
useCaseId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of use case to associate to the integration association. Each
-- integration association can have only one of each use case type.
useCase_useCaseType :: Lens.Lens' UseCase (Prelude.Maybe UseCaseType)
useCase_useCaseType :: (Maybe UseCaseType -> f (Maybe UseCaseType))
-> UseCase -> f UseCase
useCase_useCaseType = (UseCase -> Maybe UseCaseType)
-> (UseCase -> Maybe UseCaseType -> UseCase)
-> Lens UseCase UseCase (Maybe UseCaseType) (Maybe UseCaseType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UseCase' {Maybe UseCaseType
useCaseType :: Maybe UseCaseType
$sel:useCaseType:UseCase' :: UseCase -> Maybe UseCaseType
useCaseType} -> Maybe UseCaseType
useCaseType) (\s :: UseCase
s@UseCase' {} Maybe UseCaseType
a -> UseCase
s {$sel:useCaseType:UseCase' :: Maybe UseCaseType
useCaseType = Maybe UseCaseType
a} :: UseCase)

-- | The Amazon Resource Name (ARN) for the use case.
useCase_useCaseArn :: Lens.Lens' UseCase (Prelude.Maybe Prelude.Text)
useCase_useCaseArn :: (Maybe Text -> f (Maybe Text)) -> UseCase -> f UseCase
useCase_useCaseArn = (UseCase -> Maybe Text)
-> (UseCase -> Maybe Text -> UseCase)
-> Lens UseCase UseCase (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UseCase' {Maybe Text
useCaseArn :: Maybe Text
$sel:useCaseArn:UseCase' :: UseCase -> Maybe Text
useCaseArn} -> Maybe Text
useCaseArn) (\s :: UseCase
s@UseCase' {} Maybe Text
a -> UseCase
s {$sel:useCaseArn:UseCase' :: Maybe Text
useCaseArn = Maybe Text
a} :: UseCase)

-- | The identifier for the use case.
useCase_useCaseId :: Lens.Lens' UseCase (Prelude.Maybe Prelude.Text)
useCase_useCaseId :: (Maybe Text -> f (Maybe Text)) -> UseCase -> f UseCase
useCase_useCaseId = (UseCase -> Maybe Text)
-> (UseCase -> Maybe Text -> UseCase)
-> Lens UseCase UseCase (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UseCase' {Maybe Text
useCaseId :: Maybe Text
$sel:useCaseId:UseCase' :: UseCase -> Maybe Text
useCaseId} -> Maybe Text
useCaseId) (\s :: UseCase
s@UseCase' {} Maybe Text
a -> UseCase
s {$sel:useCaseId:UseCase' :: Maybe Text
useCaseId = Maybe Text
a} :: UseCase)

instance Core.FromJSON UseCase where
  parseJSON :: Value -> Parser UseCase
parseJSON =
    String -> (Object -> Parser UseCase) -> Value -> Parser UseCase
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UseCase"
      ( \Object
x ->
          Maybe UseCaseType -> Maybe Text -> Maybe Text -> UseCase
UseCase'
            (Maybe UseCaseType -> Maybe Text -> Maybe Text -> UseCase)
-> Parser (Maybe UseCaseType)
-> Parser (Maybe Text -> Maybe Text -> UseCase)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe UseCaseType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UseCaseType")
            Parser (Maybe Text -> Maybe Text -> UseCase)
-> Parser (Maybe Text) -> Parser (Maybe Text -> UseCase)
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
"UseCaseArn")
            Parser (Maybe Text -> UseCase)
-> Parser (Maybe Text) -> Parser UseCase
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
"UseCaseId")
      )

instance Prelude.Hashable UseCase

instance Prelude.NFData UseCase