{-# 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.AmplifyUiBuilder.Types.ComponentSummary
-- 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.AmplifyUiBuilder.Types.ComponentSummary 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

-- | Contains a summary of a component. This is a read-only data type that is
-- returned by @ListComponents@.
--
-- /See:/ 'newComponentSummary' smart constructor.
data ComponentSummary = ComponentSummary'
  { -- | The unique ID of the Amplify app associated with the component.
    ComponentSummary -> Text
appId :: Prelude.Text,
    -- | The component type.
    ComponentSummary -> Text
componentType :: Prelude.Text,
    -- | The name of the backend environment that is a part of the Amplify app.
    ComponentSummary -> Text
environmentName :: Prelude.Text,
    -- | The unique ID of the component.
    ComponentSummary -> Text
id :: Prelude.Text,
    -- | The name of the component.
    ComponentSummary -> Text
name :: Prelude.Text
  }
  deriving (ComponentSummary -> ComponentSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentSummary -> ComponentSummary -> Bool
$c/= :: ComponentSummary -> ComponentSummary -> Bool
== :: ComponentSummary -> ComponentSummary -> Bool
$c== :: ComponentSummary -> ComponentSummary -> Bool
Prelude.Eq, ReadPrec [ComponentSummary]
ReadPrec ComponentSummary
Int -> ReadS ComponentSummary
ReadS [ComponentSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentSummary]
$creadListPrec :: ReadPrec [ComponentSummary]
readPrec :: ReadPrec ComponentSummary
$creadPrec :: ReadPrec ComponentSummary
readList :: ReadS [ComponentSummary]
$creadList :: ReadS [ComponentSummary]
readsPrec :: Int -> ReadS ComponentSummary
$creadsPrec :: Int -> ReadS ComponentSummary
Prelude.Read, Int -> ComponentSummary -> ShowS
[ComponentSummary] -> ShowS
ComponentSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentSummary] -> ShowS
$cshowList :: [ComponentSummary] -> ShowS
show :: ComponentSummary -> String
$cshow :: ComponentSummary -> String
showsPrec :: Int -> ComponentSummary -> ShowS
$cshowsPrec :: Int -> ComponentSummary -> ShowS
Prelude.Show, forall x. Rep ComponentSummary x -> ComponentSummary
forall x. ComponentSummary -> Rep ComponentSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComponentSummary x -> ComponentSummary
$cfrom :: forall x. ComponentSummary -> Rep ComponentSummary x
Prelude.Generic)

-- |
-- Create a value of 'ComponentSummary' 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:
--
-- 'appId', 'componentSummary_appId' - The unique ID of the Amplify app associated with the component.
--
-- 'componentType', 'componentSummary_componentType' - The component type.
--
-- 'environmentName', 'componentSummary_environmentName' - The name of the backend environment that is a part of the Amplify app.
--
-- 'id', 'componentSummary_id' - The unique ID of the component.
--
-- 'name', 'componentSummary_name' - The name of the component.
newComponentSummary ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'componentType'
  Prelude.Text ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  ComponentSummary
newComponentSummary :: Text -> Text -> Text -> Text -> Text -> ComponentSummary
newComponentSummary
  Text
pAppId_
  Text
pComponentType_
  Text
pEnvironmentName_
  Text
pId_
  Text
pName_ =
    ComponentSummary'
      { $sel:appId:ComponentSummary' :: Text
appId = Text
pAppId_,
        $sel:componentType:ComponentSummary' :: Text
componentType = Text
pComponentType_,
        $sel:environmentName:ComponentSummary' :: Text
environmentName = Text
pEnvironmentName_,
        $sel:id:ComponentSummary' :: Text
id = Text
pId_,
        $sel:name:ComponentSummary' :: Text
name = Text
pName_
      }

