{-# 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.RobOMaker.Types.RenderingEngine
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.RobOMaker.Types.RenderingEngine where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.RenderingEngineType

-- | Information about a rendering engine.
--
-- /See:/ 'newRenderingEngine' smart constructor.
data RenderingEngine = RenderingEngine'
  { -- | The name of the rendering engine.
    RenderingEngine -> Maybe RenderingEngineType
name :: Prelude.Maybe RenderingEngineType,
    -- | The version of the rendering engine.
    RenderingEngine -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (RenderingEngine -> RenderingEngine -> Bool
(RenderingEngine -> RenderingEngine -> Bool)
-> (RenderingEngine -> RenderingEngine -> Bool)
-> Eq RenderingEngine
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenderingEngine -> RenderingEngine -> Bool
$c/= :: RenderingEngine -> RenderingEngine -> Bool
== :: RenderingEngine -> RenderingEngine -> Bool
$c== :: RenderingEngine -> RenderingEngine -> Bool
Prelude.Eq, ReadPrec [RenderingEngine]
ReadPrec RenderingEngine
Int -> ReadS RenderingEngine
ReadS [RenderingEngine]
(Int -> ReadS RenderingEngine)
-> ReadS [RenderingEngine]
-> ReadPrec RenderingEngine
-> ReadPrec [RenderingEngine]
-> Read RenderingEngine
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenderingEngine]
$creadListPrec :: ReadPrec [RenderingEngine]
readPrec :: ReadPrec RenderingEngine
$creadPrec :: ReadPrec RenderingEngine
readList :: ReadS [RenderingEngine]
$creadList :: ReadS [RenderingEngine]
readsPrec :: Int -> ReadS RenderingEngine
$creadsPrec :: Int -> ReadS RenderingEngine
Prelude.Read, Int -> RenderingEngine -> ShowS
[RenderingEngine] -> ShowS
RenderingEngine -> String
(Int -> RenderingEngine -> ShowS)
-> (RenderingEngine -> String)
-> ([RenderingEngine] -> ShowS)
-> Show RenderingEngine
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenderingEngine] -> ShowS
$cshowList :: [RenderingEngine] -> ShowS
show :: RenderingEngine -> String
$cshow :: RenderingEngine -> String
showsPrec :: Int -> RenderingEngine -> ShowS
$cshowsPrec :: Int -> RenderingEngine -> ShowS
Prelude.Show, (forall x. RenderingEngine -> Rep RenderingEngine x)
-> (forall x. Rep RenderingEngine x -> RenderingEngine)
-> Generic RenderingEngine
forall x. Rep RenderingEngine x -> RenderingEngine
forall x. RenderingEngine -> Rep RenderingEngine x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenderingEngine x -> RenderingEngine
$cfrom :: forall x. RenderingEngine -> Rep RenderingEngine x
Prelude.Generic)

-- |
-- Create a value of 'RenderingEngine' 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:
--
-- 'name', 'renderingEngine_name' - The name of the rendering engine.
--
-- 'version', 'renderingEngine_version' - The version of the rendering engine.
newRenderingEngine ::
  RenderingEngine
newRenderingEngine :: RenderingEngine
newRenderingEngine =
  RenderingEngine' :: Maybe RenderingEngineType -> Maybe Text -> RenderingEngine
RenderingEngine'
    { $sel:name:RenderingEngine' :: Maybe RenderingEngineType
name = Maybe RenderingEngineType
forall a. Maybe a
Prelude.Nothing,
      $sel:version:RenderingEngine' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the rendering engine.
renderingEngine_name :: Lens.Lens' RenderingEngine (Prelude.Maybe RenderingEngineType)
renderingEngine_name :: (Maybe RenderingEngineType -> f (Maybe RenderingEngineType))
-> RenderingEngine -> f RenderingEngine
renderingEngine_name = (RenderingEngine -> Maybe RenderingEngineType)
-> (RenderingEngine
    -> Maybe RenderingEngineType -> RenderingEngine)
-> Lens
     RenderingEngine
     RenderingEngine
     (Maybe RenderingEngineType)
     (Maybe RenderingEngineType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenderingEngine' {Maybe RenderingEngineType
name :: Maybe RenderingEngineType
$sel:name:RenderingEngine' :: RenderingEngine -> Maybe RenderingEngineType
name} -> Maybe RenderingEngineType
name) (\s :: RenderingEngine
s@RenderingEngine' {} Maybe RenderingEngineType
a -> RenderingEngine
s {$sel:name:RenderingEngine' :: Maybe RenderingEngineType
name = Maybe RenderingEngineType
a} :: RenderingEngine)

-- | The version of the rendering engine.
renderingEngine_version :: Lens.Lens' RenderingEngine (Prelude.Maybe Prelude.Text)
renderingEngine_version :: (Maybe Text -> f (Maybe Text))
-> RenderingEngine -> f RenderingEngine
renderingEngine_version = (RenderingEngine -> Maybe Text)
-> (RenderingEngine -> Maybe Text -> RenderingEngine)
-> Lens RenderingEngine RenderingEngine (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenderingEngine' {Maybe Text
version :: Maybe Text
$sel:version:RenderingEngine' :: RenderingEngine -> Maybe Text
version} -> Maybe Text
version) (\s :: RenderingEngine
s@RenderingEngine' {} Maybe Text
a -> RenderingEngine
s {$sel:version:RenderingEngine' :: Maybe Text
version = Maybe Text
a} :: RenderingEngine)

instance Core.FromJSON RenderingEngine where
  parseJSON :: Value -> Parser RenderingEngine
parseJSON =
    String
-> (Object -> Parser RenderingEngine)
-> Value
-> Parser RenderingEngine
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RenderingEngine"
      ( \Object
x ->
          Maybe RenderingEngineType -> Maybe Text -> RenderingEngine
RenderingEngine'
            (Maybe RenderingEngineType -> Maybe Text -> RenderingEngine)
-> Parser (Maybe RenderingEngineType)
-> Parser (Maybe Text -> RenderingEngine)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RenderingEngineType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe Text -> RenderingEngine)
-> Parser (Maybe Text) -> Parser RenderingEngine
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"version")
      )

instance Prelude.Hashable RenderingEngine

instance Prelude.NFData RenderingEngine

instance Core.ToJSON RenderingEngine where
  toJSON :: RenderingEngine -> Value
toJSON RenderingEngine' {Maybe Text
Maybe RenderingEngineType
version :: Maybe Text
name :: Maybe RenderingEngineType
$sel:version:RenderingEngine' :: RenderingEngine -> Maybe Text
$sel:name:RenderingEngine' :: RenderingEngine -> Maybe RenderingEngineType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"name" Text -> RenderingEngineType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RenderingEngineType -> Pair)
-> Maybe RenderingEngineType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RenderingEngineType
name,
            (Text
"version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
version
          ]
      )