{-# 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.CodeArtifact.Types.SuccessfulPackageVersionInfo
-- 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.CodeArtifact.Types.SuccessfulPackageVersionInfo where

import Amazonka.CodeArtifact.Types.PackageVersionStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the revision and status of a package version.
--
-- /See:/ 'newSuccessfulPackageVersionInfo' smart constructor.
data SuccessfulPackageVersionInfo = SuccessfulPackageVersionInfo'
  { -- | The status of a package version. Valid statuses are:
    --
    -- -   @Published@
    --
    -- -   @Unfinished@
    --
    -- -   @Unlisted@
    --
    -- -   @Archived@
    --
    -- -   @Disposed@
    SuccessfulPackageVersionInfo -> Maybe PackageVersionStatus
status :: Prelude.Maybe PackageVersionStatus,
    -- | The revision of a package version.
    SuccessfulPackageVersionInfo -> Maybe Text
revision :: Prelude.Maybe Prelude.Text
  }
  deriving (SuccessfulPackageVersionInfo
-> SuccessfulPackageVersionInfo -> Bool
(SuccessfulPackageVersionInfo
 -> SuccessfulPackageVersionInfo -> Bool)
-> (SuccessfulPackageVersionInfo
    -> SuccessfulPackageVersionInfo -> Bool)
-> Eq SuccessfulPackageVersionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuccessfulPackageVersionInfo
-> SuccessfulPackageVersionInfo -> Bool
$c/= :: SuccessfulPackageVersionInfo
-> SuccessfulPackageVersionInfo -> Bool
== :: SuccessfulPackageVersionInfo
-> SuccessfulPackageVersionInfo -> Bool
$c== :: SuccessfulPackageVersionInfo
-> SuccessfulPackageVersionInfo -> Bool
Prelude.Eq, ReadPrec [SuccessfulPackageVersionInfo]
ReadPrec SuccessfulPackageVersionInfo
Int -> ReadS SuccessfulPackageVersionInfo
ReadS [SuccessfulPackageVersionInfo]
(Int -> ReadS SuccessfulPackageVersionInfo)
-> ReadS [SuccessfulPackageVersionInfo]
-> ReadPrec SuccessfulPackageVersionInfo
-> ReadPrec [SuccessfulPackageVersionInfo]
-> Read SuccessfulPackageVersionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuccessfulPackageVersionInfo]
$creadListPrec :: ReadPrec [SuccessfulPackageVersionInfo]
readPrec :: ReadPrec SuccessfulPackageVersionInfo
$creadPrec :: ReadPrec SuccessfulPackageVersionInfo
readList :: ReadS [SuccessfulPackageVersionInfo]
$creadList :: ReadS [SuccessfulPackageVersionInfo]
readsPrec :: Int -> ReadS SuccessfulPackageVersionInfo
$creadsPrec :: Int -> ReadS SuccessfulPackageVersionInfo
Prelude.Read, Int -> SuccessfulPackageVersionInfo -> ShowS
[SuccessfulPackageVersionInfo] -> ShowS
SuccessfulPackageVersionInfo -> String
(Int -> SuccessfulPackageVersionInfo -> ShowS)
-> (SuccessfulPackageVersionInfo -> String)
-> ([SuccessfulPackageVersionInfo] -> ShowS)
-> Show SuccessfulPackageVersionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuccessfulPackageVersionInfo] -> ShowS
$cshowList :: [SuccessfulPackageVersionInfo] -> ShowS
show :: SuccessfulPackageVersionInfo -> String
$cshow :: SuccessfulPackageVersionInfo -> String
showsPrec :: Int -> SuccessfulPackageVersionInfo -> ShowS
$cshowsPrec :: Int -> SuccessfulPackageVersionInfo -> ShowS
Prelude.Show, (forall x.
 SuccessfulPackageVersionInfo -> Rep SuccessfulPackageVersionInfo x)
-> (forall x.
    Rep SuccessfulPackageVersionInfo x -> SuccessfulPackageVersionInfo)
-> Generic SuccessfulPackageVersionInfo
forall x.
Rep SuccessfulPackageVersionInfo x -> SuccessfulPackageVersionInfo
forall x.
SuccessfulPackageVersionInfo -> Rep SuccessfulPackageVersionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SuccessfulPackageVersionInfo x -> SuccessfulPackageVersionInfo
$cfrom :: forall x.
SuccessfulPackageVersionInfo -> Rep SuccessfulPackageVersionInfo x
Prelude.Generic)

-- |
-- Create a value of 'SuccessfulPackageVersionInfo' 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:
--
-- 'status', 'successfulPackageVersionInfo_status' - The status of a package version. Valid statuses are:
--
-- -   @Published@
--
-- -   @Unfinished@
--
-- -   @Unlisted@
--
-- -   @Archived@
--
-- -   @Disposed@
--
-- 'revision', 'successfulPackageVersionInfo_revision' - The revision of a package version.
newSuccessfulPackageVersionInfo ::
  SuccessfulPackageVersionInfo
