{-# 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.CloudDirectory.Types.TypedLinkSchemaAndFacetName
-- 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.CloudDirectory.Types.TypedLinkSchemaAndFacetName where

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

-- | Identifies the schema Amazon Resource Name (ARN) and facet name for the
-- typed link.
--
-- /See:/ 'newTypedLinkSchemaAndFacetName' smart constructor.
data TypedLinkSchemaAndFacetName = TypedLinkSchemaAndFacetName'
  { -- | The Amazon Resource Name (ARN) that is associated with the schema. For
    -- more information, see arns.
    TypedLinkSchemaAndFacetName -> Text
schemaArn :: Prelude.Text,
    -- | The unique name of the typed link facet.
    TypedLinkSchemaAndFacetName -> Text
typedLinkName :: Prelude.Text
  }
  deriving (TypedLinkSchemaAndFacetName -> TypedLinkSchemaAndFacetName -> Bool
(TypedLinkSchemaAndFacetName
 -> TypedLinkSchemaAndFacetName -> Bool)
-> (TypedLinkSchemaAndFacetName
    -> TypedLinkSchemaAndFacetName -> Bool)
-> Eq TypedLinkSchemaAndFacetName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedLinkSchemaAndFacetName -> TypedLinkSchemaAndFacetName -> Bool
$c/= :: TypedLinkSchemaAndFacetName -> TypedLinkSchemaAndFacetName -> Bool
== :: TypedLinkSchemaAndFacetName -> TypedLinkSchemaAndFacetName -> Bool
$c== :: TypedLinkSchemaAndFacetName -> TypedLinkSchemaAndFacetName -> Bool
Prelude.Eq, ReadPrec [TypedLinkSchemaAndFacetName]
ReadPrec TypedLinkSchemaAndFacetName
Int -> ReadS TypedLinkSchemaAndFacetName
ReadS [TypedLinkSchemaAndFacetName]
(Int -> ReadS TypedLinkSchemaAndFacetName)
-> ReadS [TypedLinkSchemaAndFacetName]
-> ReadPrec TypedLinkSchemaAndFacetName
-> ReadPrec [TypedLinkSchemaAndFacetName]
-> Read TypedLinkSchemaAndFacetName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedLinkSchemaAndFacetName]
$creadListPrec :: ReadPrec [TypedLinkSchemaAndFacetName]
readPrec :: ReadPrec TypedLinkSchemaAndFacetName
$creadPrec :: ReadPrec TypedLinkSchemaAndFacetName
readList :: ReadS [TypedLinkSchemaAndFacetName]
$creadList :: ReadS [TypedLinkSchemaAndFacetName]
readsPrec :: Int -> ReadS TypedLinkSchemaAndFacetName
$creadsPrec :: Int -> ReadS TypedLinkSchemaAndFacetName
Prelude.Read, Int -> TypedLinkSchemaAndFacetName -> ShowS
[TypedLinkSchemaAndFacetName] -> ShowS
TypedLinkSchemaAndFacetName -> String
(Int -> TypedLinkSchemaAndFacetName -> ShowS)
-> (TypedLinkSchemaAndFacetName -> String)
-> ([TypedLinkSchemaAndFacetName] -> ShowS)
-> Show TypedLinkSchemaAndFacetName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedLinkSchemaAndFacetName] -> ShowS
$cshowList :: [TypedLinkSchemaAndFacetName] -> ShowS
show :: TypedLinkSchemaAndFacetName -> String
$cshow :: TypedLinkSchemaAndFacetName -> String
showsPrec :: Int -> TypedLinkSchemaAndFacetName -> ShowS
$cshowsPrec :: Int -> TypedLinkSchemaAndFacetName -> ShowS
Prelude.Show, (forall x.
 TypedLinkSchemaAndFacetName -> Rep TypedLinkSchemaAndFacetName x)
-> (forall x.
    Rep TypedLinkSchemaAndFacetName x -> TypedLinkSchemaAndFacetName)
-> Generic TypedLinkSchemaAndFacetName
forall x.
Rep TypedLinkSchemaAndFacetName x -> TypedLinkSchemaAndFacetName
forall x.
TypedLinkSchemaAndFacetName -> Rep TypedLinkSchemaAndFacetName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TypedLinkSchemaAndFacetName x -> TypedLinkSchemaAndFacetName
$cfrom :: forall x.
TypedLinkSchemaAndFacetName -> Rep TypedLinkSchemaAndFacetName x
Prelude.Generic)

-- |
-- Create a value of 'TypedLinkSchemaAndFacetName' 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:
--
-- 'schemaArn', 'typedLinkSchemaAndFacetName_schemaArn' - The Amazon Resource Name (ARN) that is associated with the schema. For
-- more information, see arns.
--
-- 'typedLinkName', 'typedLinkSchemaAndFacetName_typedLinkName' - The unique name of the typed link facet.
newTypedLinkSchemaAndFacetName ::
  -- | 'schemaArn'
  Prelude.Text ->
  -- | 'typedLinkName'
  Prelude.Text ->
  TypedLinkSchemaAndFacetName
