{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodePipeline.Types.ActionTypeArtifactDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool)
-> (ActionTypeArtifactDetails -> ActionTypeArtifactDetails -> Bool)
-> Eq ActionTypeArtifactDetails
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]
(Int -> ReadS ActionTypeArtifactDetails)
-> ReadS [ActionTypeArtifactDetails]
-> ReadPrec ActionTypeArtifactDetails
-> ReadPrec [ActionTypeArtifactDetails]
-> Read 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
(Int -> ActionTypeArtifactDetails -> ShowS)
-> (ActionTypeArtifactDetails -> String)
-> ([ActionTypeArtifactDetails] -> ShowS)
-> Show ActionTypeArtifactDetails
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.
 ActionTypeArtifactDetails -> Rep ActionTypeArtifactDetails x)
-> (forall x.
    Rep ActionTypeArtifactDetails x -> ActionTypeArtifactDetails)
-> Generic ActionTypeArtifactDetails
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' :: Natural -> Natural -> ActionTypeArtifactDetails
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 :: (Natural -> f Natural)
-> ActionTypeArtifactDetails -> f ActionTypeArtifactDetails
actionTypeArtifactDetails_minimumCount = (ActionTypeArtifactDetails -> Natural)
-> (ActionTypeArtifactDetails
    -> Natural -> ActionTypeArtifactDetails)
-> Lens
     ActionTypeArtifactDetails ActionTypeArtifactDetails Natural Natural
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 :: (Natural -> f Natural)
-> ActionTypeArtifactDetails -> f ActionTypeArtifactDetails
actionTypeArtifactDetails_maximumCount = (ActionTypeArtifactDetails -> Natural)
-> (ActionTypeArtifactDetails
    -> Natural -> ActionTypeArtifactDetails)
-> Lens
     ActionTypeArtifactDetails ActionTypeArtifactDetails Natural Natural
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 Core.FromJSON ActionTypeArtifactDetails where
  parseJSON :: Value -> Parser ActionTypeArtifactDetails
parseJSON =
    String
-> (Object -> Parser ActionTypeArtifactDetails)
-> Value
-> Parser ActionTypeArtifactDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionTypeArtifactDetails"
      ( \Object
x ->
          Natural -> Natural -> ActionTypeArtifactDetails
ActionTypeArtifactDetails'
            (Natural -> Natural -> ActionTypeArtifactDetails)
-> Parser Natural -> Parser (Natural -> ActionTypeArtifactDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"minimumCount")
            Parser (Natural -> ActionTypeArtifactDetails)
-> Parser Natural -> Parser ActionTypeArtifactDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"maximumCount")
      )

instance Prelude.Hashable ActionTypeArtifactDetails

instance Prelude.NFData ActionTypeArtifactDetails

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"minimumCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
minimumCount),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"maximumCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
maximumCount)
          ]
      )