{-# 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.IotTwinMaker.Types.ComponentResponse
-- 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.IotTwinMaker.Types.ComponentResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.ComponentPropertyGroupResponse
import Amazonka.IotTwinMaker.Types.PropertyResponse
import Amazonka.IotTwinMaker.Types.Status
import qualified Amazonka.Prelude as Prelude

-- | An object that returns information about a component type create or
-- update request.
--
-- /See:/ 'newComponentResponse' smart constructor.
data ComponentResponse = ComponentResponse'
  { -- | The name of the component.
    ComponentResponse -> Maybe Text
componentName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the component type.
    ComponentResponse -> Maybe Text
componentTypeId :: Prelude.Maybe Prelude.Text,
    -- | The name of the property definition set in the request.
    ComponentResponse -> Maybe Text
definedIn :: Prelude.Maybe Prelude.Text,
    -- | The description of the component type.
    ComponentResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | An object that maps strings to the properties to set in the component
    -- type. Each string in the mapping must be unique to this object.
    ComponentResponse -> Maybe (HashMap Text PropertyResponse)
properties :: Prelude.Maybe (Prelude.HashMap Prelude.Text PropertyResponse),
    -- | The property groups.
    ComponentResponse
-> Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups :: Prelude.Maybe (Prelude.HashMap Prelude.Text ComponentPropertyGroupResponse),
    -- | The status of the component type.
    ComponentResponse -> Maybe Status
status :: Prelude.Maybe Status,
    -- | The syncSource of the sync job, if this entity was created by a sync
    -- job.
    ComponentResponse -> Maybe Text
syncSource :: Prelude.Maybe Prelude.Text
  }
  deriving (ComponentResponse -> ComponentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentResponse -> ComponentResponse -> Bool
$c/= :: ComponentResponse -> ComponentResponse -> Bool
== :: ComponentResponse -> ComponentResponse -> Bool
$c== :: ComponentResponse -> ComponentResponse -> Bool
Prelude.Eq, ReadPrec [ComponentResponse]
ReadPrec ComponentResponse
Int -> ReadS ComponentResponse
ReadS [ComponentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentResponse]
$creadListPrec :: ReadPrec [ComponentResponse]
readPrec :: ReadPrec ComponentResponse
$creadPrec :: ReadPrec ComponentResponse
readList :: ReadS [ComponentResponse]
$creadList :: ReadS [ComponentResponse]
readsPrec :: Int -> ReadS ComponentResponse
$creadsPrec :: Int -> ReadS ComponentResponse
Prelude.Read, Int -> ComponentResponse -> ShowS
[ComponentResponse] -> ShowS
ComponentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentResponse] -> ShowS
$cshowList :: [ComponentResponse] -> ShowS
show :: ComponentResponse -> String
$cshow :: ComponentResponse -> String
showsPrec :: Int -> ComponentResponse -> ShowS
$cshowsPrec :: Int -> ComponentResponse -> ShowS
Prelude.Show, forall x. Rep ComponentResponse x -> ComponentResponse
forall x. ComponentResponse -> Rep ComponentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComponentResponse x -> ComponentResponse
$cfrom :: forall x. ComponentResponse -> Rep ComponentResponse x
Prelude.Generic)

-- |
-- Create a value of 'ComponentResponse' 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:
--
-- 'componentName', 'componentResponse_componentName' - The name of the component.
--
-- 'componentTypeId', 'componentResponse_componentTypeId' - The ID of the component type.
--
-- 'definedIn', 'componentResponse_definedIn' - The name of the property definition set in the request.
--
-- 'description', 'componentResponse_description' - The description of the component type.
--
-- 'properties', 'componentResponse_properties' - An object that maps strings to the properties to set in the component
-- type. Each string in the mapping must be unique to this object.
--
-- 'propertyGroups', 'componentResponse_propertyGroups' - The property groups.
--
-- 'status', 'componentResponse_status' - The status of the component type.
--
-- 'syncSource', 'componentResponse_syncSource' - The syncSource of the sync job, if this entity was created by a sync
-- job.
newComponentResponse ::
  ComponentResponse
