{-# 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.Panorama.Types.NodeInterface
-- 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.Panorama.Types.NodeInterface where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Panorama.Types.NodeInputPort
import Amazonka.Panorama.Types.NodeOutputPort
import qualified Amazonka.Prelude as Prelude

-- | A node interface.
--
-- /See:/ 'newNodeInterface' smart constructor.
data NodeInterface = NodeInterface'
  { -- | The node interface\'s inputs.
    NodeInterface -> [NodeInputPort]
inputs :: [NodeInputPort],
    -- | The node interface\'s outputs.
    NodeInterface -> [NodeOutputPort]
outputs :: [NodeOutputPort]
  }
  deriving (NodeInterface -> NodeInterface -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeInterface -> NodeInterface -> Bool
$c/= :: NodeInterface -> NodeInterface -> Bool
== :: NodeInterface -> NodeInterface -> Bool
$c== :: NodeInterface -> NodeInterface -> Bool
Prelude.Eq, ReadPrec [NodeInterface]
ReadPrec NodeInterface
Int -> ReadS NodeInterface
ReadS [NodeInterface]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeInterface]
$creadListPrec :: ReadPrec [NodeInterface]
readPrec :: ReadPrec NodeInterface
$creadPrec :: ReadPrec NodeInterface
readList :: ReadS [NodeInterface]
$creadList :: ReadS [NodeInterface]
readsPrec :: Int -> ReadS NodeInterface
$creadsPrec :: Int -> ReadS NodeInterface
Prelude.Read, Int -> NodeInterface -> ShowS
[NodeInterface] -> ShowS
NodeInterface -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeInterface] -> ShowS
$cshowList :: [NodeInterface] -> ShowS
show :: NodeInterface -> String
$cshow :: NodeInterface -> String
showsPrec :: Int -> NodeInterface -> ShowS
$cshowsPrec :: Int -> NodeInterface -> ShowS
Prelude.Show, forall x. Rep NodeInterface x -> NodeInterface
forall x. NodeInterface -> Rep NodeInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeInterface x -> NodeInterface
$cfrom :: forall x. NodeInterface -> Rep NodeInterface x
Prelude.Generic)

-- |
-- Create a value of 'NodeInterface' 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:
--
-- 'inputs', 'nodeInterface_inputs' - The node interface\'s inputs.
--
-- 'outputs', 'nodeInterface_outputs' - The node interface\'s outputs.
newNodeInterface ::
  NodeInterface
newNodeInterface :: NodeInterface
newNodeInterface =
  NodeInterface'
    { $sel:inputs:NodeInterface' :: [NodeInputPort]
inputs = forall a. Monoid a => a
Prelude.mempty,
      $sel:outputs:NodeInterface' :: [NodeOutputPort]
outputs = forall a. Monoid a => a
Prelude.mempty
    }

-- | The node interface\'s inputs.
nodeInterface_inputs :: Lens.Lens' NodeInterface [NodeInputPort]
nodeInterface_inputs :: Lens' NodeInterface [NodeInputPort]
nodeInterface_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInterface' {[NodeInputPort]
inputs :: [NodeInputPort]
$sel:inputs:NodeInterface' :: NodeInterface -> [NodeInputPort]
inputs} -> [NodeInputPort]
inputs) (\s :: NodeInterface
s@NodeInterface' {} [NodeInputPort]
a -> NodeInterface
s {$sel:inputs:NodeInterface' :: [NodeInputPort]
inputs = [NodeInputPort]
a} :: NodeInterface) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The node interface\'s outputs.
nodeInterface_outputs :: Lens.Lens' NodeInterface [NodeOutputPort]
nodeInterface_outputs :: Lens' NodeInterface [NodeOutputPort]
nodeInterface_outputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInterface' {[NodeOutputPort]
outputs :: [NodeOutputPort]
$sel:outputs:NodeInterface' :: NodeInterface -> [NodeOutputPort]
outputs} -> [NodeOutputPort]
outputs) (\s :: NodeInterface
s@NodeInterface' {} [NodeOutputPort]
a -> NodeInterface
s {$sel:outputs:NodeInterface' :: [NodeOutputPort]
outputs = [NodeOutputPort]
a} :: NodeInterface) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON NodeInterface where
  parseJSON :: Value -> Parser NodeInterface
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NodeInterface"
      ( \Object
x ->
          [NodeInputPort] -> [NodeOutputPort] -> NodeInterface
NodeInterface'
            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
"Inputs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Outputs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable NodeInterface where
  hashWithSalt :: Int -> NodeInterface -> Int
hashWithSalt Int
_salt NodeInterface' {[NodeOutputPort]
[NodeInputPort]
outputs :: [NodeOutputPort]
inputs :: [NodeInputPort]
$sel:outputs:NodeInterface' :: NodeInterface -> [NodeOutputPort]
$sel:inputs:NodeInterface' :: NodeInterface -> [NodeInputPort]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [NodeInputPort]
inputs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [NodeOutputPort]
outputs

instance Prelude.NFData NodeInterface where
  rnf :: NodeInterface -> ()
rnf NodeInterface' {[NodeOutputPort]
[NodeInputPort]
outputs :: [NodeOutputPort]
inputs :: [NodeInputPort]
$sel:outputs:NodeInterface' :: NodeInterface -> [NodeOutputPort]
$sel:inputs:NodeInterface' :: NodeInterface -> [NodeInputPort]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [NodeInputPort]
inputs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [NodeOutputPort]
outputs