-- | The unique ID of the Amplify app associated with the component.
componentSummary_appId :: Lens.Lens' ComponentSummary Prelude.Text
componentSummary_appId :: Lens' ComponentSummary Text
componentSummary_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Text
appId :: Text
$sel:appId:ComponentSummary' :: ComponentSummary -> Text
appId} -> Text
appId) (\s :: ComponentSummary
s@ComponentSummary' {} Text
a -> ComponentSummary
s {$sel:appId:ComponentSummary' :: Text
appId = Text
a} :: ComponentSummary)

-- | The component type.
componentSummary_componentType :: Lens.Lens' ComponentSummary Prelude.Text
componentSummary_componentType :: Lens' ComponentSummary Text
componentSummary_componentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Text
componentType :: Text
$sel:componentType:ComponentSummary' :: ComponentSummary -> Text
componentType} -> Text
componentType) (\s :: ComponentSummary
s@ComponentSummary' {} Text
a -> ComponentSummary
s {$sel:componentType:ComponentSummary' :: Text
componentType = Text
a} :: ComponentSummary)

-- | The name of the backend environment that is a part of the Amplify app.
componentSummary_environmentName :: Lens.Lens' ComponentSummary Prelude.Text
componentSummary_environmentName :: Lens' ComponentSummary Text
componentSummary_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Text
environmentName :: Text
$sel:environmentName:ComponentSummary' :: ComponentSummary -> Text
environmentName} -> Text
environmentName) (\s :: ComponentSummary
s@ComponentSummary' {} Text
a -> ComponentSummary
s {$sel:environmentName:ComponentSummary' :: Text
environmentName = Text
a} :: ComponentSummary)

-- | The unique ID of the component.
componentSummary_id :: Lens.Lens' ComponentSummary Prelude.Text
componentSummary_id :: Lens' ComponentSummary Text
componentSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Text
id :: Text
$sel:id:ComponentSummary' :: ComponentSummary -> Text
id} -> Text
id) (\s :: ComponentSummary
s@ComponentSummary' {} Text
a -> ComponentSummary
s {$sel:id:ComponentSummary' :: Text
id = Text
a} :: ComponentSummary)

-- | The name of the component.
componentSummary_name :: Lens.Lens' ComponentSummary Prelude.Text
componentSummary_name :: Lens' ComponentSummary Text
componentSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Text
name :: Text
$sel:name:ComponentSummary' :: ComponentSummary -> Text
name} -> Text
name) (\s :: ComponentSummary
s@ComponentSummary' {} Text
a -> ComponentSummary
s {$sel:name:ComponentSummary' :: Text
name = Text
a} :: ComponentSummary)

instance Data.FromJSON ComponentSummary where
  parseJSON :: Value -> Parser ComponentSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComponentSummary"
      ( \Object
x ->
          Text -> Text -> Text -> Text -> Text -> ComponentSummary
ComponentSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"appId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"componentType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"environmentName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
      )

instance Prelude.Hashable ComponentSummary where
  hashWithSalt :: Int -> ComponentSummary -> Int
hashWithSalt Int
_salt ComponentSummary' {Text
name :: Text
id :: Text
environmentName :: Text
componentType :: Text
appId :: Text
$sel:name:ComponentSummary' :: ComponentSummary -> Text
$sel:id:ComponentSummary' :: ComponentSummary -> Text
$sel:environmentName:ComponentSummary' :: ComponentSummary -> Text
$sel:componentType:ComponentSummary' :: ComponentSummary -> Text
$sel:appId:ComponentSummary' :: ComponentSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData ComponentSummary where
  rnf :: ComponentSummary -> ()
rnf ComponentSummary' {Text
name :: Text
id :: Text
environmentName :: Text
componentType :: Text
appId :: Text
$sel:name:ComponentSummary' :: ComponentSummary -> Text
$sel:id:ComponentSummary' :: ComponentSummary -> Text
$sel:environmentName:ComponentSummary' :: ComponentSummary -> Text
$sel:componentType:ComponentSummary' :: ComponentSummary -> Text
$sel:appId:ComponentSummary' :: ComponentSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
appId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
componentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
environmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name