{-# 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.ManagedBlockChain.Types.NetworkFrameworkAttributes
-- 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.ManagedBlockChain.Types.NetworkFrameworkAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ManagedBlockChain.Types.NetworkEthereumAttributes
import Amazonka.ManagedBlockChain.Types.NetworkFabricAttributes
import qualified Amazonka.Prelude as Prelude

-- | Attributes relevant to the network for the blockchain framework that the
-- network uses.
--
-- /See:/ 'newNetworkFrameworkAttributes' smart constructor.
data NetworkFrameworkAttributes = NetworkFrameworkAttributes'
  { -- | Attributes of an Ethereum network for Managed Blockchain resources
    -- participating in an Ethereum network.
    NetworkFrameworkAttributes -> Maybe NetworkEthereumAttributes
ethereum :: Prelude.Maybe NetworkEthereumAttributes,
    -- | Attributes of Hyperledger Fabric for a Managed Blockchain network that
    -- uses Hyperledger Fabric.
    NetworkFrameworkAttributes -> Maybe NetworkFabricAttributes
fabric :: Prelude.Maybe NetworkFabricAttributes
  }
  deriving (NetworkFrameworkAttributes -> NetworkFrameworkAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkFrameworkAttributes -> NetworkFrameworkAttributes -> Bool
$c/= :: NetworkFrameworkAttributes -> NetworkFrameworkAttributes -> Bool
== :: NetworkFrameworkAttributes -> NetworkFrameworkAttributes -> Bool
$c== :: NetworkFrameworkAttributes -> NetworkFrameworkAttributes -> Bool
Prelude.Eq, ReadPrec [NetworkFrameworkAttributes]
ReadPrec NetworkFrameworkAttributes
Int -> ReadS NetworkFrameworkAttributes
ReadS [NetworkFrameworkAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkFrameworkAttributes]
$creadListPrec :: ReadPrec [NetworkFrameworkAttributes]
readPrec :: ReadPrec NetworkFrameworkAttributes
$creadPrec :: ReadPrec NetworkFrameworkAttributes
readList :: ReadS [NetworkFrameworkAttributes]
$creadList :: ReadS [NetworkFrameworkAttributes]
readsPrec :: Int -> ReadS NetworkFrameworkAttributes
$creadsPrec :: Int -> ReadS NetworkFrameworkAttributes
Prelude.Read, Int -> NetworkFrameworkAttributes -> ShowS
[NetworkFrameworkAttributes] -> ShowS
NetworkFrameworkAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkFrameworkAttributes] -> ShowS
$cshowList :: [NetworkFrameworkAttributes] -> ShowS
show :: NetworkFrameworkAttributes -> String
$cshow :: NetworkFrameworkAttributes -> String
showsPrec :: Int -> NetworkFrameworkAttributes -> ShowS
$cshowsPrec :: Int -> NetworkFrameworkAttributes -> ShowS
Prelude.Show, forall x.
Rep NetworkFrameworkAttributes x -> NetworkFrameworkAttributes
forall x.
NetworkFrameworkAttributes -> Rep NetworkFrameworkAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkFrameworkAttributes x -> NetworkFrameworkAttributes
$cfrom :: forall x.
NetworkFrameworkAttributes -> Rep NetworkFrameworkAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NetworkFrameworkAttributes' 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:
--
-- 'ethereum', 'networkFrameworkAttributes_ethereum' - Attributes of an Ethereum network for Managed Blockchain resources
-- participating in an Ethereum network.
--
-- 'fabric', 'networkFrameworkAttributes_fabric' - Attributes of Hyperledger Fabric for a Managed Blockchain network that
-- uses Hyperledger Fabric.
newNetworkFrameworkAttributes ::
  NetworkFrameworkAttributes
newNetworkFrameworkAttributes :: NetworkFrameworkAttributes
newNetworkFrameworkAttributes =
  NetworkFrameworkAttributes'
    { $sel:ethereum:NetworkFrameworkAttributes' :: Maybe NetworkEthereumAttributes
ethereum =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fabric:NetworkFrameworkAttributes' :: Maybe NetworkFabricAttributes
fabric = forall a. Maybe a
Prelude.Nothing
    }

-- | Attributes of an Ethereum network for Managed Blockchain resources
-- participating in an Ethereum network.
networkFrameworkAttributes_ethereum :: Lens.Lens' NetworkFrameworkAttributes (Prelude.Maybe NetworkEthereumAttributes)
networkFrameworkAttributes_ethereum :: Lens' NetworkFrameworkAttributes (Maybe NetworkEthereumAttributes)
networkFrameworkAttributes_ethereum = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkFrameworkAttributes' {Maybe NetworkEthereumAttributes
ethereum :: Maybe NetworkEthereumAttributes
$sel:ethereum:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkEthereumAttributes
ethereum} -> Maybe NetworkEthereumAttributes
ethereum) (\s :: NetworkFrameworkAttributes
s@NetworkFrameworkAttributes' {} Maybe NetworkEthereumAttributes
a -> NetworkFrameworkAttributes
s {$sel:ethereum:NetworkFrameworkAttributes' :: Maybe NetworkEthereumAttributes
ethereum = Maybe NetworkEthereumAttributes
a} :: NetworkFrameworkAttributes)

