{-# 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.NetworkManager.Types.RouteAnalysisPath
-- 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.NetworkManager.Types.RouteAnalysisPath where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types.PathComponent
import Amazonka.NetworkManager.Types.RouteAnalysisCompletion
import qualified Amazonka.Prelude as Prelude

-- | Describes a route analysis path.
--
-- /See:/ 'newRouteAnalysisPath' smart constructor.
data RouteAnalysisPath = RouteAnalysisPath'
  { -- | The status of the analysis at completion.
    RouteAnalysisPath -> Maybe RouteAnalysisCompletion
completionStatus :: Prelude.Maybe RouteAnalysisCompletion,
    -- | The route analysis path.
    RouteAnalysisPath -> Maybe [PathComponent]
path :: Prelude.Maybe [PathComponent]
  }
  deriving (RouteAnalysisPath -> RouteAnalysisPath -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RouteAnalysisPath -> RouteAnalysisPath -> Bool
$c/= :: RouteAnalysisPath -> RouteAnalysisPath -> Bool
== :: RouteAnalysisPath -> RouteAnalysisPath -> Bool
$c== :: RouteAnalysisPath -> RouteAnalysisPath -> Bool
Prelude.Eq, ReadPrec [RouteAnalysisPath]
ReadPrec RouteAnalysisPath
Int -> ReadS RouteAnalysisPath
ReadS [RouteAnalysisPath]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RouteAnalysisPath]
$creadListPrec :: ReadPrec [RouteAnalysisPath]
readPrec :: ReadPrec RouteAnalysisPath
$creadPrec :: ReadPrec RouteAnalysisPath
readList :: ReadS [RouteAnalysisPath]
$creadList :: ReadS [RouteAnalysisPath]
readsPrec :: Int -> ReadS RouteAnalysisPath
$creadsPrec :: Int -> ReadS RouteAnalysisPath
Prelude.Read, Int -> RouteAnalysisPath -> ShowS
[RouteAnalysisPath] -> ShowS
RouteAnalysisPath -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RouteAnalysisPath] -> ShowS
$cshowList :: [RouteAnalysisPath] -> ShowS
show :: RouteAnalysisPath -> String
$cshow :: RouteAnalysisPath -> String
showsPrec :: Int -> RouteAnalysisPath -> ShowS
$cshowsPrec :: Int -> RouteAnalysisPath -> ShowS
Prelude.Show, forall x. Rep RouteAnalysisPath x -> RouteAnalysisPath
forall x. RouteAnalysisPath -> Rep RouteAnalysisPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RouteAnalysisPath x -> RouteAnalysisPath
$cfrom :: forall x. RouteAnalysisPath -> Rep RouteAnalysisPath x
Prelude.Generic)

-- |
-- Create a value of 'RouteAnalysisPath' 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:
--
-- 'completionStatus', 'routeAnalysisPath_completionStatus' - The status of the analysis at completion.
--
-- 'path', 'routeAnalysisPath_path' - The route analysis path.
newRouteAnalysisPath ::
  RouteAnalysisPath
newRouteAnalysisPath :: RouteAnalysisPath
newRouteAnalysisPath =
  RouteAnalysisPath'
    { $sel:completionStatus:RouteAnalysisPath' :: Maybe RouteAnalysisCompletion
completionStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:path:RouteAnalysisPath' :: Maybe [PathComponent]
path = forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the analysis at completion.
routeAnalysisPath_completionStatus :: Lens.Lens' RouteAnalysisPath (Prelude.Maybe RouteAnalysisCompletion)
routeAnalysisPath_completionStatus :: Lens' RouteAnalysisPath (Maybe RouteAnalysisCompletion)
routeAnalysisPath_completionStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteAnalysisPath' {Maybe RouteAnalysisCompletion
completionStatus :: Maybe RouteAnalysisCompletion
$sel:completionStatus:RouteAnalysisPath' :: RouteAnalysisPath -> Maybe RouteAnalysisCompletion
completionStatus} -> Maybe RouteAnalysisCompletion
completionStatus) (\s :: RouteAnalysisPath
s@RouteAnalysisPath' {} Maybe RouteAnalysisCompletion
a -> RouteAnalysisPath
s {$sel:completionStatus:RouteAnalysisPath' :: Maybe RouteAnalysisCompletion
completionStatus = Maybe RouteAnalysisCompletion
a} :: RouteAnalysisPath)

-- | The route analysis path.
routeAnalysisPath_path :: Lens.Lens' RouteAnalysisPath (Prelude.Maybe [PathComponent])
routeAnalysisPath_path :: Lens' RouteAnalysisPath (Maybe [PathComponent])
routeAnalysisPath_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteAnalysisPath' {Maybe [PathComponent]
path :: Maybe [PathComponent]
$sel:path:RouteAnalysisPath' :: RouteAnalysisPath -> Maybe [PathComponent]
path} -> Maybe [PathComponent]
path) (\s :: RouteAnalysisPath
s@RouteAnalysisPath' {} Maybe [PathComponent]
a -> RouteAnalysisPath
s {$sel:path:RouteAnalysisPath' :: Maybe [PathComponent]
path = Maybe [PathComponent]
a} :: RouteAnalysisPath) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON RouteAnalysisPath where
  parseJSON :: Value -> Parser RouteAnalysisPath
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RouteAnalysisPath"
      ( \Object
x ->
          Maybe RouteAnalysisCompletion
-> Maybe [PathComponent] -> RouteAnalysisPath
RouteAnalysisPath'
            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
"CompletionStatus")
            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
"Path" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable RouteAnalysisPath where
  hashWithSalt :: Int -> RouteAnalysisPath -> Int
hashWithSalt Int
_salt RouteAnalysisPath' {Maybe [PathComponent]
Maybe RouteAnalysisCompletion
path :: Maybe [PathComponent]
completionStatus :: Maybe RouteAnalysisCompletion
$sel:path:RouteAnalysisPath' :: RouteAnalysisPath -> Maybe [PathComponent]
$sel:completionStatus:RouteAnalysisPath' :: RouteAnalysisPath -> Maybe RouteAnalysisCompletion
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RouteAnalysisCompletion
completionStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PathComponent]
path

instance Prelude.NFData RouteAnalysisPath where
  rnf :: RouteAnalysisPath -> ()
rnf RouteAnalysisPath' {Maybe [PathComponent]
Maybe RouteAnalysisCompletion
path :: Maybe [PathComponent]
completionStatus :: Maybe RouteAnalysisCompletion
$sel:path:RouteAnalysisPath' :: RouteAnalysisPath -> Maybe [PathComponent]
$sel:completionStatus:RouteAnalysisPath' :: RouteAnalysisPath -> Maybe RouteAnalysisCompletion
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RouteAnalysisCompletion
completionStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PathComponent]
path