newSuccessfulPackageVersionInfo :: SuccessfulPackageVersionInfo
newSuccessfulPackageVersionInfo =
  SuccessfulPackageVersionInfo' :: Maybe PackageVersionStatus
-> Maybe Text -> SuccessfulPackageVersionInfo
SuccessfulPackageVersionInfo'
    { $sel:status:SuccessfulPackageVersionInfo' :: Maybe PackageVersionStatus
status =
        Maybe PackageVersionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:revision:SuccessfulPackageVersionInfo' :: Maybe Text
revision = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of a package version. Valid statuses are:
--
-- -   @Published@
--
-- -   @Unfinished@
--
-- -   @Unlisted@
--
-- -   @Archived@
--
-- -   @Disposed@
successfulPackageVersionInfo_status :: Lens.Lens' SuccessfulPackageVersionInfo (Prelude.Maybe PackageVersionStatus)
successfulPackageVersionInfo_status :: (Maybe PackageVersionStatus -> f (Maybe PackageVersionStatus))
-> SuccessfulPackageVersionInfo -> f SuccessfulPackageVersionInfo
successfulPackageVersionInfo_status = (SuccessfulPackageVersionInfo -> Maybe PackageVersionStatus)
-> (SuccessfulPackageVersionInfo
    -> Maybe PackageVersionStatus -> SuccessfulPackageVersionInfo)
-> Lens
     SuccessfulPackageVersionInfo
     SuccessfulPackageVersionInfo
     (Maybe PackageVersionStatus)
     (Maybe PackageVersionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuccessfulPackageVersionInfo' {Maybe PackageVersionStatus
status :: Maybe PackageVersionStatus
$sel:status:SuccessfulPackageVersionInfo' :: SuccessfulPackageVersionInfo -> Maybe PackageVersionStatus
status} -> Maybe PackageVersionStatus
status) (\s :: SuccessfulPackageVersionInfo
s@SuccessfulPackageVersionInfo' {} Maybe PackageVersionStatus
a -> SuccessfulPackageVersionInfo
s {$sel:status:SuccessfulPackageVersionInfo' :: Maybe PackageVersionStatus
status = Maybe PackageVersionStatus
a} :: SuccessfulPackageVersionInfo)

-- | The revision of a package version.
successfulPackageVersionInfo_revision :: Lens.Lens' SuccessfulPackageVersionInfo (Prelude.Maybe Prelude.Text)
successfulPackageVersionInfo_revision :: (Maybe Text -> f (Maybe Text))
-> SuccessfulPackageVersionInfo -> f SuccessfulPackageVersionInfo
successfulPackageVersionInfo_revision = (SuccessfulPackageVersionInfo -> Maybe Text)
-> (SuccessfulPackageVersionInfo
    -> Maybe Text -> SuccessfulPackageVersionInfo)
-> Lens
     SuccessfulPackageVersionInfo
     SuccessfulPackageVersionInfo
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuccessfulPackageVersionInfo' {Maybe Text
revision :: Maybe Text
$sel:revision:SuccessfulPackageVersionInfo' :: SuccessfulPackageVersionInfo -> Maybe Text
revision} -> Maybe Text
revision) (\s :: SuccessfulPackageVersionInfo
s@SuccessfulPackageVersionInfo' {} Maybe Text
a -> SuccessfulPackageVersionInfo
s {$sel:revision:SuccessfulPackageVersionInfo' :: Maybe Text
revision = Maybe Text
a} :: SuccessfulPackageVersionInfo)

instance Core.FromJSON SuccessfulPackageVersionInfo where
  parseJSON :: Value -> Parser SuccessfulPackageVersionInfo
parseJSON =
    String
-> (Object -> Parser SuccessfulPackageVersionInfo)
-> Value
-> Parser SuccessfulPackageVersionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuccessfulPackageVersionInfo"
      ( \Object
x ->
          Maybe PackageVersionStatus
-> Maybe Text -> SuccessfulPackageVersionInfo
SuccessfulPackageVersionInfo'
            (Maybe PackageVersionStatus
 -> Maybe Text -> SuccessfulPackageVersionInfo)
-> Parser (Maybe PackageVersionStatus)
-> Parser (Maybe Text -> SuccessfulPackageVersionInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PackageVersionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser (Maybe Text -> SuccessfulPackageVersionInfo)
-> Parser (Maybe Text) -> Parser SuccessfulPackageVersionInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"revision")
      )

instance
  Prelude.Hashable
    SuccessfulPackageVersionInfo

instance Prelude.NFData SuccessfulPackageVersionInfo