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

-- | Represents all of the information that is required to create a theme.
--
-- /See:/ 'newCreateThemeData' smart constructor.
data CreateThemeData = CreateThemeData'
  { -- | Describes the properties that can be overriden to customize an instance
    -- of the theme.
    CreateThemeData -> Maybe [ThemeValues]
overrides :: Prelude.Maybe [ThemeValues],
    -- | One or more key-value pairs to use when tagging the theme data.
    CreateThemeData -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the theme.
    CreateThemeData -> Text
name :: Prelude.Text,
    -- | A list of key-value pairs that defines the properties of the theme.
    CreateThemeData -> [ThemeValues]
values :: [ThemeValues]
  }
  deriving (CreateThemeData -> CreateThemeData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateThemeData -> CreateThemeData -> Bool
$c/= :: CreateThemeData -> CreateThemeData -> Bool
== :: CreateThemeData -> CreateThemeData -> Bool
$c== :: CreateThemeData -> CreateThemeData -> Bool
Prelude.Eq, ReadPrec [CreateThemeData]
ReadPrec CreateThemeData
Int -> ReadS CreateThemeData
ReadS [CreateThemeData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateThemeData]
$creadListPrec :: ReadPrec [CreateThemeData]
readPrec :: ReadPrec CreateThemeData
$creadPrec :: ReadPrec CreateThemeData
readList :: ReadS [CreateThemeData]
$creadList :: ReadS [CreateThemeData]
readsPrec :: Int -> ReadS CreateThemeData
$creadsPrec :: Int -> ReadS CreateThemeData
Prelude.Read, Int -> CreateThemeData -> ShowS
[CreateThemeData] -> ShowS
CreateThemeData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateThemeData] -> ShowS
$cshowList :: [CreateThemeData] -> ShowS
show :: CreateThemeData -> String
$cshow :: CreateThemeData -> String
showsPrec :: Int -> CreateThemeData -> ShowS
$cshowsPrec :: Int -> CreateThemeData -> ShowS
Prelude.Show, forall x. Rep CreateThemeData x -> CreateThemeData
forall x. CreateThemeData -> Rep CreateThemeData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateThemeData x -> CreateThemeData
$cfrom :: forall x. CreateThemeData -> Rep CreateThemeData x
Prelude.Generic)

-- |
-- Create a value of 'CreateThemeData' 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:
--
-- 'overrides', 'createThemeData_overrides' - Describes the properties that can be overriden to customize an instance
-- of the theme.
--
-- 'tags', 'createThemeData_tags' - One or more key-value pairs to use when tagging the theme data.
--
-- 'name', 'createThemeData_name' - The name of the theme.
--
-- 'values', 'createThemeData_values' - A list of key-value pairs that defines the properties of the theme.
newCreateThemeData ::
  -- | 'name'
  Prelude.Text ->
  CreateThemeData
newCreateThemeData :: Text -> CreateThemeData
newCreateThemeData Text
pName_ =
  CreateThemeData'
    { $sel:overrides:CreateThemeData' :: Maybe [ThemeValues]
overrides = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateThemeData' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateThemeData' :: Text
name = Text
pName_,
      $sel:values:CreateThemeData' :: [ThemeValues]
values = forall a. Monoid a => a
Prelude.mempty
    }

