{-# 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.TypedLinkAttributeDefinition
-- 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.TypedLinkAttributeDefinition where

import Amazonka.CloudDirectory.Types.FacetAttributeType
import Amazonka.CloudDirectory.Types.RequiredAttributeBehavior
import Amazonka.CloudDirectory.Types.Rule
import Amazonka.CloudDirectory.Types.TypedAttributeValue
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A typed link attribute definition.
--
-- /See:/ 'newTypedLinkAttributeDefinition' smart constructor.
data TypedLinkAttributeDefinition = TypedLinkAttributeDefinition'
  { -- | Validation rules that are attached to the attribute definition.
    TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
rules :: Prelude.Maybe (Prelude.HashMap Prelude.Text Rule),
    -- | The default value of the attribute (if configured).
    TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
defaultValue :: Prelude.Maybe TypedAttributeValue,
    -- | Whether the attribute is mutable or not.
    TypedLinkAttributeDefinition -> Maybe Bool
isImmutable :: Prelude.Maybe Prelude.Bool,
    -- | The unique name of the typed link attribute.
    TypedLinkAttributeDefinition -> Text
name :: Prelude.Text,
    -- | The type of the attribute.
    TypedLinkAttributeDefinition -> FacetAttributeType
type' :: FacetAttributeType,
    -- | The required behavior of the @TypedLinkAttributeDefinition@.
    TypedLinkAttributeDefinition -> RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
  }
  deriving (TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
(TypedLinkAttributeDefinition
 -> TypedLinkAttributeDefinition -> Bool)
-> (TypedLinkAttributeDefinition
    -> TypedLinkAttributeDefinition -> Bool)
-> Eq TypedLinkAttributeDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
$c/= :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
== :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
$c== :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
Prelude.Eq, ReadPrec [TypedLinkAttributeDefinition]
ReadPrec TypedLinkAttributeDefinition
Int -> ReadS TypedLinkAttributeDefinition
ReadS [TypedLinkAttributeDefinition]
(Int -> ReadS TypedLinkAttributeDefinition)
-> ReadS [TypedLinkAttributeDefinition]
-> ReadPrec TypedLinkAttributeDefinition
-> ReadPrec [TypedLinkAttributeDefinition]
-> Read TypedLinkAttributeDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedLinkAttributeDefinition]
$creadListPrec :: ReadPrec [TypedLinkAttributeDefinition]
readPrec :: ReadPrec TypedLinkAttributeDefinition
$creadPrec :: ReadPrec TypedLinkAttributeDefinition
readList :: ReadS [TypedLinkAttributeDefinition]
$creadList :: ReadS [TypedLinkAttributeDefinition]
readsPrec :: Int -> ReadS TypedLinkAttributeDefinition
$creadsPrec :: Int -> ReadS TypedLinkAttributeDefinition
Prelude.Read, Int -> TypedLinkAttributeDefinition -> ShowS
[TypedLinkAttributeDefinition] -> ShowS
TypedLinkAttributeDefinition -> String
(Int -> TypedLinkAttributeDefinition -> ShowS)
-> (TypedLinkAttributeDefinition -> String)
-> ([TypedLinkAttributeDefinition] -> ShowS)
-> Show TypedLinkAttributeDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedLinkAttributeDefinition] -> ShowS
$cshowList :: [TypedLinkAttributeDefinition] -> ShowS
show :: TypedLinkAttributeDefinition -> String
$cshow :: TypedLinkAttributeDefinition -> String
showsPrec :: Int -> TypedLinkAttributeDefinition -> ShowS
$cshowsPrec :: Int -> TypedLinkAttributeDefinition -> ShowS
Prelude.Show, (forall x.
 TypedLinkAttributeDefinition -> Rep TypedLinkAttributeDefinition x)
-> (forall x.
    Rep TypedLinkAttributeDefinition x -> TypedLinkAttributeDefinition)
-> Generic TypedLinkAttributeDefinition
forall x.
Rep TypedLinkAttributeDefinition x -> TypedLinkAttributeDefinition
forall x.
TypedLinkAttributeDefinition -> Rep TypedLinkAttributeDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TypedLinkAttributeDefinition x -> TypedLinkAttributeDefinition
$cfrom :: forall x.
TypedLinkAttributeDefinition -> Rep TypedLinkAttributeDefinition x
Prelude.Generic)

