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

import Amazonka.AmplifyUiBuilder.Types.ComponentBindingPropertiesValue
import Amazonka.AmplifyUiBuilder.Types.ComponentChild
import Amazonka.AmplifyUiBuilder.Types.ComponentDataConfiguration
import Amazonka.AmplifyUiBuilder.Types.ComponentEvent
import Amazonka.AmplifyUiBuilder.Types.ComponentProperty
import Amazonka.AmplifyUiBuilder.Types.ComponentVariant
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 the configuration settings for a user interface (UI) element
-- for an Amplify app. A component is configured as a primary, stand-alone
-- UI element. Use @ComponentChild@ to configure an instance of a
-- @Component@. A @ComponentChild@ instance inherits the configuration of
-- the main @Component@.
--
-- /See:/ 'newComponent' smart constructor.
data Component = Component'
  { -- | A list of the component\'s @ComponentChild@ instances.
    Component -> Maybe [ComponentChild]
children :: Prelude.Maybe [ComponentChild],
    -- | The data binding configuration for the component\'s properties. Use this
    -- for a collection component. You can\'t specify @tags@ as a valid
    -- property for @collectionProperties@.
    Component -> Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties :: Prelude.Maybe (Prelude.HashMap Prelude.Text ComponentDataConfiguration),
    -- | Describes the events that can be raised on the component. Use for the
    -- workflow feature in Amplify Studio that allows you to bind events and
    -- actions to components.
    Component -> Maybe (HashMap Text ComponentEvent)
events :: Prelude.Maybe (Prelude.HashMap Prelude.Text ComponentEvent),
    -- | The time that the component was modified.
    Component -> Maybe ISO8601
modifiedAt :: Prelude.Maybe Data.ISO8601,
    -- | The schema version of the component when it was imported.
    Component -> Maybe Text
schemaVersion :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of the component in its original source system, such as
    -- Figma.
    Component -> Maybe Text
sourceId :: Prelude.Maybe Prelude.Text,
    -- | One or more key-value pairs to use when tagging the component.
    Component -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique ID of the Amplify app associated with the component.
    Component -> Text
appId :: Prelude.Text,
    -- | The information to connect a component\'s properties to data at runtime.
    -- You can\'t specify @tags@ as a valid property for @bindingProperties@.
    Component -> HashMap Text ComponentBindingPropertiesValue
bindingProperties :: Prelude.HashMap Prelude.Text ComponentBindingPropertiesValue,
    -- | The type of the component. This can be an Amplify custom UI component or
    -- another custom component.
    Component -> Text
componentType :: Prelude.Text,
    -- | The time that the component was created.
    Component -> ISO8601
createdAt :: Data.ISO8601,
    -- | The name of the backend environment that is a part of the Amplify app.
    Component -> Text
environmentName :: Prelude.Text,
    -- | The unique ID of the component.
    Component -> Text
id :: Prelude.Text,
    -- | The name of the component.
    Component -> Text
name :: Prelude.Text,
    -- | Describes the component\'s properties that can be overriden in a
    -- customized instance of the component. You can\'t specify @tags@ as a
    -- valid property for @overrides@.
    Component -> HashMap Text (HashMap Text Text)
overrides :: Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Describes the component\'s properties. You can\'t specify @tags@ as a
    -- valid property for @properties@.
    Component -> HashMap Text ComponentProperty
properties :: Prelude.HashMap Prelude.Text ComponentProperty,
    -- | A list of the component\'s variants. A variant is a unique style
    -- configuration of a main component.
    Component -> [ComponentVariant]
variants :: [ComponentVariant]
  }
  deriving (Component -> Component -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Component -> Component -> Bool
$c/= :: Component -> Component -> Bool
== :: Component -> Component -> Bool
$c== :: Component -> Component -> Bool
Prelude.Eq, ReadPrec [Component]
ReadPrec Component
Int -> ReadS Component
ReadS [Component]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Component]
$creadListPrec :: ReadPrec [Component]
readPrec :: ReadPrec Component
$creadPrec :: ReadPrec Component
readList :: ReadS [Component]
$creadList :: ReadS [Component]
readsPrec :: Int -> ReadS Component
$creadsPrec :: Int -> ReadS Component
Prelude.Read, Int -> Component -> ShowS
[Component] -> ShowS
Component -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Component] -> ShowS
$cshowList :: [Component] -> ShowS
show :: Component -> String
$cshow :: Component -> String
showsPrec :: Int -> Component -> ShowS
$cshowsPrec :: Int -> Component -> ShowS
Prelude.Show, forall x. Rep Component x -> Component
forall x. Component -> Rep Component x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Component x -> Component
$cfrom :: forall x. Component -> Rep Component x
Prelude.Generic)

