{-# 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.CodePipeline.Types.ActionTypeArtifactDetails
-- 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.CodePipeline.Types.ActionTypeArtifactDetails 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

-- | Information about parameters for artifacts associated with the action
-- type, such as the minimum and maximum artifacts allowed.
--
-- /See:/ 'newActionTypeArtifactDetails' smart constructor.
data ActionTypeArtifactDetails = ActionTypeArtifactDetails'
  { -- | The minimum number of artifacts that can be used with the action type.
    -- For example, you should specify a minimum and maximum of zero input
    -- artifacts for an action type with a category of @source@.
    ActionTypeArtifactDetails -> Natural
minimumCount :: Prelude.Natural,
    -- | The maximum number of artifacts that can be used with the actiontype.
    -- For example, you should specify a minimum and maximum of zero input
    -- artifacts for an action type with a category of @source@.
    ActionTypeArtifactDetails -> Natural
maximumCount :: Prelude.Natural
  }
  deriving (ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool
$c/= :: ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool
== :: ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool
$c== :: ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool
Prelude.Eq, ReadPrec [ActionTypeArtifactDetails]
ReadPrec ActionTypeArtifactDetails
Int -> ReadS ActionTypeArtifactDetails
ReadS [ActionTypeArtifactDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionTypeArtifactDetails]
$creadListPrec :: ReadPrec [ActionTypeArtifactDetails]
readPrec :: ReadPrec ActionTypeArtifactDetails
$creadPrec :: ReadPrec ActionTypeArtifactDetails
readList :: ReadS [ActionTypeArtifactDetails]
$creadList :: ReadS [ActionTypeArtifactDetails]
readsPrec :: Int -> ReadS ActionTypeArtifactDetails
$creadsPrec :: Int -> ReadS ActionTypeArtifactDetails
Prelude.Read, Int -> ActionTypeArtifactDetails -> ShowS
[ActionTypeArtifactDetails] -> ShowS
ActionTypeArtifactDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionTypeArtifactDetails] -> ShowS
$cshowList :: [ActionTypeArtifactDetails] -> ShowS
show :: ActionTypeArtifactDetails -> String
$cshow :: ActionTypeArtifactDetails -> String
showsPrec :: Int -> ActionTypeArtifactDetails -> ShowS
$cshowsPrec :: Int -> ActionTypeArtifactDetails -> ShowS
Prelude.Show, forall x.
Rep ActionTypeArtifactDetails x -> ActionTypeArtifactDetails
forall x.
ActionTypeArtifactDetails -> Rep ActionTypeArtifactDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActionTypeArtifactDetails x -> ActionTypeArtifactDetails
$cfrom :: forall x.
ActionTypeArtifactDetails -> Rep ActionTypeArtifactDetails x
Prelude.Generic)

-- |
-- Create a value of 'ActionTypeArtifactDetails' 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:
--
-- 'minimumCount', 'actionTypeArtifactDetails_minimumCount' - The minimum number of artifacts that can be used with the action type.
-- For example, you should specify a minimum and maximum of zero input
-- artifacts for an action type with a category of @source@.
--
-- 'maximumCount', 'actionTypeArtifactDetails_maximumCount' - The maximum number of artifacts that can be used with the actiontype.
-- For example, you should specify a minimum and maximum of zero input
-- artifacts for an action type with a category of @source@.
newActionTypeArtifactDetails ::
  -- | 'minimumCount'
  Prelude.Natural ->
  -- | 'maximumCount'
  Prelude.Natural ->
  ActionTypeArtifactDetails
newActionTypeArtifactDetails :: Natural -> Natural -> ActionTypeArtifactDetails
newActionTypeArtifactDetails
  Natural
pMinimumCount_
  Natural
pMaximumCount_ =
    ActionTypeArtifactDetails'
      { $sel:minimumCount:ActionTypeArtifactDetails' :: Natural
minimumCount =
          Natural
pMinimumCount_,
        $sel:maximumCount:ActionTypeArtifactDetails' :: Natural
maximumCount = Natural
pMaximumCount_
      }

-- | The minimum number of artifacts that can be used with the action type.
-- For example, you should specify a minimum and maximum of zero input
-- artifacts for an action type with a category of @source@.
actionTypeArtifactDetails_minimumCount :: Lens.Lens' ActionTypeArtifactDetails Prelude.Natural
actionTypeArtifactDetails_minimumCount :: Lens' ActionTypeArtifactDetails Natural
actionTypeArtifactDetails_minimumCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeArtifactDetails' {Natural
minimumCount :: Natural
$sel:minimumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
minimumCount} -> Natural
minimumCount) (\s :: ActionTypeArtifactDetails
s@ActionTypeArtifactDetails' {} Natural
a -> ActionTypeArtifactDetails
s {$sel:minimumCount:ActionTypeArtifactDetails' :: Natural
minimumCount = Natural
a} :: ActionTypeArtifactDetails)

-- | The maximum number of artifacts that can be used with the actiontype.
-- For example, you should specify a minimum and maximum of zero input
-- artifacts for an action type with a category of @source@.
actionTypeArtifactDetails_maximumCount :: Lens.Lens' ActionTypeArtifactDetails Prelude.Natural
actionTypeArtifactDetails_maximumCount :: Lens' ActionTypeArtifactDetails Natural
actionTypeArtifactDetails_maximumCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeArtifactDetails' {Natural
maximumCount :: Natural
$sel:maximumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
maximumCount} -> Natural
maximumCount) (\s :: ActionTypeArtifactDetails
s@ActionTypeArtifactDetails' {} Natural
a -> ActionTypeArtifactDetails
s {$sel:maximumCount:ActionTypeArtifactDetails' :: Natural
maximumCount = Natural
a} :: ActionTypeArtifactDetails)

instance Data.FromJSON ActionTypeArtifactDetails where
  parseJSON :: Value -> Parser ActionTypeArtifactDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionTypeArtifactDetails"
      ( \Object
x ->
          Natural -> Natural -> ActionTypeArtifactDetails
ActionTypeArtifactDetails'
            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
"minimumCount")
            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
"maximumCount")
      )

instance Prelude.Hashable ActionTypeArtifactDetails where
  hashWithSalt :: Int -> ActionTypeArtifactDetails -> Int
hashWithSalt Int
_salt ActionTypeArtifactDetails' {Natural
maximumCount :: Natural
minimumCount :: Natural
$sel:maximumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
$sel:minimumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
minimumCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maximumCount

instance Prelude.NFData ActionTypeArtifactDetails where
  rnf :: ActionTypeArtifactDetails -> ()
rnf ActionTypeArtifactDetails' {Natural
maximumCount :: Natural
minimumCount :: Natural
$sel:maximumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
$sel:minimumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
minimumCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maximumCount

instance Data.ToJSON ActionTypeArtifactDetails where
  toJSON :: ActionTypeArtifactDetails -> Value
toJSON ActionTypeArtifactDetails' {Natural
maximumCount :: Natural
minimumCount :: Natural
$sel:maximumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
$sel:minimumCount:ActionTypeArtifactDetails' :: ActionTypeArtifactDetails -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"minimumCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
minimumCount),
            forall a. a -> Maybe a
Prelude.Just (Key
"maximumCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maximumCount)
          ]
      )