{-# 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.SimSpaceWeaver.Types.LiveSimulationState
-- 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.SimSpaceWeaver.Types.LiveSimulationState where

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
import Amazonka.SimSpaceWeaver.Types.Domain
import Amazonka.SimSpaceWeaver.Types.SimulationClock

-- | A collection of additional state information, such as domain and clock
-- configuration.
--
-- /See:/ 'newLiveSimulationState' smart constructor.
data LiveSimulationState = LiveSimulationState'
  { -- | A list of simulation clocks.
    --
    -- At this time, a simulation has only one clock.
    LiveSimulationState -> Maybe [SimulationClock]
clocks :: Prelude.Maybe [SimulationClock],
    -- | A list of domains for the simulation. For more information about
    -- domains, see
    -- <https://docs.aws.amazon.com/simspaceweaver/latest/userguide/what-is_key-concepts.html Key concepts>
    -- in the /Amazon Web Services SimSpace Weaver User Guide/.
    LiveSimulationState -> Maybe [Domain]
domains :: Prelude.Maybe [Domain]
  }
  deriving (LiveSimulationState -> LiveSimulationState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LiveSimulationState -> LiveSimulationState -> Bool
$c/= :: LiveSimulationState -> LiveSimulationState -> Bool
== :: LiveSimulationState -> LiveSimulationState -> Bool
$c== :: LiveSimulationState -> LiveSimulationState -> Bool
Prelude.Eq, ReadPrec [LiveSimulationState]
ReadPrec LiveSimulationState
Int -> ReadS LiveSimulationState
ReadS [LiveSimulationState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LiveSimulationState]
$creadListPrec :: ReadPrec [LiveSimulationState]
readPrec :: ReadPrec LiveSimulationState
$creadPrec :: ReadPrec LiveSimulationState
readList :: ReadS [LiveSimulationState]
$creadList :: ReadS [LiveSimulationState]
readsPrec :: Int -> ReadS LiveSimulationState
$creadsPrec :: Int -> ReadS LiveSimulationState
Prelude.Read, Int -> LiveSimulationState -> ShowS
[LiveSimulationState] -> ShowS
LiveSimulationState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LiveSimulationState] -> ShowS
$cshowList :: [LiveSimulationState] -> ShowS
show :: LiveSimulationState -> String
$cshow :: LiveSimulationState -> String
showsPrec :: Int -> LiveSimulationState -> ShowS
$cshowsPrec :: Int -> LiveSimulationState -> ShowS
Prelude.Show, forall x. Rep LiveSimulationState x -> LiveSimulationState
forall x. LiveSimulationState -> Rep LiveSimulationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LiveSimulationState x -> LiveSimulationState
$cfrom :: forall x. LiveSimulationState -> Rep LiveSimulationState x
Prelude.Generic)

-- |
-- Create a value of 'LiveSimulationState' 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:
--
-- 'clocks', 'liveSimulationState_clocks' - A list of simulation clocks.
--
-- At this time, a simulation has only one clock.
--
-- 'domains', 'liveSimulationState_domains' - A list of domains for the simulation. For more information about
-- domains, see
-- <https://docs.aws.amazon.com/simspaceweaver/latest/userguide/what-is_key-concepts.html Key concepts>
-- in the /Amazon Web Services SimSpace Weaver User Guide/.
newLiveSimulationState ::
  LiveSimulationState
newLiveSimulationState :: LiveSimulationState
newLiveSimulationState =
  LiveSimulationState'
    { $sel:clocks:LiveSimulationState' :: Maybe [SimulationClock]
clocks = forall a. Maybe a
Prelude.Nothing,
      $sel:domains:LiveSimulationState' :: Maybe [Domain]
domains = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of simulation clocks.
--
-- At this time, a simulation has only one clock.
liveSimulationState_clocks :: Lens.Lens' LiveSimulationState (Prelude.Maybe [SimulationClock])
liveSimulationState_clocks :: Lens' LiveSimulationState (Maybe [SimulationClock])
liveSimulationState_clocks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSimulationState' {Maybe [SimulationClock]
clocks :: Maybe [SimulationClock]
$sel:clocks:LiveSimulationState' :: LiveSimulationState -> Maybe [SimulationClock]
clocks} -> Maybe [SimulationClock]
clocks) (\s :: LiveSimulationState
s@LiveSimulationState' {} Maybe [SimulationClock]
a -> LiveSimulationState
s {$sel:clocks:LiveSimulationState' :: Maybe [SimulationClock]
clocks = Maybe [SimulationClock]
a} :: LiveSimulationState) 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

-- | A list of domains for the simulation. For more information about
-- domains, see
-- <https://docs.aws.amazon.com/simspaceweaver/latest/userguide/what-is_key-concepts.html Key concepts>
-- in the /Amazon Web Services SimSpace Weaver User Guide/.
liveSimulationState_domains :: Lens.Lens' LiveSimulationState (Prelude.Maybe [Domain])
liveSimulationState_domains :: Lens' LiveSimulationState (Maybe [Domain])
liveSimulationState_domains = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSimulationState' {Maybe [Domain]
domains :: Maybe [Domain]
$sel:domains:LiveSimulationState' :: LiveSimulationState -> Maybe [Domain]
domains} -> Maybe [Domain]
domains) (\s :: LiveSimulationState
s@LiveSimulationState' {} Maybe [Domain]
a -> LiveSimulationState
s {$sel:domains:LiveSimulationState' :: Maybe [Domain]
domains = Maybe [Domain]
a} :: LiveSimulationState) 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

instance Data.FromJSON LiveSimulationState where
  parseJSON :: Value -> Parser LiveSimulationState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LiveSimulationState"
      ( \Object
x ->
          Maybe [SimulationClock] -> Maybe [Domain] -> LiveSimulationState
LiveSimulationState'
            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
"Clocks" 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
"Domains" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable LiveSimulationState where
  hashWithSalt :: Int -> LiveSimulationState -> Int
hashWithSalt Int
_salt LiveSimulationState' {Maybe [Domain]
Maybe [SimulationClock]
domains :: Maybe [Domain]
clocks :: Maybe [SimulationClock]
$sel:domains:LiveSimulationState' :: LiveSimulationState -> Maybe [Domain]
$sel:clocks:LiveSimulationState' :: LiveSimulationState -> Maybe [SimulationClock]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SimulationClock]
clocks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Domain]
domains

instance Prelude.NFData LiveSimulationState where
  rnf :: LiveSimulationState -> ()
rnf LiveSimulationState' {Maybe [Domain]
Maybe [SimulationClock]
domains :: Maybe [Domain]
clocks :: Maybe [SimulationClock]
$sel:domains:LiveSimulationState' :: LiveSimulationState -> Maybe [Domain]
$sel:clocks:LiveSimulationState' :: LiveSimulationState -> Maybe [SimulationClock]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SimulationClock]
clocks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Domain]
domains