-- |
-- Create a value of 'Component' 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:
--
-- 'children', 'component_children' - A list of the component\'s @ComponentChild@ instances.
--
-- 'collectionProperties', 'component_collectionProperties' - The data binding configuration for the component\'s properties. Use this
-- for a collection component. You can\'t specify @tags@ as a valid
-- property for @collectionProperties@.
--
-- 'events', 'component_events' - Describes the events that can be raised on the component. Use for the
-- workflow feature in Amplify Studio that allows you to bind events and
-- actions to components.
--
-- 'modifiedAt', 'component_modifiedAt' - The time that the component was modified.
--
-- 'schemaVersion', 'component_schemaVersion' - The schema version of the component when it was imported.
--
-- 'sourceId', 'component_sourceId' - The unique ID of the component in its original source system, such as
-- Figma.
--
-- 'tags', 'component_tags' - One or more key-value pairs to use when tagging the component.
--
-- 'appId', 'component_appId' - The unique ID of the Amplify app associated with the component.
--
-- 'bindingProperties', 'component_bindingProperties' - The information to connect a component\'s properties to data at runtime.
-- You can\'t specify @tags@ as a valid property for @bindingProperties@.
--
-- 'componentType', 'component_componentType' - The type of the component. This can be an Amplify custom UI component or
-- another custom component.
--
-- 'createdAt', 'component_createdAt' - The time that the component was created.
--
-- 'environmentName', 'component_environmentName' - The name of the backend environment that is a part of the Amplify app.
--
-- 'id', 'component_id' - The unique ID of the component.
--
-- 'name', 'component_name' - The name of the component.
--
-- 'overrides', 'component_overrides' - Describes the component\'s properties that can be overriden in a
-- customized instance of the component. You can\'t specify @tags@ as a
-- valid property for @overrides@.
--
-- 'properties', 'component_properties' - Describes the component\'s properties. You can\'t specify @tags@ as a
-- valid property for @properties@.
--
-- 'variants', 'component_variants' - A list of the component\'s variants. A variant is a unique style
-- configuration of a main component.
newComponent ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'componentType'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  Component
newComponent :: Text -> Text -> UTCTime -> Text -> Text -> Text -> Component
newComponent
  Text
pAppId_
  Text
pComponentType_
  UTCTime
pCreatedAt_
  Text
pEnvironmentName_
  Text
pId_
  Text
