{-# 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.Inspector2.Types.Step
-- 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.Inspector2.Types.Step 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

-- | Details about the step associated with a finding.
--
-- /See:/ 'newStep' smart constructor.
data Step = Step'
  { -- | The component ID.
    Step -> Text
componentId :: Prelude.Text,
    -- | The component type.
    Step -> Text
componentType :: Prelude.Text
  }
  deriving (Step -> Step -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Step -> Step -> Bool
$c/= :: Step -> Step -> Bool
== :: Step -> Step -> Bool
$c== :: Step -> Step -> Bool
Prelude.Eq, ReadPrec [Step]
ReadPrec Step
Int -> ReadS Step
ReadS [Step]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Step]
$creadListPrec :: ReadPrec [Step]
readPrec :: ReadPrec Step
$creadPrec :: ReadPrec Step
readList :: ReadS [Step]
$creadList :: ReadS [Step]
readsPrec :: Int -> ReadS Step
$creadsPrec :: Int -> ReadS Step
Prelude.Read, Int -> Step -> ShowS
[Step] -> ShowS
Step -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Step] -> ShowS
$cshowList :: [Step] -> ShowS
show :: Step -> String
$cshow :: Step -> String
showsPrec :: Int -> Step -> ShowS
$cshowsPrec :: Int -> Step -> ShowS
Prelude.Show, forall x. Rep Step x -> Step
forall x. Step -> Rep Step x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Step x -> Step
$cfrom :: forall x. Step -> Rep Step x
Prelude.Generic)

-- |
-- Create a value of 'Step' 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:
--
-- 'componentId', 'step_componentId' - The component ID.
--
-- 'componentType', 'step_componentType' - The component type.
newStep ::
  -- | 'componentId'
  Prelude.Text ->
  -- | 'componentType'
  Prelude.Text ->
  Step
newStep :: Text -> Text -> Step
newStep Text
pComponentId_ Text
pComponentType_ =
  Step'
    { $sel:componentId:Step' :: Text
componentId = Text
pComponentId_,
      $sel:componentType:Step' :: Text
componentType = Text
pComponentType_
    }

-- | The component ID.
step_componentId :: Lens.Lens' Step Prelude.Text
step_componentId :: Lens' Step Text
step_componentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Text
componentId :: Text
$sel:componentId:Step' :: Step -> Text
componentId} -> Text
componentId) (\s :: Step
s@Step' {} Text
a -> Step
s {$sel:componentId:Step' :: Text
componentId = Text
a} :: Step)

-- | The component type.
step_componentType :: Lens.Lens' Step Prelude.Text
step_componentType :: Lens' Step Text
step_componentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Text
componentType :: Text
$sel:componentType:Step' :: Step -> Text
componentType} -> Text
componentType) (\s :: Step
s@Step' {} Text
a -> Step
s {$sel:componentType:Step' :: Text
componentType = Text
a} :: Step)

instance Data.FromJSON Step where
  parseJSON :: Value -> Parser Step
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Step"
      ( \Object
x ->
          Text -> Text -> Step
Step'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"componentId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"componentType")
      )

instance Prelude.Hashable Step where
  hashWithSalt :: Int -> Step -> Int
hashWithSalt Int
_salt Step' {Text
componentType :: Text
componentId :: Text
$sel:componentType:Step' :: Step -> Text
$sel:componentId:Step' :: Step -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentType

instance Prelude.NFData Step where
  rnf :: Step -> ()
rnf Step' {Text
componentType :: Text
componentId :: Text
$sel:componentType:Step' :: Step -> Text
$sel:componentId:Step' :: Step -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
componentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
componentType