{-# 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.FileModes
-- 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.FileModes where

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

-- | Information about file modes in a merge or pull request.
--
-- /See:/ 'newFileModes' smart constructor.
data FileModes = FileModes'
  { -- | The file mode of a file in the destination of a merge or pull request.
    FileModes -> Maybe FileModeTypeEnum
destination :: Prelude.Maybe FileModeTypeEnum,
    -- | The file mode of a file in the base of a merge or pull request.
    FileModes -> Maybe FileModeTypeEnum
base :: Prelude.Maybe FileModeTypeEnum,
    -- | The file mode of a file in the source of a merge or pull request.
    FileModes -> Maybe FileModeTypeEnum
source :: Prelude.Maybe FileModeTypeEnum
  }
  deriving (FileModes -> FileModes -> Bool
(FileModes -> FileModes -> Bool)
-> (FileModes -> FileModes -> Bool) -> Eq FileModes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileModes -> FileModes -> Bool
$c/= :: FileModes -> FileModes -> Bool
== :: FileModes -> FileModes -> Bool
$c== :: FileModes -> FileModes -> Bool
Prelude.Eq, ReadPrec [FileModes]
ReadPrec FileModes
Int -> ReadS FileModes
ReadS [FileModes]
(Int -> ReadS FileModes)
-> ReadS [FileModes]
-> ReadPrec FileModes
-> ReadPrec [FileModes]
-> Read FileModes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileModes]
$creadListPrec :: ReadPrec [FileModes]
readPrec :: ReadPrec FileModes
$creadPrec :: ReadPrec FileModes
readList :: ReadS [FileModes]
$creadList :: ReadS [FileModes]
readsPrec :: Int -> ReadS FileModes
$creadsPrec :: Int -> ReadS FileModes
Prelude.Read, Int -> FileModes -> ShowS
[FileModes] -> ShowS
FileModes -> String
(Int -> FileModes -> ShowS)
-> (FileModes -> String)
-> ([FileModes] -> ShowS)
-> Show FileModes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileModes] -> ShowS
$cshowList :: [FileModes] -> ShowS
show :: FileModes -> String
$cshow :: FileModes -> String
showsPrec :: Int -> FileModes -> ShowS
$cshowsPrec :: Int -> FileModes -> ShowS
Prelude.Show, (forall x. FileModes -> Rep FileModes x)
-> (forall x. Rep FileModes x -> FileModes) -> Generic FileModes
forall x. Rep FileModes x -> FileModes
forall x. FileModes -> Rep FileModes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileModes x -> FileModes
$cfrom :: forall x. FileModes -> Rep FileModes x
Prelude.Generic)

-- |
-- Create a value of 'FileModes' 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', 'fileModes_destination' - The file mode of a file in the destination of a merge or pull request.
--
-- 'base', 'fileModes_base' - The file mode of a file in the base of a merge or pull request.
--
-- 'source', 'fileModes_source' - The file mode of a file in the source of a merge or pull request.
newFileModes ::
  FileModes
newFileModes :: FileModes
newFileModes =
  FileModes' :: Maybe FileModeTypeEnum
-> Maybe FileModeTypeEnum -> Maybe FileModeTypeEnum -> FileModes
FileModes'
    { $sel:destination:FileModes' :: Maybe FileModeTypeEnum
destination = Maybe FileModeTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:base:FileModes' :: Maybe FileModeTypeEnum
base = Maybe FileModeTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:source:FileModes' :: Maybe FileModeTypeEnum
source = Maybe FileModeTypeEnum
forall a. Maybe a
Prelude.Nothing
    }

-- | The file mode of a file in the destination of a merge or pull request.
fileModes_destination :: Lens.Lens' FileModes (Prelude.Maybe FileModeTypeEnum)
fileModes_destination :: (Maybe FileModeTypeEnum -> f (Maybe FileModeTypeEnum))
-> FileModes -> f FileModes
fileModes_destination = (FileModes -> Maybe FileModeTypeEnum)
-> (FileModes -> Maybe FileModeTypeEnum -> FileModes)
-> Lens
     FileModes
     FileModes
     (Maybe FileModeTypeEnum)
     (Maybe FileModeTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileModes' {Maybe FileModeTypeEnum
destination :: Maybe FileModeTypeEnum
$sel:destination:FileModes' :: FileModes -> Maybe FileModeTypeEnum
destination} -> Maybe FileModeTypeEnum
destination) (\s :: FileModes
s@FileModes' {} Maybe FileModeTypeEnum
a -> FileModes
s {$sel:destination:FileModes' :: Maybe FileModeTypeEnum
destination = Maybe FileModeTypeEnum
a} :: FileModes)

-- | The file mode of a file in the base of a merge or pull request.
fileModes_base :: Lens.Lens' FileModes (Prelude.Maybe FileModeTypeEnum)
fileModes_base :: (Maybe FileModeTypeEnum -> f (Maybe FileModeTypeEnum))
-> FileModes -> f FileModes
fileModes_base = (FileModes -> Maybe FileModeTypeEnum)
-> (FileModes -> Maybe FileModeTypeEnum -> FileModes)
-> Lens
     FileModes
     FileModes
     (Maybe FileModeTypeEnum)
     (Maybe FileModeTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileModes' {Maybe FileModeTypeEnum
base :: Maybe FileModeTypeEnum
$sel:base:FileModes' :: FileModes -> Maybe FileModeTypeEnum
base} -> Maybe FileModeTypeEnum
base) (\s :: FileModes
s@FileModes' {} Maybe FileModeTypeEnum
a -> FileModes
s {$sel:base:FileModes' :: Maybe FileModeTypeEnum
base = Maybe FileModeTypeEnum
a} :: FileModes)

-- | The file mode of a file in the source of a merge or pull request.
fileModes_source :: Lens.Lens' FileModes (Prelude.Maybe FileModeTypeEnum)
fileModes_source :: (Maybe FileModeTypeEnum -> f (Maybe FileModeTypeEnum))
-> FileModes -> f FileModes
fileModes_source = (FileModes -> Maybe FileModeTypeEnum)
-> (FileModes -> Maybe FileModeTypeEnum -> FileModes)
-> Lens
     FileModes
     FileModes
     (Maybe FileModeTypeEnum)
     (Maybe FileModeTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileModes' {Maybe FileModeTypeEnum
source :: Maybe FileModeTypeEnum
$sel:source:FileModes' :: FileModes -> Maybe FileModeTypeEnum
source} -> Maybe FileModeTypeEnum
source) (\s :: FileModes
s@FileModes' {} Maybe FileModeTypeEnum
a -> FileModes
s {$sel:source:FileModes' :: Maybe FileModeTypeEnum
source = Maybe FileModeTypeEnum
a} :: FileModes)

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

instance Prelude.Hashable FileModes

instance Prelude.NFData FileModes