{-# 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.CodeCommit.Types.ObjectTypes
-- 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.CodeCommit.Types.ObjectTypes where

import Amazonka.CodeCommit.Types.ObjectTypeEnum
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the type of an object in a merge operation.
--
-- /See:/ 'newObjectTypes' smart constructor.
data ObjectTypes = ObjectTypes'
  { -- | The type of the object in the destination branch.
    ObjectTypes -> Maybe ObjectTypeEnum
destination :: Prelude.Maybe ObjectTypeEnum,
    -- | The type of the object in the base commit of the merge.
    ObjectTypes -> Maybe ObjectTypeEnum
base :: Prelude.Maybe ObjectTypeEnum,
    -- | The type of the object in the source branch.
    ObjectTypes -> Maybe ObjectTypeEnum
source :: Prelude.Maybe ObjectTypeEnum
  }
  deriving (ObjectTypes -> ObjectTypes -> Bool
(ObjectTypes -> ObjectTypes -> Bool)
-> (ObjectTypes -> ObjectTypes -> Bool) -> Eq ObjectTypes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectTypes -> ObjectTypes -> Bool
$c/= :: ObjectTypes -> ObjectTypes -> Bool
== :: ObjectTypes -> ObjectTypes -> Bool
$c== :: ObjectTypes -> ObjectTypes -> Bool
Prelude.Eq, ReadPrec [ObjectTypes]
ReadPrec ObjectTypes
Int -> ReadS ObjectTypes
ReadS [ObjectTypes]
(Int -> ReadS ObjectTypes)
-> ReadS [ObjectTypes]
-> ReadPrec ObjectTypes
-> ReadPrec [ObjectTypes]
-> Read ObjectTypes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectTypes]
$creadListPrec :: ReadPrec [ObjectTypes]
readPrec :: ReadPrec ObjectTypes
$creadPrec :: ReadPrec ObjectTypes
readList :: ReadS [ObjectTypes]
$creadList :: ReadS [ObjectTypes]
readsPrec :: Int -> ReadS ObjectTypes
$creadsPrec :: Int -> ReadS ObjectTypes
Prelude.Read, Int -> ObjectTypes -> ShowS
[ObjectTypes] -> ShowS
ObjectTypes -> String
(Int -> ObjectTypes -> ShowS)
-> (ObjectTypes -> String)
-> ([ObjectTypes] -> ShowS)
-> Show ObjectTypes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectTypes] -> ShowS
$cshowList :: [ObjectTypes] -> ShowS
show :: ObjectTypes -> String
$cshow :: ObjectTypes -> String
showsPrec :: Int -> ObjectTypes -> ShowS
$cshowsPrec :: Int -> ObjectTypes -> ShowS
Prelude.Show, (forall x. ObjectTypes -> Rep ObjectTypes x)
-> (forall x. Rep ObjectTypes x -> ObjectTypes)
-> Generic ObjectTypes
forall x. Rep ObjectTypes x -> ObjectTypes
forall x. ObjectTypes -> Rep ObjectTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectTypes x -> ObjectTypes
$cfrom :: forall x. ObjectTypes -> Rep ObjectTypes x
Prelude.Generic)

-- |
-- Create a value of 'ObjectTypes' 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:
--
-- 'destination', 'objectTypes_destination' - The type of the object in the destination branch.
--
-- 'base', 'objectTypes_base' - The type of the object in the base commit of the merge.
--
-- 'source', 'objectTypes_source' - The type of the object in the source branch.
newObjectTypes ::
  ObjectTypes
newObjectTypes :: ObjectTypes
newObjectTypes =
  ObjectTypes' :: Maybe ObjectTypeEnum
-> Maybe ObjectTypeEnum -> Maybe ObjectTypeEnum -> ObjectTypes
ObjectTypes'
    { $sel:destination:ObjectTypes' :: Maybe ObjectTypeEnum
destination = Maybe ObjectTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:base:ObjectTypes' :: Maybe ObjectTypeEnum
base = Maybe ObjectTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:source:ObjectTypes' :: Maybe ObjectTypeEnum
source = Maybe ObjectTypeEnum
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of the object in the destination branch.
objectTypes_destination :: Lens.Lens' ObjectTypes (Prelude.Maybe ObjectTypeEnum)
objectTypes_destination :: (Maybe ObjectTypeEnum -> f (Maybe ObjectTypeEnum))
-> ObjectTypes -> f ObjectTypes
objectTypes_destination = (ObjectTypes -> Maybe ObjectTypeEnum)
-> (ObjectTypes -> Maybe ObjectTypeEnum -> ObjectTypes)
-> Lens
     ObjectTypes
     ObjectTypes
     (Maybe ObjectTypeEnum)
     (Maybe ObjectTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectTypes' {Maybe ObjectTypeEnum
destination :: Maybe ObjectTypeEnum
$sel:destination:ObjectTypes' :: ObjectTypes -> Maybe ObjectTypeEnum
destination} -> Maybe ObjectTypeEnum
destination) (\s :: ObjectTypes
s@ObjectTypes' {} Maybe ObjectTypeEnum
a -> ObjectTypes
s {$sel:destination:ObjectTypes' :: Maybe ObjectTypeEnum
destination = Maybe ObjectTypeEnum
a} :: ObjectTypes)

