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

import Amazonka.AmplifyUiBuilder.Types.ThemeValues
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

-- | A theme is a collection of style settings that apply globally to the
-- components associated with an Amplify application.
--
-- /See:/ 'newTheme' smart constructor.
data Theme = Theme'
  { -- | The time that the theme was modified.
    Theme -> Maybe ISO8601
modifiedAt :: Prelude.Maybe Data.ISO8601,
    -- | Describes the properties that can be overriden to customize a theme.
    Theme -> Maybe [ThemeValues]
overrides :: Prelude.Maybe [ThemeValues],
    -- | One or more key-value pairs to use when tagging the theme.
    Theme -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique ID for the Amplify app associated with the theme.
    Theme -> Text
appId :: Prelude.Text,
    -- | The time that the theme was created.
    Theme -> ISO8601
createdAt :: Data.ISO8601,
    -- | The name of the backend environment that is a part of the Amplify app.
    Theme -> Text
environmentName :: Prelude.Text,
    -- | The ID for the theme.
    Theme -> Text
id :: Prelude.Text,
    -- | The name of the theme.
    Theme -> Text
name :: Prelude.Text,
    -- | A list of key-value pairs that defines the properties of the theme.
    Theme -> [ThemeValues]
values :: [ThemeValues]
  }
  deriving (Theme -> Theme -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Theme -> Theme -> Bool
$c/= :: Theme -> Theme -> Bool
== :: Theme -> Theme -> Bool
$c== :: Theme -> Theme -> Bool
Prelude.Eq, ReadPrec [Theme]
ReadPrec Theme
Int -> ReadS Theme
ReadS [Theme]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Theme]
$creadListPrec :: ReadPrec [Theme]
readPrec :: ReadPrec Theme
$creadPrec :: ReadPrec Theme
readList :: ReadS [Theme]
$creadList :: ReadS [Theme]
readsPrec :: Int -> ReadS Theme
$creadsPrec :: Int -> ReadS Theme
Prelude.Read, Int -> Theme -> ShowS
[Theme] -> ShowS
Theme -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Theme] -> ShowS
$cshowList :: [Theme] -> ShowS
show :: Theme -> String
$cshow :: Theme -> String
showsPrec :: Int -> Theme -> ShowS
$cshowsPrec :: Int -> Theme -> ShowS
Prelude.Show, forall x. Rep Theme x -> Theme
forall x. Theme -> Rep Theme x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Theme x -> Theme
$cfrom :: forall x. Theme -> Rep Theme x
Prelude.Generic)

-- |
-- Create a value of 'Theme' 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:
--
-- 'modifiedAt', 'theme_modifiedAt' - The time that the theme was modified.
--
-- 'overrides', 'theme_overrides' - Describes the properties that can be overriden to customize a theme.
--
-- 'tags', 'theme_tags' - One or more key-value pairs to use when tagging the theme.
--
-- 'appId', 'theme_appId' - The unique ID for the Amplify app associated with the theme.
--
-- 'createdAt', 'theme_createdAt' - The time that the theme was created.
--
-- 'environmentName', 'theme_environmentName' - The name of the backend environment that is a part of the Amplify app.
--
-- 'id', 'theme_id' - The ID for the theme.
--
-- 'name', 'theme_name' - The name of the theme.
--
-- 'values', 'theme_values' - A list of key-value pairs that defines the properties of the theme.
newTheme ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  Theme
newTheme :: Text -> UTCTime -> Text -> Text -> Text -> Theme
newTheme
  Text
pAppId_
  UTCTime
pCreatedAt_
  Text
pEnvironmentName_
  Text
pId_
  Text
pName_ =
    Theme'
      { $sel:modifiedAt:Theme' :: Maybe ISO8601
modifiedAt = forall a. Maybe a
Prelude.Nothing,
        $sel:overrides:Theme' :: Maybe [ThemeValues]
overrides = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:Theme' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:appId:Theme' :: Text
appId = Text
pAppId_,
        $sel:createdAt:Theme' :: ISO8601
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:environmentName:Theme' :: Text
environmentName = Text
pEnvironmentName_,
        $sel:id:Theme' :: Text
id = Text
pId_,
        $sel:name:Theme' :: Text
name = Text
pName_,
        $sel:values:Theme' :: [ThemeValues]
values = forall a. Monoid a => a
Prelude.mempty
      }

-- | The time that the theme was modified.
theme_modifiedAt :: Lens.Lens' Theme (Prelude.Maybe Prelude.UTCTime)
theme_modifiedAt :: Lens' Theme (Maybe UTCTime)
theme_modifiedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Theme' {Maybe ISO8601
modifiedAt :: Maybe ISO8601
$sel:modifiedAt:Theme' :: Theme -> Maybe ISO8601
modifiedAt} -> Maybe ISO8601
modifiedAt) (\s :: Theme
s@Theme' {} Maybe ISO8601
a -> Theme
s {$sel:modifiedAt:Theme' :: Maybe ISO8601
modifiedAt = Maybe ISO8601
a} :: Theme) 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