-- | Attributes of Hyperledger Fabric for a Managed Blockchain network that
-- uses Hyperledger Fabric.
networkFrameworkAttributes_fabric :: Lens.Lens' NetworkFrameworkAttributes (Prelude.Maybe NetworkFabricAttributes)
networkFrameworkAttributes_fabric :: Lens' NetworkFrameworkAttributes (Maybe NetworkFabricAttributes)
networkFrameworkAttributes_fabric = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkFrameworkAttributes' {Maybe NetworkFabricAttributes
fabric :: Maybe NetworkFabricAttributes
$sel:fabric:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkFabricAttributes
fabric} -> Maybe NetworkFabricAttributes
fabric) (\s :: NetworkFrameworkAttributes
s@NetworkFrameworkAttributes' {} Maybe NetworkFabricAttributes
a -> NetworkFrameworkAttributes
s {$sel:fabric:NetworkFrameworkAttributes' :: Maybe NetworkFabricAttributes
fabric = Maybe NetworkFabricAttributes
a} :: NetworkFrameworkAttributes)

instance Data.FromJSON NetworkFrameworkAttributes where
  parseJSON :: Value -> Parser NetworkFrameworkAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkFrameworkAttributes"
      ( \Object
x ->
          Maybe NetworkEthereumAttributes
-> Maybe NetworkFabricAttributes -> NetworkFrameworkAttributes
NetworkFrameworkAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Ethereum")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Fabric")
      )

instance Prelude.Hashable NetworkFrameworkAttributes where
  hashWithSalt :: Int -> NetworkFrameworkAttributes -> Int
hashWithSalt Int
_salt NetworkFrameworkAttributes' {Maybe NetworkEthereumAttributes
Maybe NetworkFabricAttributes
fabric :: Maybe NetworkFabricAttributes
ethereum :: Maybe NetworkEthereumAttributes
$sel:fabric:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkFabricAttributes
$sel:ethereum:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkEthereumAttributes
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NetworkEthereumAttributes
ethereum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NetworkFabricAttributes
fabric

instance Prelude.NFData NetworkFrameworkAttributes where
  rnf :: NetworkFrameworkAttributes -> ()
rnf NetworkFrameworkAttributes' {Maybe NetworkEthereumAttributes
Maybe NetworkFabricAttributes
fabric :: Maybe NetworkFabricAttributes
ethereum :: Maybe NetworkEthereumAttributes
$sel:fabric:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkFabricAttributes
$sel:ethereum:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkEthereumAttributes
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkEthereumAttributes
ethereum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkFabricAttributes
fabric