pName_ =
    Component'
      { $sel:children:Component' :: Maybe [ComponentChild]
children = forall a. Maybe a
Prelude.Nothing,
        $sel:collectionProperties:Component' :: Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties = forall a. Maybe a
Prelude.Nothing,
        $sel:events:Component' :: Maybe (HashMap Text ComponentEvent)
events = forall a. Maybe a
Prelude.Nothing,
        $sel:modifiedAt:Component' :: Maybe ISO8601
modifiedAt = forall a. Maybe a
Prelude.Nothing,
        $sel:schemaVersion:Component' :: Maybe Text
schemaVersion = forall a. Maybe a
Prelude.Nothing,
        $sel:sourceId:Component' :: Maybe Text
sourceId = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:Component' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:appId:Component' :: Text
appId = Text
pAppId_,
        $sel:bindingProperties:Component' :: HashMap Text ComponentBindingPropertiesValue
bindingProperties = forall a. Monoid a => a
Prelude.mempty,
        $sel:componentType:Component' :: Text
componentType = Text
pComponentType_,
        $sel:createdAt:Component' :: ISO8601
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:environmentName:Component' :: Text
environmentName = Text
pEnvironmentName_,
        $sel:id:Component' :: Text
id = Text
pId_,
        $sel:name:Component' :: Text
name = Text
pName_,
        $sel:overrides:Component' :: HashMap Text (HashMap Text Text)
overrides = forall a. Monoid a => a
Prelude.mempty,
        $sel:properties:Component' :: HashMap Text ComponentProperty
properties = forall a. Monoid a => a
Prelude.mempty,
        $sel:variants:Component' :: [ComponentVariant]
variants = forall a. Monoid a => a
Prelude.mempty
      }

-- | A list of the component\'s @ComponentChild@ instances.
component_children :: Lens.Lens' Component (Prelude.Maybe [ComponentChild])
component_children :: Lens' Component (Maybe [ComponentChild])
component_children = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe [ComponentChild]
children :: Maybe [ComponentChild]
$sel:children:Component' :: Component -> Maybe [ComponentChild]
children} -> Maybe [ComponentChild]
children) (\s :: Component
s@Component' {} Maybe [ComponentChild]
a -> Component
s {$sel:children:Component' :: Maybe [ComponentChild]
children = Maybe [ComponentChild]
a} :: Component) 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 data binding configuration for the component\'s properties. Use this
-- for a collection component. You can\'t specify @tags@ as a valid
-- property for @collectionProperties@.
component_collectionProperties :: Lens.Lens' Component (Prelude.Maybe (Prelude.HashMap Prelude.Text ComponentDataConfiguration))
component_collectionProperties :: Lens' Component (Maybe (HashMap Text ComponentDataConfiguration))
component_collectionProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties :: Maybe (HashMap Text ComponentDataConfiguration)
$sel:collectionProperties:Component' :: Component -> Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties} -> Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties) (\s :: Component
s@Component' {} Maybe (HashMap Text ComponentDataConfiguration)
a -> Component
s {$sel:collectionProperties:Component' :: Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties = Maybe (HashMap Text ComponentDataConfiguration)
a} :: Component) 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

-- | Describes the events that can be raised on the component. Use for the
-- workflow feature in Amplify Studio that allows you to bind events and
-- actions to components.
component_events :: Lens.Lens' Component (Prelude.Maybe (Prelude.HashMap Prelude.Text ComponentEvent))
component_events :: Lens' Component (Maybe (HashMap Text ComponentEvent))
component_events = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe (HashMap Text ComponentEvent)
events :: Maybe (HashMap Text ComponentEvent)
$sel:events:Component' :: Component -> Maybe (HashMap Text ComponentEvent)
events} -> Maybe (HashMap Text ComponentEvent)
events) (\s :: Component
s@Component' {} Maybe (HashMap Text ComponentEvent)
a -> Component
s {$sel:events:Component' :: Maybe (HashMap Text ComponentEvent)
events = Maybe (HashMap Text ComponentEvent)
a} :: Component) 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 time that the component was modified.
component_modifiedAt :: Lens.Lens' Component (Prelude.Maybe Prelude.UTCTime)
component_modifiedAt :: Lens' Component (Maybe UTCTime)
component_modifiedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe ISO8601
modifiedAt :: Maybe ISO8601
$sel:modifiedAt:Component' :: Component -> Maybe ISO8601
modifiedAt} -> Maybe ISO8601
modifiedAt) (\s :: Component
s@Component' {} Maybe ISO8601
a -> Component
s {$sel:modifiedAt:Component' :: Maybe ISO8601
modifiedAt = Maybe ISO8601
a} :: Component) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The schema version of the component when it was imported.
component_schemaVersion :: Lens.Lens' Component (Prelude.Maybe Prelude.Text)
component_schemaVersion :: Lens' Component (Maybe Text)
component_schemaVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe Text
schemaVersion :: Maybe Text
$sel:schemaVersion:Component' :: Component -> Maybe Text
schemaVersion} -> Maybe Text
schemaVersion) (\s :: Component
s@Component' {} Maybe Text
a -> Component
s {$sel:schemaVersion:Component' :: Maybe Text
schemaVersion = Maybe Text
a} :: Component)