newComponentResponse :: ComponentResponse
newComponentResponse =
  ComponentResponse'
    { $sel:componentName:ComponentResponse' :: Maybe Text
componentName = forall a. Maybe a
Prelude.Nothing,
      $sel:componentTypeId:ComponentResponse' :: Maybe Text
componentTypeId = forall a. Maybe a
Prelude.Nothing,
      $sel:definedIn:ComponentResponse' :: Maybe Text
definedIn = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ComponentResponse' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:properties:ComponentResponse' :: Maybe (HashMap Text PropertyResponse)
properties = forall a. Maybe a
Prelude.Nothing,
      $sel:propertyGroups:ComponentResponse' :: Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ComponentResponse' :: Maybe Status
status = forall a. Maybe a
Prelude.Nothing,
      $sel:syncSource:ComponentResponse' :: Maybe Text
syncSource = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The ID of the component type.
componentResponse_componentTypeId :: Lens.Lens' ComponentResponse (Prelude.Maybe Prelude.Text)
componentResponse_componentTypeId :: Lens' ComponentResponse (Maybe Text)
componentResponse_componentTypeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe Text
componentTypeId :: Maybe Text
$sel:componentTypeId:ComponentResponse' :: ComponentResponse -> Maybe Text
componentTypeId} -> Maybe Text
componentTypeId) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe Text
a -> ComponentResponse
s {$sel:componentTypeId:ComponentResponse' :: Maybe Text
componentTypeId = Maybe Text
a} :: ComponentResponse)

-- | The name of the property definition set in the request.
componentResponse_definedIn :: Lens.Lens' ComponentResponse (Prelude.Maybe Prelude.Text)
componentResponse_definedIn :: Lens' ComponentResponse (Maybe Text)
componentResponse_definedIn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe Text
definedIn :: Maybe Text
$sel:definedIn:ComponentResponse' :: ComponentResponse -> Maybe Text
definedIn} -> Maybe Text
definedIn) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe Text
a -> ComponentResponse
s {$sel:definedIn:ComponentResponse' :: Maybe Text
definedIn = Maybe Text
a} :: ComponentResponse)

-- | The description of the component type.
componentResponse_description :: Lens.Lens' ComponentResponse (Prelude.Maybe Prelude.Text)
componentResponse_description :: Lens' ComponentResponse (Maybe Text)
componentResponse_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe Text
description :: Maybe Text
$sel:description:ComponentResponse' :: ComponentResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe Text
a -> ComponentResponse
s {$sel:description:ComponentResponse' :: Maybe Text
description = Maybe Text
a} :: ComponentResponse)

-- | An object that maps strings to the properties to set in the component
-- type. Each string in the mapping must be unique to this object.
componentResponse_properties :: Lens.Lens' ComponentResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text PropertyResponse))
componentResponse_properties :: Lens' ComponentResponse (Maybe (HashMap Text PropertyResponse))
componentResponse_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe (HashMap Text PropertyResponse)
properties :: Maybe (HashMap Text PropertyResponse)
$sel:properties:ComponentResponse' :: ComponentResponse -> Maybe (HashMap Text PropertyResponse)
properties} -> Maybe (HashMap Text PropertyResponse)
properties) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe (HashMap Text PropertyResponse)
a -> ComponentResponse
s {$sel:properties:ComponentResponse' :: Maybe (HashMap Text PropertyResponse)
properties = Maybe (HashMap Text PropertyResponse)
a} :: ComponentResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The property groups.
componentResponse_propertyGroups :: Lens.Lens' ComponentResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text ComponentPropertyGroupResponse))
componentResponse_propertyGroups :: Lens'
  ComponentResponse
  (Maybe (HashMap Text ComponentPropertyGroupResponse))
componentResponse_propertyGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups :: Maybe (HashMap Text ComponentPropertyGroupResponse)
$sel:propertyGroups:ComponentResponse' :: ComponentResponse
-> Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups} -> Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe (HashMap Text ComponentPropertyGroupResponse)
a -> ComponentResponse
s {$sel:propertyGroups:ComponentResponse' :: Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups = Maybe (HashMap Text ComponentPropertyGroupResponse)
a} :: ComponentResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The status of the component type.
componentResponse_status :: Lens.Lens' ComponentResponse (Prelude.Maybe Status)
componentResponse_status :: Lens' ComponentResponse (Maybe Status)
componentResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe Status
status :: Maybe Status
$sel:status:ComponentResponse' :: ComponentResponse -> Maybe Status
status} -> Maybe Status
status) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe Status
a -> ComponentResponse
s {$sel:status:ComponentResponse' :: Maybe Status
status = Maybe Status
a} :: ComponentResponse)