-- |
-- Create a value of 'TypedLinkAttributeDefinition' 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:
--
-- 'rules', 'typedLinkAttributeDefinition_rules' - Validation rules that are attached to the attribute definition.
--
-- 'defaultValue', 'typedLinkAttributeDefinition_defaultValue' - The default value of the attribute (if configured).
--
-- 'isImmutable', 'typedLinkAttributeDefinition_isImmutable' - Whether the attribute is mutable or not.
--
-- 'name', 'typedLinkAttributeDefinition_name' - The unique name of the typed link attribute.
--
-- 'type'', 'typedLinkAttributeDefinition_type' - The type of the attribute.
--
-- 'requiredBehavior', 'typedLinkAttributeDefinition_requiredBehavior' - The required behavior of the @TypedLinkAttributeDefinition@.
newTypedLinkAttributeDefinition ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  FacetAttributeType ->
  -- | 'requiredBehavior'
  RequiredAttributeBehavior ->
  TypedLinkAttributeDefinition
newTypedLinkAttributeDefinition :: Text
-> FacetAttributeType
-> RequiredAttributeBehavior
-> TypedLinkAttributeDefinition
newTypedLinkAttributeDefinition
  Text
pName_
  FacetAttributeType
pType_
  RequiredAttributeBehavior
pRequiredBehavior_ =
    TypedLinkAttributeDefinition' :: Maybe (HashMap Text Rule)
-> Maybe TypedAttributeValue
-> Maybe Bool
-> Text
-> FacetAttributeType
-> RequiredAttributeBehavior
-> TypedLinkAttributeDefinition
TypedLinkAttributeDefinition'
      { $sel:rules:TypedLinkAttributeDefinition' :: Maybe (HashMap Text Rule)
rules =
          Maybe (HashMap Text Rule)
forall a. Maybe a
Prelude.Nothing,
        $sel:defaultValue:TypedLinkAttributeDefinition' :: Maybe TypedAttributeValue
defaultValue = Maybe TypedAttributeValue
forall a. Maybe a
Prelude.Nothing,
        $sel:isImmutable:TypedLinkAttributeDefinition' :: Maybe Bool
isImmutable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:name:TypedLinkAttributeDefinition' :: Text
name = Text
pName_,
        $sel:type':TypedLinkAttributeDefinition' :: FacetAttributeType
type' = FacetAttributeType
pType_,
        $sel:requiredBehavior:TypedLinkAttributeDefinition' :: RequiredAttributeBehavior
requiredBehavior = RequiredAttributeBehavior
pRequiredBehavior_
      }

-- | Validation rules that are attached to the attribute definition.
typedLinkAttributeDefinition_rules :: Lens.Lens' TypedLinkAttributeDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Rule))
typedLinkAttributeDefinition_rules :: (Maybe (HashMap Text Rule) -> f (Maybe (HashMap Text Rule)))
-> TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition
typedLinkAttributeDefinition_rules = (TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule))
-> (TypedLinkAttributeDefinition
    -> Maybe (HashMap Text Rule) -> TypedLinkAttributeDefinition)
-> Lens
     TypedLinkAttributeDefinition
     TypedLinkAttributeDefinition
     (Maybe (HashMap Text Rule))
     (Maybe (HashMap Text Rule))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Maybe (HashMap Text Rule)
rules :: Maybe (HashMap Text Rule)
$sel:rules:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
rules} -> Maybe (HashMap Text Rule)
rules) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Maybe (HashMap Text Rule)
a -> TypedLinkAttributeDefinition
s {$sel:rules:TypedLinkAttributeDefinition' :: Maybe (HashMap Text Rule)
rules = Maybe (HashMap Text Rule)
a} :: TypedLinkAttributeDefinition) ((Maybe (HashMap Text Rule) -> f (Maybe (HashMap Text Rule)))
 -> TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition)
-> ((Maybe (HashMap Text Rule) -> f (Maybe (HashMap Text Rule)))
    -> Maybe (HashMap Text Rule) -> f (Maybe (HashMap Text Rule)))
-> (Maybe (HashMap Text Rule) -> f (Maybe (HashMap Text Rule)))
-> TypedLinkAttributeDefinition
-> f TypedLinkAttributeDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Rule)
  (HashMap Text Rule)
  (HashMap Text Rule)
  (HashMap Text Rule)
-> Iso
     (Maybe (HashMap Text Rule))
     (Maybe (HashMap Text Rule))
     (Maybe (HashMap Text Rule))
     (Maybe (HashMap Text Rule))
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
  (HashMap Text Rule)
  (HashMap Text Rule)
  (HashMap Text Rule)
  (HashMap Text Rule)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The default value of the attribute (if configured).