-- | The unique ID of the component in its original source system, such as
-- Figma.
component_sourceId :: Lens.Lens' Component (Prelude.Maybe Prelude.Text)
component_sourceId :: Lens' Component (Maybe Text)
component_sourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe Text
sourceId :: Maybe Text
$sel:sourceId:Component' :: Component -> Maybe Text
sourceId} -> Maybe Text
sourceId) (\s :: Component
s@Component' {} Maybe Text
a -> Component
s {$sel:sourceId:Component' :: Maybe Text
sourceId = Maybe Text
a} :: Component)

-- | One or more key-value pairs to use when tagging the component.
component_tags :: Lens.Lens' Component (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
component_tags :: Lens' Component (Maybe (HashMap Text Text))
component_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Component' :: Component -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Component
s@Component' {} Maybe (HashMap Text Text)
a -> Component
s {$sel:tags:Component' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Component) 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 unique ID of the Amplify app associated with the component.
component_appId :: Lens.Lens' Component Prelude.Text
component_appId :: Lens' Component Text
component_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Text
appId :: Text
$sel:appId:Component' :: Component -> Text
appId} -> Text
appId) (\s :: Component
s@Component' {} Text
a -> Component
s {$sel:appId:Component' :: Text
appId = Text
a} :: Component)

-- | The information to connect a component\'s properties to data at runtime.
-- You can\'t specify @tags@ as a valid property for @bindingProperties@.
component_bindingProperties :: Lens.Lens' Component (Prelude.HashMap Prelude.Text ComponentBindingPropertiesValue)
component_bindingProperties :: Lens' Component (HashMap Text ComponentBindingPropertiesValue)
component_bindingProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {HashMap Text ComponentBindingPropertiesValue
bindingProperties :: HashMap Text ComponentBindingPropertiesValue
$sel:bindingProperties:Component' :: Component -> HashMap Text ComponentBindingPropertiesValue
bindingProperties} -> HashMap Text ComponentBindingPropertiesValue
bindingProperties) (\s :: Component
s@Component' {} HashMap Text ComponentBindingPropertiesValue
a -> Component
s {$sel:bindingProperties:Component' :: HashMap Text ComponentBindingPropertiesValue
bindingProperties = HashMap Text ComponentBindingPropertiesValue
a} :: Component) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of the component. This can be an Amplify custom UI component or
-- another custom component.
component_componentType :: Lens.Lens' Component Prelude.Text
component_componentType :: Lens' Component Text
component_componentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {Text
componentType :: Text
$sel:componentType:Component' :: Component -> Text
componentType} -> Text
componentType) (\s :: Component
s@Component' {} Text
a -> Component
s {$sel:componentType:Component' :: Text
componentType = Text
a} :: Component)

-- | The time that the component was created.
component_createdAt :: Lens.Lens' Component Prelude.UTCTime
component_createdAt :: Lens' Component UTCTime
component_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {ISO8601
createdAt :: ISO8601
$sel:createdAt:Component' :: Component -> ISO8601
createdAt} -> ISO8601
createdAt) (\s :: Component
s@Component' {} ISO8601
a -> Component
s {$sel:createdAt:Component' :: ISO8601
createdAt = ISO8601
a} :: Component) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

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

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