-- | The syncSource of the sync job, if this entity was created by a sync
-- job.
componentResponse_syncSource :: Lens.Lens' ComponentResponse (Prelude.Maybe Prelude.Text)
componentResponse_syncSource :: Lens' ComponentResponse (Maybe Text)
componentResponse_syncSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentResponse' {Maybe Text
syncSource :: Maybe Text
$sel:syncSource:ComponentResponse' :: ComponentResponse -> Maybe Text
syncSource} -> Maybe Text
syncSource) (\s :: ComponentResponse
s@ComponentResponse' {} Maybe Text
a -> ComponentResponse
s {$sel:syncSource:ComponentResponse' :: Maybe Text
syncSource = Maybe Text
a} :: ComponentResponse)

instance Data.FromJSON ComponentResponse where
  parseJSON :: Value -> Parser ComponentResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComponentResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text PropertyResponse)
-> Maybe (HashMap Text ComponentPropertyGroupResponse)
-> Maybe Status
-> Maybe Text
-> ComponentResponse
ComponentResponse'
            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
"componentName")
            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
"componentTypeId")
            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
"definedIn")
            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
"description")
            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
"properties" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"propertyGroups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"status")
            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
"syncSource")
      )

instance Prelude.Hashable ComponentResponse where
  hashWithSalt :: Int -> ComponentResponse -> Int
hashWithSalt Int
_salt ComponentResponse' {Maybe Text
Maybe (HashMap Text ComponentPropertyGroupResponse)
Maybe (HashMap Text PropertyResponse)
Maybe Status
syncSource :: Maybe Text
status :: Maybe Status
propertyGroups :: Maybe (HashMap Text ComponentPropertyGroupResponse)
properties :: Maybe (HashMap Text PropertyResponse)
description :: Maybe Text
definedIn :: Maybe Text
componentTypeId :: Maybe Text
componentName :: Maybe Text
$sel:syncSource:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:status:ComponentResponse' :: ComponentResponse -> Maybe Status
$sel:propertyGroups:ComponentResponse' :: ComponentResponse
-> Maybe (HashMap Text ComponentPropertyGroupResponse)
$sel:properties:ComponentResponse' :: ComponentResponse -> Maybe (HashMap Text PropertyResponse)
$sel:description:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:definedIn:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:componentTypeId:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:componentName:ComponentResponse' :: ComponentResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentTypeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
definedIn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text PropertyResponse)
properties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Status
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
syncSource

instance Prelude.NFData ComponentResponse where
  rnf :: ComponentResponse -> ()
rnf ComponentResponse' {Maybe Text
Maybe (HashMap Text ComponentPropertyGroupResponse)
Maybe (HashMap Text PropertyResponse)
Maybe Status
syncSource :: Maybe Text
status :: Maybe Status
propertyGroups :: Maybe (HashMap Text ComponentPropertyGroupResponse)
properties :: Maybe (HashMap Text PropertyResponse)
description :: Maybe Text
definedIn :: Maybe Text
componentTypeId :: Maybe Text
componentName :: Maybe Text
$sel:syncSource:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:status:ComponentResponse' :: ComponentResponse -> Maybe Status
$sel:propertyGroups:ComponentResponse' :: ComponentResponse
-> Maybe (HashMap Text ComponentPropertyGroupResponse)
$sel:properties:ComponentResponse' :: ComponentResponse -> Maybe (HashMap Text PropertyResponse)
$sel:description:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:definedIn:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:componentTypeId:ComponentResponse' :: ComponentResponse -> Maybe Text
$sel:componentName:ComponentResponse' :: ComponentResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentTypeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
definedIn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text PropertyResponse)
properties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ComponentPropertyGroupResponse)
propertyGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Status
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
syncSource