{-# 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.MigrationHubStrategy.Types.AppUnitError
-- 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.MigrationHubStrategy.Types.AppUnitError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types.AppUnitErrorCategory
import qualified Amazonka.Prelude as Prelude

-- | Error in the analysis of the application unit.
--
-- /See:/ 'newAppUnitError' smart constructor.
data AppUnitError = AppUnitError'
  { -- | The category of the error.
    AppUnitError -> Maybe AppUnitErrorCategory
appUnitErrorCategory :: Prelude.Maybe AppUnitErrorCategory
  }
  deriving (AppUnitError -> AppUnitError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppUnitError -> AppUnitError -> Bool
$c/= :: AppUnitError -> AppUnitError -> Bool
== :: AppUnitError -> AppUnitError -> Bool
$c== :: AppUnitError -> AppUnitError -> Bool
Prelude.Eq, ReadPrec [AppUnitError]
ReadPrec AppUnitError
Int -> ReadS AppUnitError
ReadS [AppUnitError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppUnitError]
$creadListPrec :: ReadPrec [AppUnitError]
readPrec :: ReadPrec AppUnitError
$creadPrec :: ReadPrec AppUnitError
readList :: ReadS [AppUnitError]
$creadList :: ReadS [AppUnitError]
readsPrec :: Int -> ReadS AppUnitError
$creadsPrec :: Int -> ReadS AppUnitError
Prelude.Read, Int -> AppUnitError -> ShowS
[AppUnitError] -> ShowS
AppUnitError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppUnitError] -> ShowS
$cshowList :: [AppUnitError] -> ShowS
show :: AppUnitError -> String
$cshow :: AppUnitError -> String
showsPrec :: Int -> AppUnitError -> ShowS
$cshowsPrec :: Int -> AppUnitError -> ShowS
Prelude.Show, forall x. Rep AppUnitError x -> AppUnitError
forall x. AppUnitError -> Rep AppUnitError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppUnitError x -> AppUnitError
$cfrom :: forall x. AppUnitError -> Rep AppUnitError x
Prelude.Generic)

-- |
-- Create a value of 'AppUnitError' 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:
--
-- 'appUnitErrorCategory', 'appUnitError_appUnitErrorCategory' - The category of the error.
newAppUnitError ::
  AppUnitError
newAppUnitError :: AppUnitError
newAppUnitError =
  AppUnitError'
    { $sel:appUnitErrorCategory:AppUnitError' :: Maybe AppUnitErrorCategory
appUnitErrorCategory =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The category of the error.
appUnitError_appUnitErrorCategory :: Lens.Lens' AppUnitError (Prelude.Maybe AppUnitErrorCategory)
appUnitError_appUnitErrorCategory :: Lens' AppUnitError (Maybe AppUnitErrorCategory)
appUnitError_appUnitErrorCategory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppUnitError' {Maybe AppUnitErrorCategory
appUnitErrorCategory :: Maybe AppUnitErrorCategory
$sel:appUnitErrorCategory:AppUnitError' :: AppUnitError -> Maybe AppUnitErrorCategory
appUnitErrorCategory} -> Maybe AppUnitErrorCategory
appUnitErrorCategory) (\s :: AppUnitError
s@AppUnitError' {} Maybe AppUnitErrorCategory
a -> AppUnitError
s {$sel:appUnitErrorCategory:AppUnitError' :: Maybe AppUnitErrorCategory
appUnitErrorCategory = Maybe AppUnitErrorCategory
a} :: AppUnitError)

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

instance Prelude.Hashable AppUnitError where
  hashWithSalt :: Int -> AppUnitError -> Int
hashWithSalt Int
_salt AppUnitError' {Maybe AppUnitErrorCategory
appUnitErrorCategory :: Maybe AppUnitErrorCategory
$sel:appUnitErrorCategory:AppUnitError' :: AppUnitError -> Maybe AppUnitErrorCategory
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AppUnitErrorCategory
appUnitErrorCategory

instance Prelude.NFData AppUnitError where
  rnf :: AppUnitError -> ()
rnf AppUnitError' {Maybe AppUnitErrorCategory
appUnitErrorCategory :: Maybe AppUnitErrorCategory
$sel:appUnitErrorCategory:AppUnitError' :: AppUnitError -> Maybe AppUnitErrorCategory
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AppUnitErrorCategory
appUnitErrorCategory