-- | Describes the properties that can be overriden to customize an instance
-- of the theme.
createThemeData_overrides :: Lens.Lens' CreateThemeData (Prelude.Maybe [ThemeValues])
createThemeData_overrides :: Lens' CreateThemeData (Maybe [ThemeValues])
createThemeData_overrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeData' {Maybe [ThemeValues]
overrides :: Maybe [ThemeValues]
$sel:overrides:CreateThemeData' :: CreateThemeData -> Maybe [ThemeValues]
overrides} -> Maybe [ThemeValues]
overrides) (\s :: CreateThemeData
s@CreateThemeData' {} Maybe [ThemeValues]
a -> CreateThemeData
s {$sel:overrides:CreateThemeData' :: Maybe [ThemeValues]
overrides = Maybe [ThemeValues]
a} :: CreateThemeData) 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 data.
createThemeData_tags :: Lens.Lens' CreateThemeData (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createThemeData_tags :: Lens' CreateThemeData (Maybe (HashMap Text Text))
createThemeData_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeData' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateThemeData' :: CreateThemeData -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateThemeData
s@CreateThemeData' {} Maybe (HashMap Text Text)
a -> CreateThemeData
s {$sel:tags:CreateThemeData' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateThemeData) 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 name of the theme.
createThemeData_name :: Lens.Lens' CreateThemeData Prelude.Text
createThemeData_name :: Lens' CreateThemeData Text
createThemeData_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeData' {Text
name :: Text
$sel:name:CreateThemeData' :: CreateThemeData -> Text
name} -> Text
name) (\s :: CreateThemeData
s@CreateThemeData' {} Text
a -> CreateThemeData
s {$sel:name:CreateThemeData' :: Text
name = Text
a} :: CreateThemeData)

-- | A list of key-value pairs that defines the properties of the theme.
createThemeData_values :: Lens.Lens' CreateThemeData [ThemeValues]
createThemeData_values :: Lens' CreateThemeData [ThemeValues]
createThemeData_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeData' {[ThemeValues]
values :: [ThemeValues]
$sel:values:CreateThemeData' :: CreateThemeData -> [ThemeValues]
values} -> [ThemeValues]
values) (\s :: CreateThemeData
s@CreateThemeData' {} [ThemeValues]
a -> CreateThemeData
s {$sel:values:CreateThemeData' :: [ThemeValues]
values = [ThemeValues]
a} :: CreateThemeData) 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 Prelude.Hashable CreateThemeData where
  hashWithSalt :: Int -> CreateThemeData -> Int
hashWithSalt Int
_salt CreateThemeData' {[ThemeValues]
Maybe [ThemeValues]
Maybe (HashMap Text Text)
Text
values :: [ThemeValues]
name :: Text
tags :: Maybe (HashMap Text Text)
overrides :: Maybe [ThemeValues]
$sel:values:CreateThemeData' :: CreateThemeData -> [ThemeValues]
$sel:name:CreateThemeData' :: CreateThemeData -> Text
$sel:tags:CreateThemeData' :: CreateThemeData -> Maybe (HashMap Text Text)
$sel:overrides:CreateThemeData' :: CreateThemeData -> Maybe [ThemeValues]
..} =
    Int
_salt
      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
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ThemeValues]
values

instance Prelude.NFData CreateThemeData where
  rnf :: CreateThemeData -> ()
rnf CreateThemeData' {[ThemeValues]
Maybe [ThemeValues]
Maybe (HashMap Text Text)
Text
values :: [ThemeValues]
name :: Text
tags :: Maybe (HashMap Text Text)
overrides :: Maybe [ThemeValues]
$sel:values:CreateThemeData' :: CreateThemeData -> [ThemeValues]
$sel:name:CreateThemeData' :: CreateThemeData -> Text
$sel:tags:CreateThemeData' :: CreateThemeData -> Maybe (HashMap Text Text)
$sel:overrides:CreateThemeData' :: CreateThemeData -> Maybe [ThemeValues]
..} =
    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
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ThemeValues]
values

instance Data.ToJSON CreateThemeData where
  toJSON :: CreateThemeData -> Value
toJSON CreateThemeData' {[ThemeValues]
Maybe [ThemeValues]
Maybe (HashMap Text Text)
Text
values :: [ThemeValues]
name :: Text
tags :: Maybe (HashMap Text Text)
overrides :: Maybe [ThemeValues]
$sel:values:CreateThemeData' :: CreateThemeData -> [ThemeValues]
$sel:name:CreateThemeData' :: CreateThemeData -> Text
$sel:tags:CreateThemeData' :: CreateThemeData -> Maybe (HashMap Text Text)
$sel:overrides:CreateThemeData' :: CreateThemeData -> Maybe [ThemeValues]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"overrides" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ThemeValues]
overrides,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [ThemeValues]
values)
          ]
      )