newTypedLinkSchemaAndFacetName :: Text -> Text -> TypedLinkSchemaAndFacetName
newTypedLinkSchemaAndFacetName
  Text
pSchemaArn_
  Text
pTypedLinkName_ =
    TypedLinkSchemaAndFacetName' :: Text -> Text -> TypedLinkSchemaAndFacetName
TypedLinkSchemaAndFacetName'
      { $sel:schemaArn:TypedLinkSchemaAndFacetName' :: Text
schemaArn =
          Text
pSchemaArn_,
        $sel:typedLinkName:TypedLinkSchemaAndFacetName' :: Text
typedLinkName = Text
pTypedLinkName_
      }

-- | The Amazon Resource Name (ARN) that is associated with the schema. For
-- more information, see arns.
typedLinkSchemaAndFacetName_schemaArn :: Lens.Lens' TypedLinkSchemaAndFacetName Prelude.Text
typedLinkSchemaAndFacetName_schemaArn :: (Text -> f Text)
-> TypedLinkSchemaAndFacetName -> f TypedLinkSchemaAndFacetName
typedLinkSchemaAndFacetName_schemaArn = (TypedLinkSchemaAndFacetName -> Text)
-> (TypedLinkSchemaAndFacetName
    -> Text -> TypedLinkSchemaAndFacetName)
-> Lens
     TypedLinkSchemaAndFacetName TypedLinkSchemaAndFacetName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkSchemaAndFacetName' {Text
schemaArn :: Text
$sel:schemaArn:TypedLinkSchemaAndFacetName' :: TypedLinkSchemaAndFacetName -> Text
schemaArn} -> Text
schemaArn) (\s :: TypedLinkSchemaAndFacetName
s@TypedLinkSchemaAndFacetName' {} Text
a -> TypedLinkSchemaAndFacetName
s {$sel:schemaArn:TypedLinkSchemaAndFacetName' :: Text
schemaArn = Text
a} :: TypedLinkSchemaAndFacetName)

-- | The unique name of the typed link facet.
typedLinkSchemaAndFacetName_typedLinkName :: Lens.Lens' TypedLinkSchemaAndFacetName Prelude.Text
typedLinkSchemaAndFacetName_typedLinkName :: (Text -> f Text)
-> TypedLinkSchemaAndFacetName -> f TypedLinkSchemaAndFacetName
typedLinkSchemaAndFacetName_typedLinkName = (TypedLinkSchemaAndFacetName -> Text)
-> (TypedLinkSchemaAndFacetName
    -> Text -> TypedLinkSchemaAndFacetName)
-> Lens
     TypedLinkSchemaAndFacetName TypedLinkSchemaAndFacetName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkSchemaAndFacetName' {Text
typedLinkName :: Text
$sel:typedLinkName:TypedLinkSchemaAndFacetName' :: TypedLinkSchemaAndFacetName -> Text
typedLinkName} -> Text
typedLinkName) (\s :: TypedLinkSchemaAndFacetName
s@TypedLinkSchemaAndFacetName' {} Text
a -> TypedLinkSchemaAndFacetName
s {$sel:typedLinkName:TypedLinkSchemaAndFacetName' :: Text
typedLinkName = Text
a} :: TypedLinkSchemaAndFacetName)

instance Core.FromJSON TypedLinkSchemaAndFacetName where
  parseJSON :: Value -> Parser TypedLinkSchemaAndFacetName
parseJSON =
    String
-> (Object -> Parser TypedLinkSchemaAndFacetName)
-> Value
-> Parser TypedLinkSchemaAndFacetName
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TypedLinkSchemaAndFacetName"
      ( \Object
x ->
          Text -> Text -> TypedLinkSchemaAndFacetName
TypedLinkSchemaAndFacetName'
            (Text -> Text -> TypedLinkSchemaAndFacetName)
-> Parser Text -> Parser (Text -> TypedLinkSchemaAndFacetName)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SchemaArn")
            Parser (Text -> TypedLinkSchemaAndFacetName)
-> Parser Text -> Parser TypedLinkSchemaAndFacetName
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TypedLinkName")
      )

instance Prelude.Hashable TypedLinkSchemaAndFacetName

instance Prelude.NFData TypedLinkSchemaAndFacetName

instance Core.ToJSON TypedLinkSchemaAndFacetName where
  toJSON :: TypedLinkSchemaAndFacetName -> Value
toJSON TypedLinkSchemaAndFacetName' {Text
typedLinkName :: Text
schemaArn :: Text
$sel:typedLinkName:TypedLinkSchemaAndFacetName' :: TypedLinkSchemaAndFacetName -> Text
$sel:schemaArn:TypedLinkSchemaAndFacetName' :: TypedLinkSchemaAndFacetName -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SchemaArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
schemaArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TypedLinkName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
typedLinkName)
          ]
      )