{-# 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.NetworkEthereumAttributes
-- 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.NetworkEthereumAttributes 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

-- | Attributes of Ethereum for a network.
--
-- /See:/ 'newNetworkEthereumAttributes' smart constructor.
data NetworkEthereumAttributes = NetworkEthereumAttributes'
  { -- | The Ethereum @CHAIN_ID@ associated with the Ethereum network. Chain IDs
    -- are as follows:
    --
    -- -   mainnet = @1@
    --
    -- -   goerli = @5@
    --
    -- -   rinkeby = @4@
    --
    -- -   ropsten = @3@
    NetworkEthereumAttributes -> Maybe Text
chainId :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
$c/= :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
== :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
$c== :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
Prelude.Eq, ReadPrec [NetworkEthereumAttributes]
ReadPrec NetworkEthereumAttributes
Int -> ReadS NetworkEthereumAttributes
ReadS [NetworkEthereumAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkEthereumAttributes]
$creadListPrec :: ReadPrec [NetworkEthereumAttributes]
readPrec :: ReadPrec NetworkEthereumAttributes
$creadPrec :: ReadPrec NetworkEthereumAttributes
readList :: ReadS [NetworkEthereumAttributes]
$creadList :: ReadS [NetworkEthereumAttributes]
readsPrec :: Int -> ReadS NetworkEthereumAttributes
$creadsPrec :: Int -> ReadS NetworkEthereumAttributes
Prelude.Read, Int -> NetworkEthereumAttributes -> ShowS
[NetworkEthereumAttributes] -> ShowS
NetworkEthereumAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkEthereumAttributes] -> ShowS
$cshowList :: [NetworkEthereumAttributes] -> ShowS
show :: NetworkEthereumAttributes -> String
$cshow :: NetworkEthereumAttributes -> String
showsPrec :: Int -> NetworkEthereumAttributes -> ShowS
$cshowsPrec :: Int -> NetworkEthereumAttributes -> ShowS
Prelude.Show, forall x.
Rep NetworkEthereumAttributes x -> NetworkEthereumAttributes
forall x.
NetworkEthereumAttributes -> Rep NetworkEthereumAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkEthereumAttributes x -> NetworkEthereumAttributes
$cfrom :: forall x.
NetworkEthereumAttributes -> Rep NetworkEthereumAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NetworkEthereumAttributes' 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:
--
-- 'chainId', 'networkEthereumAttributes_chainId' - The Ethereum @CHAIN_ID@ associated with the Ethereum network. Chain IDs
-- are as follows:
--
-- -   mainnet = @1@
--
-- -   goerli = @5@
--
-- -   rinkeby = @4@
--
-- -   ropsten = @3@
newNetworkEthereumAttributes ::
  NetworkEthereumAttributes
newNetworkEthereumAttributes :: NetworkEthereumAttributes
newNetworkEthereumAttributes =
  NetworkEthereumAttributes'
    { $sel:chainId:NetworkEthereumAttributes' :: Maybe Text
chainId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The Ethereum @CHAIN_ID@ associated with the Ethereum network. Chain IDs
-- are as follows:
--
-- -   mainnet = @1@
--
-- -   goerli = @5@
--
-- -   rinkeby = @4@
--
-- -   ropsten = @3@
networkEthereumAttributes_chainId :: Lens.Lens' NetworkEthereumAttributes (Prelude.Maybe Prelude.Text)
networkEthereumAttributes_chainId :: Lens' NetworkEthereumAttributes (Maybe Text)
networkEthereumAttributes_chainId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkEthereumAttributes' {Maybe Text
chainId :: Maybe Text
$sel:chainId:NetworkEthereumAttributes' :: NetworkEthereumAttributes -> Maybe Text
chainId} -> Maybe Text
chainId) (\s :: NetworkEthereumAttributes
s@NetworkEthereumAttributes' {} Maybe Text
a -> NetworkEthereumAttributes
s {$sel:chainId:NetworkEthereumAttributes' :: Maybe Text
chainId = Maybe Text
a} :: NetworkEthereumAttributes)

instance Data.FromJSON NetworkEthereumAttributes where
  parseJSON :: Value -> Parser NetworkEthereumAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkEthereumAttributes"
      ( \Object
x ->
          Maybe Text -> NetworkEthereumAttributes
NetworkEthereumAttributes'
            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
"ChainId")
      )

instance Prelude.Hashable NetworkEthereumAttributes where
  hashWithSalt :: Int -> NetworkEthereumAttributes -> Int
hashWithSalt Int
_salt NetworkEthereumAttributes' {Maybe Text
chainId :: Maybe Text
$sel:chainId:NetworkEthereumAttributes' :: NetworkEthereumAttributes -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
chainId

instance Prelude.NFData NetworkEthereumAttributes where
  rnf :: NetworkEthereumAttributes -> ()
rnf NetworkEthereumAttributes' {Maybe Text
chainId :: Maybe Text
$sel:chainId:NetworkEthereumAttributes' :: NetworkEthereumAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
chainId