{-# 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.FileSizes
-- 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.FileSizes 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 the size of files in a merge or pull request.
--
-- /See:/ 'newFileSizes' smart constructor.
data FileSizes = FileSizes'
  { -- | The size of a file in the base of a merge or pull request.
    FileSizes -> Maybe Integer
base :: Prelude.Maybe Prelude.Integer,
    -- | The size of a file in the destination of a merge or pull request.
    FileSizes -> Maybe Integer
destination :: Prelude.Maybe Prelude.Integer,
    -- | The size of a file in the source of a merge or pull request.
    FileSizes -> Maybe Integer
source :: Prelude.Maybe Prelude.Integer
  }
  deriving (FileSizes -> FileSizes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileSizes -> FileSizes -> Bool
$c/= :: FileSizes -> FileSizes -> Bool
== :: FileSizes -> FileSizes -> Bool
$c== :: FileSizes -> FileSizes -> Bool
Prelude.Eq, ReadPrec [FileSizes]
ReadPrec FileSizes
Int -> ReadS FileSizes
ReadS [FileSizes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileSizes]
$creadListPrec :: ReadPrec [FileSizes]
readPrec :: ReadPrec FileSizes
$creadPrec :: ReadPrec FileSizes
readList :: ReadS [FileSizes]
$creadList :: ReadS [FileSizes]
readsPrec :: Int -> ReadS FileSizes
$creadsPrec :: Int -> ReadS FileSizes
Prelude.Read, Int -> FileSizes -> ShowS
[FileSizes] -> ShowS
FileSizes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileSizes] -> ShowS
$cshowList :: [FileSizes] -> ShowS
show :: FileSizes -> String
$cshow :: FileSizes -> String
showsPrec :: Int -> FileSizes -> ShowS
$cshowsPrec :: Int -> FileSizes -> ShowS
Prelude.Show, forall x. Rep FileSizes x -> FileSizes
forall x. FileSizes -> Rep FileSizes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileSizes x -> FileSizes
$cfrom :: forall x. FileSizes -> Rep FileSizes x
Prelude.Generic)

-- |
-- Create a value of 'FileSizes' 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', 'fileSizes_base' - The size of a file in the base of a merge or pull request.
--
-- 'destination', 'fileSizes_destination' - The size of a file in the destination of a merge or pull request.
--
-- 'source', 'fileSizes_source' - The size of a file in the source of a merge or pull request.
newFileSizes ::
  FileSizes
newFileSizes :: FileSizes
newFileSizes =
  FileSizes'
    { $sel:base:FileSizes' :: Maybe Integer
base = forall a. Maybe a
Prelude.Nothing,
      $sel:destination:FileSizes' :: Maybe Integer
destination = forall a. Maybe a
Prelude.Nothing,
      $sel:source:FileSizes' :: Maybe Integer
source = forall a. Maybe a
Prelude.Nothing
    }

-- | The size of a file in the base of a merge or pull request.
fileSizes_base :: Lens.Lens' FileSizes (Prelude.Maybe Prelude.Integer)
fileSizes_base :: Lens' FileSizes (Maybe Integer)
fileSizes_base = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSizes' {Maybe Integer
base :: Maybe Integer
$sel:base:FileSizes' :: FileSizes -> Maybe Integer
base} -> Maybe Integer
base) (\s :: FileSizes
s@FileSizes' {} Maybe Integer
a -> FileSizes
s {$sel:base:FileSizes' :: Maybe Integer
base = Maybe Integer
a} :: FileSizes)

-- | The size of a file in the destination of a merge or pull request.
fileSizes_destination :: Lens.Lens' FileSizes (Prelude.Maybe Prelude.Integer)
fileSizes_destination :: Lens' FileSizes (Maybe Integer)
fileSizes_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSizes' {Maybe Integer
destination :: Maybe Integer
$sel:destination:FileSizes' :: FileSizes -> Maybe Integer
destination} -> Maybe Integer
destination) (\s :: FileSizes
s@FileSizes' {} Maybe Integer
a -> FileSizes
s {$sel:destination:FileSizes' :: Maybe Integer
destination = Maybe Integer
a} :: FileSizes)

-- | The size of a file in the source of a merge or pull request.
fileSizes_source :: Lens.Lens' FileSizes (Prelude.Maybe Prelude.Integer)
fileSizes_source :: Lens' FileSizes (Maybe Integer)
fileSizes_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSizes' {Maybe Integer
source :: Maybe Integer
$sel:source:FileSizes' :: FileSizes -> Maybe Integer
source} -> Maybe Integer
source) (\s :: FileSizes
s@FileSizes' {} Maybe Integer
a -> FileSizes
s {$sel:source:FileSizes' :: Maybe Integer
source = Maybe Integer
a} :: FileSizes)

instance Data.FromJSON FileSizes where
  parseJSON :: Value -> Parser FileSizes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FileSizes"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> Maybe Integer -> FileSizes
FileSizes'
            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 FileSizes where
  hashWithSalt :: Int -> FileSizes -> Int
hashWithSalt Int
_salt FileSizes' {Maybe Integer
source :: Maybe Integer
destination :: Maybe Integer
base :: Maybe Integer
$sel:source:FileSizes' :: FileSizes -> Maybe Integer
$sel:destination:FileSizes' :: FileSizes -> Maybe Integer
$sel:base:FileSizes' :: FileSizes -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
base
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
source

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