{-# 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.Proton.Types.RepositoryBranchInput
-- 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.Proton.Types.RepositoryBranchInput 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
import Amazonka.Proton.Types.RepositoryProvider

-- | Detail input data for a linked repository branch.
--
-- /See:/ 'newRepositoryBranchInput' smart constructor.
data RepositoryBranchInput = RepositoryBranchInput'
  { -- | The repository branch.
    RepositoryBranchInput -> Text
branch :: Prelude.Text,
    -- | The repository name.
    RepositoryBranchInput -> Text
name :: Prelude.Text,
    -- | The repository provider.
    RepositoryBranchInput -> RepositoryProvider
provider :: RepositoryProvider
  }
  deriving (RepositoryBranchInput -> RepositoryBranchInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryBranchInput -> RepositoryBranchInput -> Bool
$c/= :: RepositoryBranchInput -> RepositoryBranchInput -> Bool
== :: RepositoryBranchInput -> RepositoryBranchInput -> Bool
$c== :: RepositoryBranchInput -> RepositoryBranchInput -> Bool
Prelude.Eq, ReadPrec [RepositoryBranchInput]
ReadPrec RepositoryBranchInput
Int -> ReadS RepositoryBranchInput
ReadS [RepositoryBranchInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositoryBranchInput]
$creadListPrec :: ReadPrec [RepositoryBranchInput]
readPrec :: ReadPrec RepositoryBranchInput
$creadPrec :: ReadPrec RepositoryBranchInput
readList :: ReadS [RepositoryBranchInput]
$creadList :: ReadS [RepositoryBranchInput]
readsPrec :: Int -> ReadS RepositoryBranchInput
$creadsPrec :: Int -> ReadS RepositoryBranchInput
Prelude.Read, Int -> RepositoryBranchInput -> ShowS
[RepositoryBranchInput] -> ShowS
RepositoryBranchInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryBranchInput] -> ShowS
$cshowList :: [RepositoryBranchInput] -> ShowS
show :: RepositoryBranchInput -> String
$cshow :: RepositoryBranchInput -> String
showsPrec :: Int -> RepositoryBranchInput -> ShowS
$cshowsPrec :: Int -> RepositoryBranchInput -> ShowS
Prelude.Show, forall x. Rep RepositoryBranchInput x -> RepositoryBranchInput
forall x. RepositoryBranchInput -> Rep RepositoryBranchInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RepositoryBranchInput x -> RepositoryBranchInput
$cfrom :: forall x. RepositoryBranchInput -> Rep RepositoryBranchInput x
Prelude.Generic)

-- |
-- Create a value of 'RepositoryBranchInput' 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:
--
-- 'branch', 'repositoryBranchInput_branch' - The repository branch.
--
-- 'name', 'repositoryBranchInput_name' - The repository name.
--
-- 'provider', 'repositoryBranchInput_provider' - The repository provider.
newRepositoryBranchInput ::
  -- | 'branch'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'provider'
  RepositoryProvider ->
  RepositoryBranchInput
newRepositoryBranchInput :: Text -> Text -> RepositoryProvider -> RepositoryBranchInput
newRepositoryBranchInput Text
pBranch_ Text
pName_ RepositoryProvider
pProvider_ =
  RepositoryBranchInput'
    { $sel:branch:RepositoryBranchInput' :: Text
branch = Text
pBranch_,
      $sel:name:RepositoryBranchInput' :: Text
name = Text
pName_,
      $sel:provider:RepositoryBranchInput' :: RepositoryProvider
provider = RepositoryProvider
pProvider_
    }

-- | The repository branch.
repositoryBranchInput_branch :: Lens.Lens' RepositoryBranchInput Prelude.Text
repositoryBranchInput_branch :: Lens' RepositoryBranchInput Text
repositoryBranchInput_branch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryBranchInput' {Text
branch :: Text
$sel:branch:RepositoryBranchInput' :: RepositoryBranchInput -> Text
branch} -> Text
branch) (\s :: RepositoryBranchInput
s@RepositoryBranchInput' {} Text
a -> RepositoryBranchInput
s {$sel:branch:RepositoryBranchInput' :: Text
branch = Text
a} :: RepositoryBranchInput)

-- | The repository name.
repositoryBranchInput_name :: Lens.Lens' RepositoryBranchInput Prelude.Text
repositoryBranchInput_name :: Lens' RepositoryBranchInput Text
repositoryBranchInput_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryBranchInput' {Text
name :: Text
$sel:name:RepositoryBranchInput' :: RepositoryBranchInput -> Text
name} -> Text
name) (\s :: RepositoryBranchInput
s@RepositoryBranchInput' {} Text
a -> RepositoryBranchInput
s {$sel:name:RepositoryBranchInput' :: Text
name = Text
a} :: RepositoryBranchInput)

-- | The repository provider.
repositoryBranchInput_provider :: Lens.Lens' RepositoryBranchInput RepositoryProvider
repositoryBranchInput_provider :: Lens' RepositoryBranchInput RepositoryProvider
repositoryBranchInput_provider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryBranchInput' {RepositoryProvider
provider :: RepositoryProvider
$sel:provider:RepositoryBranchInput' :: RepositoryBranchInput -> RepositoryProvider
provider} -> RepositoryProvider
provider) (\s :: RepositoryBranchInput
s@RepositoryBranchInput' {} RepositoryProvider
a -> RepositoryBranchInput
s {$sel:provider:RepositoryBranchInput' :: RepositoryProvider
provider = RepositoryProvider
a} :: RepositoryBranchInput)

instance Prelude.Hashable RepositoryBranchInput where
  hashWithSalt :: Int -> RepositoryBranchInput -> Int
hashWithSalt Int
_salt RepositoryBranchInput' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
branch :: Text
$sel:provider:RepositoryBranchInput' :: RepositoryBranchInput -> RepositoryProvider
$sel:name:RepositoryBranchInput' :: RepositoryBranchInput -> Text
$sel:branch:RepositoryBranchInput' :: RepositoryBranchInput -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
branch
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RepositoryProvider
provider

instance Prelude.NFData RepositoryBranchInput where
  rnf :: RepositoryBranchInput -> ()
rnf RepositoryBranchInput' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
branch :: Text
$sel:provider:RepositoryBranchInput' :: RepositoryBranchInput -> RepositoryProvider
$sel:name:RepositoryBranchInput' :: RepositoryBranchInput -> Text
$sel:branch:RepositoryBranchInput' :: RepositoryBranchInput -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
branch
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RepositoryProvider
provider

instance Data.ToJSON RepositoryBranchInput where
  toJSON :: RepositoryBranchInput -> Value
toJSON RepositoryBranchInput' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
branch :: Text
$sel:provider:RepositoryBranchInput' :: RepositoryBranchInput -> RepositoryProvider
$sel:name:RepositoryBranchInput' :: RepositoryBranchInput -> Text
$sel:branch:RepositoryBranchInput' :: RepositoryBranchInput -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"branch" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
branch),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"provider" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RepositoryProvider
provider)
          ]
      )