{-# 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.WorldCount
-- 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.RobOMaker.Types.WorldCount 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

-- | The number of worlds that will be created. You can configure the number
-- of unique floorplans and the number of unique interiors for each floor
-- plan. For example, if you want 1 world with 20 unique interiors, you set
-- @floorplanCount = 1@ and @interiorCountPerFloorplan = 20@. This will
-- result in 20 worlds (@floorplanCount@ * @interiorCountPerFloorplan)@.
--
-- If you set @floorplanCount = 4@ and @interiorCountPerFloorplan = 5@,
-- there will be 20 worlds with 5 unique floor plans.
--
-- /See:/ 'newWorldCount' smart constructor.
data WorldCount = WorldCount'
  { -- | The number of unique floorplans.
    WorldCount -> Maybe Int
floorplanCount :: Prelude.Maybe Prelude.Int,
    -- | The number of unique interiors per floorplan.
    WorldCount -> Maybe Int
interiorCountPerFloorplan :: Prelude.Maybe Prelude.Int
  }
  deriving (WorldCount -> WorldCount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorldCount -> WorldCount -> Bool
$c/= :: WorldCount -> WorldCount -> Bool
== :: WorldCount -> WorldCount -> Bool
$c== :: WorldCount -> WorldCount -> Bool
Prelude.Eq, ReadPrec [WorldCount]
ReadPrec WorldCount
Int -> ReadS WorldCount
ReadS [WorldCount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorldCount]
$creadListPrec :: ReadPrec [WorldCount]
readPrec :: ReadPrec WorldCount
$creadPrec :: ReadPrec WorldCount
readList :: ReadS [WorldCount]
$creadList :: ReadS [WorldCount]
readsPrec :: Int -> ReadS WorldCount
$creadsPrec :: Int -> ReadS WorldCount
Prelude.Read, Int -> WorldCount -> ShowS
[WorldCount] -> ShowS
WorldCount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorldCount] -> ShowS
$cshowList :: [WorldCount] -> ShowS
show :: WorldCount -> String
$cshow :: WorldCount -> String
showsPrec :: Int -> WorldCount -> ShowS
$cshowsPrec :: Int -> WorldCount -> ShowS
Prelude.Show, forall x. Rep WorldCount x -> WorldCount
forall x. WorldCount -> Rep WorldCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorldCount x -> WorldCount
$cfrom :: forall x. WorldCount -> Rep WorldCount x
Prelude.Generic)

-- |
-- Create a value of 'WorldCount' 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:
--
-- 'floorplanCount', 'worldCount_floorplanCount' - The number of unique floorplans.
--
-- 'interiorCountPerFloorplan', 'worldCount_interiorCountPerFloorplan' - The number of unique interiors per floorplan.
newWorldCount ::
  WorldCount
newWorldCount :: WorldCount
newWorldCount =
  WorldCount'
    { $sel:floorplanCount:WorldCount' :: Maybe Int
floorplanCount = forall a. Maybe a
Prelude.Nothing,
      $sel:interiorCountPerFloorplan:WorldCount' :: Maybe Int
interiorCountPerFloorplan = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of unique floorplans.
worldCount_floorplanCount :: Lens.Lens' WorldCount (Prelude.Maybe Prelude.Int)
worldCount_floorplanCount :: Lens' WorldCount (Maybe Int)
worldCount_floorplanCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorldCount' {Maybe Int
floorplanCount :: Maybe Int
$sel:floorplanCount:WorldCount' :: WorldCount -> Maybe Int
floorplanCount} -> Maybe Int
floorplanCount) (\s :: WorldCount
s@WorldCount' {} Maybe Int
a -> WorldCount
s {$sel:floorplanCount:WorldCount' :: Maybe Int
floorplanCount = Maybe Int
a} :: WorldCount)

-- | The number of unique interiors per floorplan.
worldCount_interiorCountPerFloorplan :: Lens.Lens' WorldCount (Prelude.Maybe Prelude.Int)
worldCount_interiorCountPerFloorplan :: Lens' WorldCount (Maybe Int)
worldCount_interiorCountPerFloorplan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorldCount' {Maybe Int
interiorCountPerFloorplan :: Maybe Int
$sel:interiorCountPerFloorplan:WorldCount' :: WorldCount -> Maybe Int
interiorCountPerFloorplan} -> Maybe Int
interiorCountPerFloorplan) (\s :: WorldCount
s@WorldCount' {} Maybe Int
a -> WorldCount
s {$sel:interiorCountPerFloorplan:WorldCount' :: Maybe Int
interiorCountPerFloorplan = Maybe Int
a} :: WorldCount)

instance Data.FromJSON WorldCount where
  parseJSON :: Value -> Parser WorldCount
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorldCount"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> WorldCount
WorldCount'
            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
"floorplanCount")
            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
"interiorCountPerFloorplan")
      )

instance Prelude.Hashable WorldCount where
  hashWithSalt :: Int -> WorldCount -> Int
hashWithSalt Int
_salt WorldCount' {Maybe Int
interiorCountPerFloorplan :: Maybe Int
floorplanCount :: Maybe Int
$sel:interiorCountPerFloorplan:WorldCount' :: WorldCount -> Maybe Int
$sel:floorplanCount:WorldCount' :: WorldCount -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
floorplanCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
interiorCountPerFloorplan

instance Prelude.NFData WorldCount where
  rnf :: WorldCount -> ()
rnf WorldCount' {Maybe Int
interiorCountPerFloorplan :: Maybe Int
floorplanCount :: Maybe Int
$sel:interiorCountPerFloorplan:WorldCount' :: WorldCount -> Maybe Int
$sel:floorplanCount:WorldCount' :: WorldCount -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
floorplanCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
interiorCountPerFloorplan

instance Data.ToJSON WorldCount where
  toJSON :: WorldCount -> Value
toJSON WorldCount' {Maybe Int
interiorCountPerFloorplan :: Maybe Int
floorplanCount :: Maybe Int
$sel:interiorCountPerFloorplan:WorldCount' :: WorldCount -> Maybe Int
$sel:floorplanCount:WorldCount' :: WorldCount -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"floorplanCount" 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 Int
floorplanCount,
            (Key
"interiorCountPerFloorplan" 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 Int
interiorCountPerFloorplan
          ]
      )