typedLinkAttributeDefinition_defaultValue :: Lens.Lens' TypedLinkAttributeDefinition (Prelude.Maybe TypedAttributeValue)
typedLinkAttributeDefinition_defaultValue :: (Maybe TypedAttributeValue -> f (Maybe TypedAttributeValue))
-> TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition
typedLinkAttributeDefinition_defaultValue = (TypedLinkAttributeDefinition -> Maybe TypedAttributeValue)
-> (TypedLinkAttributeDefinition
    -> Maybe TypedAttributeValue -> TypedLinkAttributeDefinition)
-> Lens
     TypedLinkAttributeDefinition
     TypedLinkAttributeDefinition
     (Maybe TypedAttributeValue)
     (Maybe TypedAttributeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Maybe TypedAttributeValue
defaultValue :: Maybe TypedAttributeValue
$sel:defaultValue:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
defaultValue} -> Maybe TypedAttributeValue
defaultValue) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Maybe TypedAttributeValue
a -> TypedLinkAttributeDefinition
s {$sel:defaultValue:TypedLinkAttributeDefinition' :: Maybe TypedAttributeValue
defaultValue = Maybe TypedAttributeValue
a} :: TypedLinkAttributeDefinition)

-- | Whether the attribute is mutable or not.
typedLinkAttributeDefinition_isImmutable :: Lens.Lens' TypedLinkAttributeDefinition (Prelude.Maybe Prelude.Bool)
typedLinkAttributeDefinition_isImmutable :: (Maybe Bool -> f (Maybe Bool))
-> TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition
typedLinkAttributeDefinition_isImmutable = (TypedLinkAttributeDefinition -> Maybe Bool)
-> (TypedLinkAttributeDefinition
    -> Maybe Bool -> TypedLinkAttributeDefinition)
-> Lens
     TypedLinkAttributeDefinition
     TypedLinkAttributeDefinition
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Maybe Bool
isImmutable :: Maybe Bool
$sel:isImmutable:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe Bool
isImmutable} -> Maybe Bool
isImmutable) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Maybe Bool
a -> TypedLinkAttributeDefinition
s {$sel:isImmutable:TypedLinkAttributeDefinition' :: Maybe Bool
isImmutable = Maybe Bool
a} :: TypedLinkAttributeDefinition)

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

-- | The type of the attribute.
typedLinkAttributeDefinition_type :: Lens.Lens' TypedLinkAttributeDefinition FacetAttributeType
typedLinkAttributeDefinition_type :: (FacetAttributeType -> f FacetAttributeType)
-> TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition
typedLinkAttributeDefinition_type = (TypedLinkAttributeDefinition -> FacetAttributeType)
-> (TypedLinkAttributeDefinition
    -> FacetAttributeType -> TypedLinkAttributeDefinition)
-> Lens
     TypedLinkAttributeDefinition
     TypedLinkAttributeDefinition
     FacetAttributeType
     FacetAttributeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {FacetAttributeType
type' :: FacetAttributeType
$sel:type':TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> FacetAttributeType
type'} -> FacetAttributeType
type') (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} FacetAttributeType
a -> TypedLinkAttributeDefinition
s {$sel:type':TypedLinkAttributeDefinition' :: FacetAttributeType
type' = FacetAttributeType
a} :: TypedLinkAttributeDefinition)

-- | The required behavior of the @TypedLinkAttributeDefinition@.
typedLinkAttributeDefinition_requiredBehavior :: Lens.Lens' TypedLinkAttributeDefinition RequiredAttributeBehavior
typedLinkAttributeDefinition_requiredBehavior :: (RequiredAttributeBehavior -> f RequiredAttributeBehavior)
-> TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition
typedLinkAttributeDefinition_requiredBehavior = (TypedLinkAttributeDefinition -> RequiredAttributeBehavior)
-> (TypedLinkAttributeDefinition
    -> RequiredAttributeBehavior -> TypedLinkAttributeDefinition)
-> Lens
     TypedLinkAttributeDefinition
     TypedLinkAttributeDefinition
     RequiredAttributeBehavior
     RequiredAttributeBehavior
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> RequiredAttributeBehavior
requiredBehavior} -> RequiredAttributeBehavior
requiredBehavior) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} RequiredAttributeBehavior
a -> TypedLinkAttributeDefinition
s {$sel:requiredBehavior:TypedLinkAttributeDefinition' :: RequiredAttributeBehavior
requiredBehavior = RequiredAttributeBehavior
a} :: TypedLinkAttributeDefinition)