-- | The type of the object in the base commit of the merge.
objectTypes_base :: Lens.Lens' ObjectTypes (Prelude.Maybe ObjectTypeEnum)
objectTypes_base :: (Maybe ObjectTypeEnum -> f (Maybe ObjectTypeEnum))
-> ObjectTypes -> f ObjectTypes
objectTypes_base = (ObjectTypes -> Maybe ObjectTypeEnum)
-> (ObjectTypes -> Maybe ObjectTypeEnum -> ObjectTypes)
-> Lens
     ObjectTypes
     ObjectTypes
     (Maybe ObjectTypeEnum)
     (Maybe ObjectTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectTypes' {Maybe ObjectTypeEnum
base :: Maybe ObjectTypeEnum
$sel:base:ObjectTypes' :: ObjectTypes -> Maybe ObjectTypeEnum
base} -> Maybe ObjectTypeEnum
base) (\s :: ObjectTypes
s@ObjectTypes' {} Maybe ObjectTypeEnum
a -> ObjectTypes
s {$sel:base:ObjectTypes' :: Maybe ObjectTypeEnum
base = Maybe ObjectTypeEnum
a} :: ObjectTypes)

-- | The type of the object in the source branch.
objectTypes_source :: Lens.Lens' ObjectTypes (Prelude.Maybe ObjectTypeEnum)
objectTypes_source :: (Maybe ObjectTypeEnum -> f (Maybe ObjectTypeEnum))
-> ObjectTypes -> f ObjectTypes
objectTypes_source = (ObjectTypes -> Maybe ObjectTypeEnum)
-> (ObjectTypes -> Maybe ObjectTypeEnum -> ObjectTypes)
-> Lens
     ObjectTypes
     ObjectTypes
     (Maybe ObjectTypeEnum)
     (Maybe ObjectTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectTypes' {Maybe ObjectTypeEnum
source :: Maybe ObjectTypeEnum
$sel:source:ObjectTypes' :: ObjectTypes -> Maybe ObjectTypeEnum
source} -> Maybe ObjectTypeEnum
source) (\s :: ObjectTypes
s@ObjectTypes' {} Maybe ObjectTypeEnum
a -> ObjectTypes
s {$sel:source:ObjectTypes' :: Maybe ObjectTypeEnum
source = Maybe ObjectTypeEnum
a} :: ObjectTypes)

instance Core.FromJSON ObjectTypes where
  parseJSON :: Value -> Parser ObjectTypes
parseJSON =
    String
-> (Object -> Parser ObjectTypes) -> Value -> Parser ObjectTypes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ObjectTypes"
      ( \Object
x ->
          Maybe ObjectTypeEnum
-> Maybe ObjectTypeEnum -> Maybe ObjectTypeEnum -> ObjectTypes
ObjectTypes'
            (Maybe ObjectTypeEnum
 -> Maybe ObjectTypeEnum -> Maybe ObjectTypeEnum -> ObjectTypes)
-> Parser (Maybe ObjectTypeEnum)
-> Parser
     (Maybe ObjectTypeEnum -> Maybe ObjectTypeEnum -> ObjectTypes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ObjectTypeEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destination")
            Parser
  (Maybe ObjectTypeEnum -> Maybe ObjectTypeEnum -> ObjectTypes)
-> Parser (Maybe ObjectTypeEnum)
-> Parser (Maybe ObjectTypeEnum -> ObjectTypes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ObjectTypeEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"base")
            Parser (Maybe ObjectTypeEnum -> ObjectTypes)
-> Parser (Maybe ObjectTypeEnum) -> Parser ObjectTypes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ObjectTypeEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"source")
      )

instance Prelude.Hashable ObjectTypes

instance Prelude.NFData ObjectTypes