-- | Describes the component\'s properties that can be overriden in a
-- customized instance of the component. You can\'t specify @tags@ as a
-- valid property for @overrides@.
component_overrides :: Lens.Lens' Component (Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text Prelude.Text))
component_overrides :: Lens' Component (HashMap Text (HashMap Text Text))
component_overrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {HashMap Text (HashMap Text Text)
overrides :: HashMap Text (HashMap Text Text)
$sel:overrides:Component' :: Component -> HashMap Text (HashMap Text Text)
overrides} -> HashMap Text (HashMap Text Text)
overrides) (\s :: Component
s@Component' {} HashMap Text (HashMap Text Text)
a -> Component
s {$sel:overrides:Component' :: HashMap Text (HashMap Text Text)
overrides = HashMap Text (HashMap Text Text)
a} :: Component) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes the component\'s properties. You can\'t specify @tags@ as a
-- valid property for @properties@.
component_properties :: Lens.Lens' Component (Prelude.HashMap Prelude.Text ComponentProperty)
component_properties :: Lens' Component (HashMap Text ComponentProperty)
component_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {HashMap Text ComponentProperty
properties :: HashMap Text ComponentProperty
$sel:properties:Component' :: Component -> HashMap Text ComponentProperty
properties} -> HashMap Text ComponentProperty
properties) (\s :: Component
s@Component' {} HashMap Text ComponentProperty
a -> Component
s {$sel:properties:Component' :: HashMap Text ComponentProperty
properties = HashMap Text ComponentProperty
a} :: Component) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of the component\'s variants. A variant is a unique style
-- configuration of a main component.
component_variants :: Lens.Lens' Component [ComponentVariant]
component_variants :: Lens' Component [ComponentVariant]
component_variants = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Component' {[ComponentVariant]
variants :: [ComponentVariant]
$sel:variants:Component' :: Component -> [ComponentVariant]
variants} -> [ComponentVariant]
variants) (\s :: Component
s@Component' {} [ComponentVariant]
a -> Component
s {$sel:variants:Component' :: [ComponentVariant]
variants = [ComponentVariant]
a} :: Component) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Component where
  parseJSON :: Value -> Parser Component
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Component"
      ( \Object
x ->
          Maybe [ComponentChild]
-> Maybe (HashMap Text ComponentDataConfiguration)
-> Maybe (HashMap Text ComponentEvent)
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> HashMap Text ComponentBindingPropertiesValue
-> Text
-> ISO8601
-> Text
-> Text
-> Text
-> HashMap Text (HashMap Text Text)
-> HashMap Text ComponentProperty
-> [ComponentVariant]
-> Component
Component'
            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
"children" 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
"collectionProperties"
                            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
"events" 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
"modifiedAt")
            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
"schemaVersion")
            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
"sourceId")
            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
"tags" 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 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 (Maybe a)
Data..:? Key
"bindingProperties"
                            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 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
"createdAt")
            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")
            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
"overrides" 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
"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
"variants" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Component where
  hashWithSalt :: Int -> Component -> Int
