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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 destination of a merge or pull request.
    FileSizes -> Maybe Integer
destination :: Prelude.Maybe Prelude.Integer,
    -- | 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 source of a merge or pull request.
    FileSizes -> Maybe Integer
source :: Prelude.Maybe Prelude.Integer
  }
  deriving (FileSizes -> FileSizes -> Bool
(FileSizes -> FileSizes -> Bool)
-> (FileSizes -> FileSizes -> Bool) -> Eq FileSizes
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]
(Int -> ReadS FileSizes)
-> ReadS [FileSizes]
-> ReadPrec FileSizes
-> ReadPrec [FileSizes]
-> Read 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
(Int -> FileSizes -> ShowS)
-> (FileSizes -> String)
-> ([FileSizes] -> ShowS)
-> Show FileSizes
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. FileSizes -> Rep FileSizes x)
-> (forall x. Rep FileSizes x -> FileSizes) -> Generic FileSizes
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:
--
-- 'destination', 'fileSizes_destination' - The size of a file in the destination of a merge or pull request.
--
-- 'base', 'fileSizes_base' - The size of a file in the base 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' :: Maybe Integer -> Maybe Integer -> Maybe Integer -> FileSizes
FileSizes'
    { $sel:destination:FileSizes' :: Maybe Integer
destination = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:base:FileSizes' :: Maybe Integer
base = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:source:FileSizes' :: Maybe Integer
source = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Integer -> f (Maybe Integer)) -> FileSizes -> f FileSizes
fileSizes_destination = (FileSizes -> Maybe Integer)
-> (FileSizes -> Maybe Integer -> FileSizes)
-> Lens FileSizes FileSizes (Maybe Integer) (Maybe Integer)
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 base of a merge or pull request.
fileSizes_base :: Lens.Lens' FileSizes (Prelude.Maybe Prelude.Integer)
fileSizes_base :: (Maybe Integer -> f (Maybe Integer)) -> FileSizes -> f FileSizes
fileSizes_base = (FileSizes -> Maybe Integer)
-> (FileSizes -> Maybe Integer -> FileSizes)
-> Lens FileSizes FileSizes (Maybe Integer) (Maybe Integer)
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 source of a merge or pull request.
fileSizes_source :: Lens.Lens' FileSizes (Prelude.Maybe Prelude.Integer)
fileSizes_source :: (Maybe Integer -> f (Maybe Integer)) -> FileSizes -> f FileSizes
fileSizes_source = (FileSizes -> Maybe Integer)
-> (FileSizes -> Maybe Integer -> FileSizes)
-> Lens FileSizes FileSizes (Maybe Integer) (Maybe Integer)
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 Core.FromJSON FileSizes where
  parseJSON :: Value -> Parser FileSizes
parseJSON =
    String -> (Object -> Parser FileSizes) -> Value -> Parser FileSizes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FileSizes"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> Maybe Integer -> FileSizes
FileSizes'
            (Maybe Integer -> Maybe Integer -> Maybe Integer -> FileSizes)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> FileSizes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destination")
            Parser (Maybe Integer -> Maybe Integer -> FileSizes)
-> Parser (Maybe Integer) -> Parser (Maybe Integer -> FileSizes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"base")
            Parser (Maybe Integer -> FileSizes)
-> Parser (Maybe Integer) -> Parser FileSizes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"source")
      )

instance Prelude.Hashable FileSizes

instance Prelude.NFData FileSizes