{-# 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.SubModule
-- 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.SubModule 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

-- | Returns information about a submodule reference in a repository folder.
--
-- /See:/ 'newSubModule' smart constructor.
data SubModule = SubModule'
  { -- | The fully qualified path to the folder that contains the reference to
    -- the submodule.
    SubModule -> Maybe Text
absolutePath :: Prelude.Maybe Prelude.Text,
    -- | The commit ID that contains the reference to the submodule.
    SubModule -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
    -- | The relative path of the submodule from the folder where the query
    -- originated.
    SubModule -> Maybe Text
relativePath :: Prelude.Maybe Prelude.Text
  }
  deriving (SubModule -> SubModule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubModule -> SubModule -> Bool
$c/= :: SubModule -> SubModule -> Bool
== :: SubModule -> SubModule -> Bool
$c== :: SubModule -> SubModule -> Bool
Prelude.Eq, ReadPrec [SubModule]
ReadPrec SubModule
Int -> ReadS SubModule
ReadS [SubModule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubModule]
$creadListPrec :: ReadPrec [SubModule]
readPrec :: ReadPrec SubModule
$creadPrec :: ReadPrec SubModule
readList :: ReadS [SubModule]
$creadList :: ReadS [SubModule]
readsPrec :: Int -> ReadS SubModule
$creadsPrec :: Int -> ReadS SubModule
Prelude.Read, Int -> SubModule -> ShowS
[SubModule] -> ShowS
SubModule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubModule] -> ShowS
$cshowList :: [SubModule] -> ShowS
show :: SubModule -> String
$cshow :: SubModule -> String
showsPrec :: Int -> SubModule -> ShowS
$cshowsPrec :: Int -> SubModule -> ShowS
Prelude.Show, forall x. Rep SubModule x -> SubModule
forall x. SubModule -> Rep SubModule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubModule x -> SubModule
$cfrom :: forall x. SubModule -> Rep SubModule x
Prelude.Generic)

-- |
-- Create a value of 'SubModule' 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:
--
-- 'absolutePath', 'subModule_absolutePath' - The fully qualified path to the folder that contains the reference to
-- the submodule.
--
-- 'commitId', 'subModule_commitId' - The commit ID that contains the reference to the submodule.
--
-- 'relativePath', 'subModule_relativePath' - The relative path of the submodule from the folder where the query
-- originated.
newSubModule ::
  SubModule
newSubModule :: SubModule
newSubModule =
  SubModule'
    { $sel:absolutePath:SubModule' :: Maybe Text
absolutePath = forall a. Maybe a
Prelude.Nothing,
      $sel:commitId:SubModule' :: Maybe Text
commitId = forall a. Maybe a
Prelude.Nothing,
      $sel:relativePath:SubModule' :: Maybe Text
relativePath = forall a. Maybe a
Prelude.Nothing
    }

-- | The fully qualified path to the folder that contains the reference to
-- the submodule.
subModule_absolutePath :: Lens.Lens' SubModule (Prelude.Maybe Prelude.Text)
subModule_absolutePath :: Lens' SubModule (Maybe Text)
subModule_absolutePath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubModule' {Maybe Text
absolutePath :: Maybe Text
$sel:absolutePath:SubModule' :: SubModule -> Maybe Text
absolutePath} -> Maybe Text
absolutePath) (\s :: SubModule
s@SubModule' {} Maybe Text
a -> SubModule
s {$sel:absolutePath:SubModule' :: Maybe Text
absolutePath = Maybe Text
a} :: SubModule)

-- | The commit ID that contains the reference to the submodule.
subModule_commitId :: Lens.Lens' SubModule (Prelude.Maybe Prelude.Text)
subModule_commitId :: Lens' SubModule (Maybe Text)
subModule_commitId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubModule' {Maybe Text
commitId :: Maybe Text
$sel:commitId:SubModule' :: SubModule -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: SubModule
s@SubModule' {} Maybe Text
a -> SubModule
s {$sel:commitId:SubModule' :: Maybe Text
commitId = Maybe Text
a} :: SubModule)

-- | The relative path of the submodule from the folder where the query
-- originated.
subModule_relativePath :: Lens.Lens' SubModule (Prelude.Maybe Prelude.Text)
subModule_relativePath :: Lens' SubModule (Maybe Text)
subModule_relativePath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubModule' {Maybe Text
relativePath :: Maybe Text
$sel:relativePath:SubModule' :: SubModule -> Maybe Text
relativePath} -> Maybe Text
relativePath) (\s :: SubModule
s@SubModule' {} Maybe Text
a -> SubModule
s {$sel:relativePath:SubModule' :: Maybe Text
relativePath = Maybe Text
a} :: SubModule)

instance Data.FromJSON SubModule where
  parseJSON :: Value -> Parser SubModule
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SubModule"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> SubModule
SubModule'
            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
"absolutePath")
            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
"commitId")
            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
"relativePath")
      )

instance Prelude.Hashable SubModule where
  hashWithSalt :: Int -> SubModule -> Int
hashWithSalt Int
_salt SubModule' {Maybe Text
relativePath :: Maybe Text
commitId :: Maybe Text
absolutePath :: Maybe Text
$sel:relativePath:SubModule' :: SubModule -> Maybe Text
$sel:commitId:SubModule' :: SubModule -> Maybe Text
$sel:absolutePath:SubModule' :: SubModule -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
absolutePath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
commitId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
relativePath

instance Prelude.NFData SubModule where
  rnf :: SubModule -> ()
rnf SubModule' {Maybe Text
relativePath :: Maybe Text
commitId :: Maybe Text
absolutePath :: Maybe Text
$sel:relativePath:SubModule' :: SubModule -> Maybe Text
$sel:commitId:SubModule' :: SubModule -> Maybe Text
$sel:absolutePath:SubModule' :: SubModule -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
absolutePath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
commitId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
relativePath