instance Core.FromJSON TypedLinkAttributeDefinition where
  parseJSON :: Value -> Parser TypedLinkAttributeDefinition
parseJSON =
    String
-> (Object -> Parser TypedLinkAttributeDefinition)
-> Value
-> Parser TypedLinkAttributeDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TypedLinkAttributeDefinition"
      ( \Object
x ->
          Maybe (HashMap Text Rule)
-> Maybe TypedAttributeValue
-> Maybe Bool
-> Text
-> FacetAttributeType
-> RequiredAttributeBehavior
-> TypedLinkAttributeDefinition
TypedLinkAttributeDefinition'
            (Maybe (HashMap Text Rule)
 -> Maybe TypedAttributeValue
 -> Maybe Bool
 -> Text
 -> FacetAttributeType
 -> RequiredAttributeBehavior
 -> TypedLinkAttributeDefinition)
-> Parser (Maybe (HashMap Text Rule))
-> Parser
     (Maybe TypedAttributeValue
      -> Maybe Bool
      -> Text
      -> FacetAttributeType
      -> RequiredAttributeBehavior
      -> TypedLinkAttributeDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Rule)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rules" Parser (Maybe (Maybe (HashMap Text Rule)))
-> Maybe (HashMap Text Rule) -> Parser (Maybe (HashMap Text Rule))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Rule)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe TypedAttributeValue
   -> Maybe Bool
   -> Text
   -> FacetAttributeType
   -> RequiredAttributeBehavior
   -> TypedLinkAttributeDefinition)
-> Parser (Maybe TypedAttributeValue)
-> Parser
     (Maybe Bool
      -> Text
      -> FacetAttributeType
      -> RequiredAttributeBehavior
      -> TypedLinkAttributeDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TypedAttributeValue)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultValue")
            Parser
  (Maybe Bool
   -> Text
   -> FacetAttributeType
   -> RequiredAttributeBehavior
   -> TypedLinkAttributeDefinition)
-> Parser (Maybe Bool)
-> Parser
     (Text
      -> FacetAttributeType
      -> RequiredAttributeBehavior
      -> TypedLinkAttributeDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsImmutable")
            Parser
  (Text
   -> FacetAttributeType
   -> RequiredAttributeBehavior
   -> TypedLinkAttributeDefinition)
-> Parser Text
-> Parser
     (FacetAttributeType
      -> RequiredAttributeBehavior -> TypedLinkAttributeDefinition)
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
"Name")
            Parser
  (FacetAttributeType
   -> RequiredAttributeBehavior -> TypedLinkAttributeDefinition)
-> Parser FacetAttributeType
-> Parser
     (RequiredAttributeBehavior -> TypedLinkAttributeDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FacetAttributeType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
            Parser (RequiredAttributeBehavior -> TypedLinkAttributeDefinition)
-> Parser RequiredAttributeBehavior
-> Parser TypedLinkAttributeDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RequiredAttributeBehavior
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RequiredBehavior")
      )

instance
  Prelude.Hashable
    TypedLinkAttributeDefinition

instance Prelude.NFData TypedLinkAttributeDefinition

instance Core.ToJSON TypedLinkAttributeDefinition where
  toJSON :: TypedLinkAttributeDefinition -> Value
toJSON TypedLinkAttributeDefinition' {Maybe Bool
Maybe (HashMap Text Rule)
Maybe TypedAttributeValue
Text
FacetAttributeType
RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
type' :: FacetAttributeType
name :: Text
isImmutable :: Maybe Bool
defaultValue :: Maybe TypedAttributeValue
rules :: Maybe (HashMap Text Rule)
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> RequiredAttributeBehavior
$sel:type':TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> FacetAttributeType
$sel:name:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Text
$sel:isImmutable:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe Bool
$sel:defaultValue:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
$sel:rules:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Rules" Text -> HashMap Text Rule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Rule -> Pair)
-> Maybe (HashMap Text Rule) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Rule)
rules,
            (Text
"DefaultValue" Text -> TypedAttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TypedAttributeValue -> Pair)
-> Maybe TypedAttributeValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TypedAttributeValue
defaultValue,
            (Text
"IsImmutable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isImmutable,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> FacetAttributeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FacetAttributeType
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RequiredBehavior" Text -> RequiredAttributeBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RequiredAttributeBehavior
requiredBehavior)
          ]
      )