-- | Describes the properties that can be overriden to customize a theme.
theme_overrides :: Lens.Lens' Theme (Prelude.Maybe [ThemeValues])
theme_overrides :: Lens' Theme (Maybe [ThemeValues])
theme_overrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Theme' {Maybe [ThemeValues]
overrides :: Maybe [ThemeValues]
$sel:overrides:Theme' :: Theme -> Maybe [ThemeValues]
overrides} -> Maybe [ThemeValues]
overrides) (\s :: Theme
s@Theme' {} Maybe [ThemeValues]
a -> Theme
s {$sel:overrides:Theme' :: Maybe [ThemeValues]
overrides = Maybe [ThemeValues]
a} :: Theme) 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

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

-- | The time that the theme was created.
theme_createdAt :: Lens.Lens' Theme Prelude.UTCTime
theme_createdAt :: Lens' Theme UTCTime
theme_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Theme' {ISO8601
createdAt :: ISO8601
$sel:createdAt:Theme' :: Theme -> ISO8601
createdAt} -> ISO8601
createdAt) (\s :: Theme
s@Theme' {} ISO8601
a -> Theme
s {$sel:createdAt:Theme' :: ISO8601
createdAt = ISO8601
a} :: Theme) 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.
theme_environmentName :: Lens.Lens' Theme Prelude.Text
theme_environmentName :: Lens' Theme Text
theme_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Theme' {Text
environmentName :: Text
$sel:environmentName:Theme' :: Theme -> Text
environmentName} -> Text
environmentName) (\s :: Theme
s@Theme' {} Text
a -> Theme
s {$sel:environmentName:Theme' :: Text
environmentName = Text
a} :: Theme)

-- | The ID for the theme.
theme_id :: Lens.Lens' Theme Prelude.Text
theme_id :: Lens' Theme Text
theme_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Theme' {Text
id :: Text
$sel:id:Theme' :: Theme -> Text
id} -> Text
id) (\s :: Theme
s@Theme' {} Text
a -> Theme
s {$sel:id:Theme' :: Text
id = Text
a} :: Theme)

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

-- | A list of key-value pairs that defines the properties of the theme.
theme_values :: Lens.Lens' Theme [ThemeValues]
theme_values :: Lens' Theme [ThemeValues]
theme_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Theme' {[ThemeValues]
values :: [ThemeValues]
$sel:values:Theme' :: Theme -> [ThemeValues]
values} -> [ThemeValues]
values) (\s :: Theme
s@Theme' {} [ThemeValues]
a -> Theme
s {$sel:values:Theme' :: [ThemeValues]
values = [ThemeValues]
a} :: Theme) 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 Theme where
  parseJSON :: Value -> Parser Theme
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Theme"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe [ThemeValues]
-> Maybe (HashMap Text Text)
-> Text
-> ISO8601
-> Text
-> Text
-> Text
-> [ThemeValues]
-> Theme
Theme'
            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
"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
"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
"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 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
"values" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Theme where
  hashWithSalt :: Int -> Theme -> Int
hashWithSalt Int
_salt Theme' {[ThemeValues]
Maybe [ThemeValues]
Maybe (HashMap Text Text)
Maybe ISO8601
Text
ISO8601
values :: [ThemeValues]
name :: Text
id :: Text
environmentName :: Text
createdAt :: ISO8601
appId :: Text
tags :: Maybe (HashMap Text Text)
overrides :: Maybe [ThemeValues]
modifiedAt :: Maybe ISO8601
$sel:values:Theme' :: Theme -> [ThemeValues]
$sel:name:Theme' :: Theme -> Text
$sel:id:Theme' :: Theme -> Text
$sel:environmentName:Theme' :: Theme -> Text
$sel:createdAt:Theme' :: Theme -> ISO8601
$sel:appId:Theme' :: Theme -> Text
$sel:tags:Theme' :: Theme -> Maybe (HashMap Text Text)
$sel:overrides:Theme' :: Theme -> Maybe [ThemeValues]
$sel:modifiedAt:Theme' :: Theme -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
modifiedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ThemeValues]
overrides
      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` 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` [ThemeValues]
values

instance Prelude.NFData Theme where
  rnf :: Theme -> ()
rnf Theme' {[ThemeValues]
Maybe [ThemeValues]
Maybe (HashMap Text Text)
Maybe ISO8601
Text
ISO8601
values :: [ThemeValues]
name :: Text
id :: Text
environmentName :: Text
createdAt :: ISO8601
appId :: Text
tags :: Maybe (HashMap Text Text)
overrides :: Maybe [ThemeValues]
modifiedAt :: Maybe ISO8601
$sel:values:Theme' :: Theme -> [ThemeValues]
$sel:name:Theme' :: Theme -> Text
$sel:id:Theme' :: Theme -> Text
$sel:environmentName:Theme' :: Theme -> Text
$sel:createdAt:Theme' :: Theme -> ISO8601
$sel:appId:Theme' :: Theme -> Text
$sel:tags:Theme' :: Theme -> Maybe (HashMap Text Text)
$sel:overrides:Theme' :: Theme -> Maybe [ThemeValues]
$sel:modifiedAt:Theme' :: Theme -> Maybe ISO8601
..} =
    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 [ThemeValues]
overrides
      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 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 [ThemeValues]
values