{-# 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.Amplify.Types.ProductionBranch
-- 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.Amplify.Types.ProductionBranch 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

-- | Describes the information about a production branch for an Amplify app.
--
-- /See:/ 'newProductionBranch' smart constructor.
data ProductionBranch = ProductionBranch'
  { -- | The branch name for the production branch.
    ProductionBranch -> Maybe Text
branchName :: Prelude.Maybe Prelude.Text,
    -- | The last deploy time of the production branch.
    ProductionBranch -> Maybe POSIX
lastDeployTime :: Prelude.Maybe Data.POSIX,
    -- | The status of the production branch.
    ProductionBranch -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The thumbnail URL for the production branch.
    ProductionBranch -> Maybe Text
thumbnailUrl :: Prelude.Maybe Prelude.Text
  }
  deriving (ProductionBranch -> ProductionBranch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductionBranch -> ProductionBranch -> Bool
$c/= :: ProductionBranch -> ProductionBranch -> Bool
== :: ProductionBranch -> ProductionBranch -> Bool
$c== :: ProductionBranch -> ProductionBranch -> Bool
Prelude.Eq, ReadPrec [ProductionBranch]
ReadPrec ProductionBranch
Int -> ReadS ProductionBranch
ReadS [ProductionBranch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductionBranch]
$creadListPrec :: ReadPrec [ProductionBranch]
readPrec :: ReadPrec ProductionBranch
$creadPrec :: ReadPrec ProductionBranch
readList :: ReadS [ProductionBranch]
$creadList :: ReadS [ProductionBranch]
readsPrec :: Int -> ReadS ProductionBranch
$creadsPrec :: Int -> ReadS ProductionBranch
Prelude.Read, Int -> ProductionBranch -> ShowS
[ProductionBranch] -> ShowS
ProductionBranch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductionBranch] -> ShowS
$cshowList :: [ProductionBranch] -> ShowS
show :: ProductionBranch -> String
$cshow :: ProductionBranch -> String
showsPrec :: Int -> ProductionBranch -> ShowS
$cshowsPrec :: Int -> ProductionBranch -> ShowS
Prelude.Show, forall x. Rep ProductionBranch x -> ProductionBranch
forall x. ProductionBranch -> Rep ProductionBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProductionBranch x -> ProductionBranch
$cfrom :: forall x. ProductionBranch -> Rep ProductionBranch x
Prelude.Generic)

-- |
-- Create a value of 'ProductionBranch' 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:
--
-- 'branchName', 'productionBranch_branchName' - The branch name for the production branch.
--
-- 'lastDeployTime', 'productionBranch_lastDeployTime' - The last deploy time of the production branch.
--
-- 'status', 'productionBranch_status' - The status of the production branch.
--
-- 'thumbnailUrl', 'productionBranch_thumbnailUrl' - The thumbnail URL for the production branch.
newProductionBranch ::
  ProductionBranch
newProductionBranch :: ProductionBranch
newProductionBranch =
  ProductionBranch'
    { $sel:branchName:ProductionBranch' :: Maybe Text
branchName = forall a. Maybe a
Prelude.Nothing,
      $sel:lastDeployTime:ProductionBranch' :: Maybe POSIX
lastDeployTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ProductionBranch' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:thumbnailUrl:ProductionBranch' :: Maybe Text
thumbnailUrl = forall a. Maybe a
Prelude.Nothing
    }

-- | The branch name for the production branch.
productionBranch_branchName :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.Text)
productionBranch_branchName :: Lens' ProductionBranch (Maybe Text)
productionBranch_branchName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe Text
branchName :: Maybe Text
$sel:branchName:ProductionBranch' :: ProductionBranch -> Maybe Text
branchName} -> Maybe Text
branchName) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe Text
a -> ProductionBranch
s {$sel:branchName:ProductionBranch' :: Maybe Text
branchName = Maybe Text
a} :: ProductionBranch)

-- | The last deploy time of the production branch.
productionBranch_lastDeployTime :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.UTCTime)
productionBranch_lastDeployTime :: Lens' ProductionBranch (Maybe UTCTime)
productionBranch_lastDeployTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe POSIX
lastDeployTime :: Maybe POSIX
$sel:lastDeployTime:ProductionBranch' :: ProductionBranch -> Maybe POSIX
lastDeployTime} -> Maybe POSIX
lastDeployTime) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe POSIX
a -> ProductionBranch
s {$sel:lastDeployTime:ProductionBranch' :: Maybe POSIX
lastDeployTime = Maybe POSIX
a} :: ProductionBranch) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of the production branch.
productionBranch_status :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.Text)
productionBranch_status :: Lens' ProductionBranch (Maybe Text)
productionBranch_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe Text
status :: Maybe Text
$sel:status:ProductionBranch' :: ProductionBranch -> Maybe Text
status} -> Maybe Text
status) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe Text
a -> ProductionBranch
s {$sel:status:ProductionBranch' :: Maybe Text
status = Maybe Text
a} :: ProductionBranch)

-- | The thumbnail URL for the production branch.
productionBranch_thumbnailUrl :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.Text)
productionBranch_thumbnailUrl :: Lens' ProductionBranch (Maybe Text)
productionBranch_thumbnailUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe Text
thumbnailUrl :: Maybe Text
$sel:thumbnailUrl:ProductionBranch' :: ProductionBranch -> Maybe Text
thumbnailUrl} -> Maybe Text
thumbnailUrl) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe Text
a -> ProductionBranch
s {$sel:thumbnailUrl:ProductionBranch' :: Maybe Text
thumbnailUrl = Maybe Text
a} :: ProductionBranch)

instance Data.FromJSON ProductionBranch where
  parseJSON :: Value -> Parser ProductionBranch
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProductionBranch"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX -> Maybe Text -> Maybe Text -> ProductionBranch
ProductionBranch'
            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
"branchName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastDeployTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"thumbnailUrl")
      )

instance Prelude.Hashable ProductionBranch where
  hashWithSalt :: Int -> ProductionBranch -> Int
hashWithSalt Int
_salt ProductionBranch' {Maybe Text
Maybe POSIX
thumbnailUrl :: Maybe Text
status :: Maybe Text
lastDeployTime :: Maybe POSIX
branchName :: Maybe Text
$sel:thumbnailUrl:ProductionBranch' :: ProductionBranch -> Maybe Text
$sel:status:ProductionBranch' :: ProductionBranch -> Maybe Text
$sel:lastDeployTime:ProductionBranch' :: ProductionBranch -> Maybe POSIX
$sel:branchName:ProductionBranch' :: ProductionBranch -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
branchName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastDeployTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thumbnailUrl

instance Prelude.NFData ProductionBranch where
  rnf :: ProductionBranch -> ()
rnf ProductionBranch' {Maybe Text
Maybe POSIX
thumbnailUrl :: Maybe Text
status :: Maybe Text
lastDeployTime :: Maybe POSIX
branchName :: Maybe Text
$sel:thumbnailUrl:ProductionBranch' :: ProductionBranch -> Maybe Text
$sel:status:ProductionBranch' :: ProductionBranch -> Maybe Text
$sel:lastDeployTime:ProductionBranch' :: ProductionBranch -> Maybe POSIX
$sel:branchName:ProductionBranch' :: ProductionBranch -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
branchName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastDeployTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thumbnailUrl