hashWithSalt Int
_salt Component' {[ComponentVariant]
Maybe [ComponentChild]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ComponentEvent)
Maybe (HashMap Text ComponentDataConfiguration)
Maybe ISO8601
Text
HashMap Text (HashMap Text Text)
HashMap Text ComponentProperty
HashMap Text ComponentBindingPropertiesValue
ISO8601
variants :: [ComponentVariant]
properties :: HashMap Text ComponentProperty
overrides :: HashMap Text (HashMap Text Text)
name :: Text
id :: Text
environmentName :: Text
createdAt :: ISO8601
componentType :: Text
bindingProperties :: HashMap Text ComponentBindingPropertiesValue
appId :: Text
tags :: Maybe (HashMap Text Text)
sourceId :: Maybe Text
schemaVersion :: Maybe Text
modifiedAt :: Maybe ISO8601
events :: Maybe (HashMap Text ComponentEvent)
collectionProperties :: Maybe (HashMap Text ComponentDataConfiguration)
children :: Maybe [ComponentChild]
$sel:variants:Component' :: Component -> [ComponentVariant]
$sel:properties:Component' :: Component -> HashMap Text ComponentProperty
$sel:overrides:Component' :: Component -> HashMap Text (HashMap Text Text)
$sel:name:Component' :: Component -> Text
$sel:id:Component' :: Component -> Text
$sel:environmentName:Component' :: Component -> Text
$sel:createdAt:Component' :: Component -> ISO8601
$sel:componentType:Component' :: Component -> Text
$sel:bindingProperties:Component' :: Component -> HashMap Text ComponentBindingPropertiesValue
$sel:appId:Component' :: Component -> Text
$sel:tags:Component' :: Component -> Maybe (HashMap Text Text)
$sel:sourceId:Component' :: Component -> Maybe Text
$sel:schemaVersion:Component' :: Component -> Maybe Text
$sel:modifiedAt:Component' :: Component -> Maybe ISO8601
$sel:events:Component' :: Component -> Maybe (HashMap Text ComponentEvent)
$sel:collectionProperties:Component' :: Component -> Maybe (HashMap Text ComponentDataConfiguration)
$sel:children:Component' :: Component -> Maybe [ComponentChild]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ComponentChild]
children
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ComponentEvent)
events
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
modifiedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
schemaVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text ComponentBindingPropertiesValue
bindingProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
createdAt
      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
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text (HashMap Text Text)
overrides
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text ComponentProperty
properties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ComponentVariant]
variants

instance Prelude.NFData Component where
  rnf :: Component -> ()
rnf Component' {[ComponentVariant]
Maybe [ComponentChild]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ComponentEvent)
Maybe (HashMap Text ComponentDataConfiguration)
Maybe ISO8601
Text
HashMap Text (HashMap Text Text)
HashMap Text ComponentProperty
HashMap Text ComponentBindingPropertiesValue
ISO8601
variants :: [ComponentVariant]
properties :: HashMap Text ComponentProperty
overrides :: HashMap Text (HashMap Text Text)
name :: Text
id :: Text
environmentName :: Text
createdAt :: ISO8601
componentType :: Text
bindingProperties :: HashMap Text ComponentBindingPropertiesValue
appId :: Text
tags :: Maybe (HashMap Text Text)
sourceId :: Maybe Text
schemaVersion :: Maybe Text
modifiedAt :: Maybe ISO8601
events :: Maybe (HashMap Text ComponentEvent)
collectionProperties :: Maybe (HashMap Text ComponentDataConfiguration)
children :: Maybe [ComponentChild]
$sel:variants:Component' :: Component -> [ComponentVariant]
$sel:properties:Component' :: Component -> HashMap Text ComponentProperty
$sel:overrides:Component' :: Component -> HashMap Text (HashMap Text Text)
$sel:name:Component' :: Component -> Text
$sel:id:Component' :: Component -> Text
$sel:environmentName:Component' :: Component -> Text
$sel:createdAt:Component' :: Component -> ISO8601
$sel:componentType:Component' :: Component -> Text
$sel:bindingProperties:Component' :: Component -> HashMap Text ComponentBindingPropertiesValue
$sel:appId:Component' :: Component -> Text
$sel:tags:Component' :: Component -> Maybe (HashMap Text Text)
$sel:sourceId:Component' :: Component -> Maybe Text
$sel:schemaVersion:Component' :: Component -> Maybe Text
$sel:modifiedAt:Component' :: Component -> Maybe ISO8601
$sel:events:Component' :: Component -> Maybe (HashMap Text ComponentEvent)
$sel:collectionProperties:Component' :: Component -> Maybe (HashMap Text ComponentDataConfiguration)
$sel:children:Component' :: Component -> Maybe [ComponentChild]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ComponentChild]
children
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ComponentDataConfiguration)
collectionProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ComponentEvent)
events
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
modifiedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
schemaVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 HashMap Text ComponentBindingPropertiesValue
bindingProperties
      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 ISO8601
createdAt
      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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text (HashMap Text Text)
overrides
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text ComponentProperty
properties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ComponentVariant]
variants