{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodeCommit.Types.IsBinaryFile 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

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

-- | 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 :: Lens' IsBinaryFile (Maybe Bool)
isBinaryFile_base = 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 a file in the destination of a merge
-- or pull request.
isBinaryFile_destination :: Lens.Lens' IsBinaryFile (Prelude.Maybe Prelude.Bool)
isBinaryFile_destination :: Lens' IsBinaryFile (Maybe Bool)
isBinaryFile_destination = 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 file in the source of a merge or pull
-- request.
isBinaryFile_source :: Lens.Lens' IsBinaryFile (Prelude.Maybe Prelude.Bool)
isBinaryFile_source :: Lens' IsBinaryFile (Maybe Bool)
isBinaryFile_source = 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 Data.FromJSON IsBinaryFile where
  parseJSON :: Value -> Parser IsBinaryFile
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IsBinaryFile"
      ( \Object
x ->
          Maybe Bool -> Maybe Bool -> Maybe Bool -> IsBinaryFile
IsBinaryFile'
            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
"base")
            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
"destination")
            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
"source")
      )

instance Prelude.Hashable IsBinaryFile where
  hashWithSalt :: Int -> IsBinaryFile -> Int
hashWithSalt Int
_salt IsBinaryFile' {Maybe Bool
source :: Maybe Bool
destination :: Maybe Bool
base :: Maybe Bool
$sel:source:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
$sel:destination:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
$sel:base:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
base
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
source

instance Prelude.NFData IsBinaryFile where
  rnf :: IsBinaryFile -> ()
rnf IsBinaryFile' {Maybe Bool
source :: Maybe Bool
destination :: Maybe Bool
base :: Maybe Bool
$sel:source:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
$sel:destination:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
$sel:base:IsBinaryFile' :: IsBinaryFile -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
base
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
source