{-# 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.CognitoIdentityProvider.Types.ResourceServerScopeType
-- 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.CognitoIdentityProvider.Types.ResourceServerScopeType 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

-- | A resource server scope.
--
-- /See:/ 'newResourceServerScopeType' smart constructor.
data ResourceServerScopeType = ResourceServerScopeType'
  { -- | The name of the scope.
    ResourceServerScopeType -> Text
scopeName :: Prelude.Text,
    -- | A description of the scope.
    ResourceServerScopeType -> Text
scopeDescription :: Prelude.Text
  }
  deriving (ResourceServerScopeType -> ResourceServerScopeType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceServerScopeType -> ResourceServerScopeType -> Bool
$c/= :: ResourceServerScopeType -> ResourceServerScopeType -> Bool
== :: ResourceServerScopeType -> ResourceServerScopeType -> Bool
$c== :: ResourceServerScopeType -> ResourceServerScopeType -> Bool
Prelude.Eq, ReadPrec [ResourceServerScopeType]
ReadPrec ResourceServerScopeType
Int -> ReadS ResourceServerScopeType
ReadS [ResourceServerScopeType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceServerScopeType]
$creadListPrec :: ReadPrec [ResourceServerScopeType]
readPrec :: ReadPrec ResourceServerScopeType
$creadPrec :: ReadPrec ResourceServerScopeType
readList :: ReadS [ResourceServerScopeType]
$creadList :: ReadS [ResourceServerScopeType]
readsPrec :: Int -> ReadS ResourceServerScopeType
$creadsPrec :: Int -> ReadS ResourceServerScopeType
Prelude.Read, Int -> ResourceServerScopeType -> ShowS
[ResourceServerScopeType] -> ShowS
ResourceServerScopeType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceServerScopeType] -> ShowS
$cshowList :: [ResourceServerScopeType] -> ShowS
show :: ResourceServerScopeType -> String
$cshow :: ResourceServerScopeType -> String
showsPrec :: Int -> ResourceServerScopeType -> ShowS
$cshowsPrec :: Int -> ResourceServerScopeType -> ShowS
Prelude.Show, forall x. Rep ResourceServerScopeType x -> ResourceServerScopeType
forall x. ResourceServerScopeType -> Rep ResourceServerScopeType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceServerScopeType x -> ResourceServerScopeType
$cfrom :: forall x. ResourceServerScopeType -> Rep ResourceServerScopeType x
Prelude.Generic)

-- |
-- Create a value of 'ResourceServerScopeType' 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:
--
-- 'scopeName', 'resourceServerScopeType_scopeName' - The name of the scope.
--
-- 'scopeDescription', 'resourceServerScopeType_scopeDescription' - A description of the scope.
newResourceServerScopeType ::
  -- | 'scopeName'
  Prelude.Text ->
  -- | 'scopeDescription'
  Prelude.Text ->
  ResourceServerScopeType
newResourceServerScopeType :: Text -> Text -> ResourceServerScopeType
newResourceServerScopeType
  Text
pScopeName_
  Text
pScopeDescription_ =
    ResourceServerScopeType'
      { $sel:scopeName:ResourceServerScopeType' :: Text
scopeName = Text
pScopeName_,
        $sel:scopeDescription:ResourceServerScopeType' :: Text
scopeDescription = Text
pScopeDescription_
      }

-- | The name of the scope.
resourceServerScopeType_scopeName :: Lens.Lens' ResourceServerScopeType Prelude.Text
resourceServerScopeType_scopeName :: Lens' ResourceServerScopeType Text
resourceServerScopeType_scopeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceServerScopeType' {Text
scopeName :: Text
$sel:scopeName:ResourceServerScopeType' :: ResourceServerScopeType -> Text
scopeName} -> Text
scopeName) (\s :: ResourceServerScopeType
s@ResourceServerScopeType' {} Text
a -> ResourceServerScopeType
s {$sel:scopeName:ResourceServerScopeType' :: Text
scopeName = Text
a} :: ResourceServerScopeType)

-- | A description of the scope.
resourceServerScopeType_scopeDescription :: Lens.Lens' ResourceServerScopeType Prelude.Text
resourceServerScopeType_scopeDescription :: Lens' ResourceServerScopeType Text
resourceServerScopeType_scopeDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceServerScopeType' {Text
scopeDescription :: Text
$sel:scopeDescription:ResourceServerScopeType' :: ResourceServerScopeType -> Text
scopeDescription} -> Text
scopeDescription) (\s :: ResourceServerScopeType
s@ResourceServerScopeType' {} Text
a -> ResourceServerScopeType
s {$sel:scopeDescription:ResourceServerScopeType' :: Text
scopeDescription = Text
a} :: ResourceServerScopeType)

instance Data.FromJSON ResourceServerScopeType where
  parseJSON :: Value -> Parser ResourceServerScopeType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceServerScopeType"
      ( \Object
x ->
          Text -> Text -> ResourceServerScopeType
ResourceServerScopeType'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ScopeName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ScopeDescription")
      )

instance Prelude.Hashable ResourceServerScopeType where
  hashWithSalt :: Int -> ResourceServerScopeType -> Int
hashWithSalt Int
_salt ResourceServerScopeType' {Text
scopeDescription :: Text
scopeName :: Text
$sel:scopeDescription:ResourceServerScopeType' :: ResourceServerScopeType -> Text
$sel:scopeName:ResourceServerScopeType' :: ResourceServerScopeType -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
scopeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
scopeDescription

instance Prelude.NFData ResourceServerScopeType where
  rnf :: ResourceServerScopeType -> ()
rnf ResourceServerScopeType' {Text
scopeDescription :: Text
scopeName :: Text
$sel:scopeDescription:ResourceServerScopeType' :: ResourceServerScopeType -> Text
$sel:scopeName:ResourceServerScopeType' :: ResourceServerScopeType -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
scopeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
scopeDescription

instance Data.ToJSON ResourceServerScopeType where
  toJSON :: ResourceServerScopeType -> Value
toJSON ResourceServerScopeType' {Text
scopeDescription :: Text
scopeName :: Text
$sel:scopeDescription:ResourceServerScopeType' :: ResourceServerScopeType -> Text
$sel:scopeName:ResourceServerScopeType' :: ResourceServerScopeType -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"ScopeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
scopeName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ScopeDescription" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
scopeDescription)
          ]
      )