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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'IsBinaryFile' 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', 'isBinaryFile_destination' - The binary or non-binary status of a file in the destination of a merge
-- or pull request.
--
-- 'base', 'isBinaryFile_base' - The binary or non-binary status of a file in the base of a merge or pull
-- request.
--
-- 'source', 'isBinaryFile_source' - The binary or non-binary status of file in the source of a merge or pull
-- request.
newIsBinaryFile ::
  IsBinaryFile
newIsBinaryFile :: IsBinaryFile
newIsBinaryFile =
  IsBinaryFile' :: Maybe Bool -> Maybe Bool -> Maybe Bool -> IsBinaryFile
IsBinaryFile'
    { $sel:destination:IsBinaryFile' :: Maybe Bool
destination = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:base:IsBinaryFile' :: Maybe Bool
base = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:source:IsBinaryFile' :: Maybe Bool
source = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The binary or non-binary status of a file in the destination of a merge
-- or pull request.
isBinaryFile_destination :: Lens.Lens' IsBinaryFile (Prelude.Maybe Prelude.Bool)
isBinaryFile_destination :: (Maybe Bool -> f (Maybe Bool)) -> IsBinaryFile -> f IsBinaryFile
isBinaryFile_destination = (IsBinaryFile -> Maybe Bool)
-> (IsBinaryFile -> Maybe Bool -> IsBinaryFile)
-> Lens IsBinaryFile IsBinaryFile (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IsBinaryFile' {Maybe Bool
destination :: Maybe Bool
$sel:destination:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
destination} -> Maybe Bool
destination) (\s :: IsBinaryFile
s@IsBinaryFile' {} Maybe Bool
a -> IsBinaryFile
s {$sel:destination:IsBinaryFile' :: Maybe Bool
destination = Maybe Bool
a} :: IsBinaryFile)

-- | The binary or non-binary status of a file in the base of a merge or pull
-- request.
isBinaryFile_base :: Lens.Lens' IsBinaryFile (Prelude.Maybe Prelude.Bool)
isBinaryFile_base :: (Maybe Bool -> f (Maybe Bool)) -> IsBinaryFile -> f IsBinaryFile
isBinaryFile_base = (IsBinaryFile -> Maybe Bool)
-> (IsBinaryFile -> Maybe Bool -> IsBinaryFile)
-> Lens IsBinaryFile IsBinaryFile (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IsBinaryFile' {Maybe Bool
base :: Maybe Bool
$sel:base:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
base} -> Maybe Bool
base) (\s :: IsBinaryFile
s@IsBinaryFile' {} Maybe Bool
a -> IsBinaryFile
s {$sel:base:IsBinaryFile' :: Maybe Bool
base = Maybe Bool
a} :: IsBinaryFile)

-- | The binary or non-binary status of file in the source of a merge or pull
-- request.
isBinaryFile_source :: Lens.Lens' IsBinaryFile (Prelude.Maybe Prelude.Bool)
isBinaryFile_source :: (Maybe Bool -> f (Maybe Bool)) -> IsBinaryFile -> f IsBinaryFile
isBinaryFile_source = (IsBinaryFile -> Maybe Bool)
-> (IsBinaryFile -> Maybe Bool -> IsBinaryFile)
-> Lens IsBinaryFile IsBinaryFile (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IsBinaryFile' {Maybe Bool
source :: Maybe Bool
$sel:source:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
source} -> Maybe Bool
source) (\s :: IsBinaryFile
s@IsBinaryFile' {} Maybe Bool
a -> IsBinaryFile
s {$sel:source:IsBinaryFile' :: Maybe Bool
source = Maybe Bool
a} :: IsBinaryFile)

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

instance Prelude.Hashable IsBinaryFile

instance Prelude.NFData IsBinaryFile