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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 interiors per floorplan.
    WorldCount -> Maybe Int
interiorCountPerFloorplan :: Prelude.Maybe Prelude.Int,
    -- | The number of unique floorplans.
    WorldCount -> Maybe Int
floorplanCount :: Prelude.Maybe Prelude.Int
  }
  deriving (WorldCount -> WorldCount -> Bool
(WorldCount -> WorldCount -> Bool)
-> (WorldCount -> WorldCount -> Bool) -> Eq WorldCount
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]
(Int -> ReadS WorldCount)
-> ReadS [WorldCount]
-> ReadPrec WorldCount
-> ReadPrec [WorldCount]
-> Read 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
(Int -> WorldCount -> ShowS)
-> (WorldCount -> String)
-> ([WorldCount] -> ShowS)
-> Show WorldCount
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. WorldCount -> Rep WorldCount x)
-> (forall x. Rep WorldCount x -> WorldCount) -> Generic WorldCount
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:
--
-- 'interiorCountPerFloorplan', 'worldCount_interiorCountPerFloorplan' - The number of unique interiors per floorplan.
--
-- 'floorplanCount', 'worldCount_floorplanCount' - The number of unique floorplans.
newWorldCount ::
  WorldCount
newWorldCount :: WorldCount
newWorldCount =
  WorldCount' :: Maybe Int -> Maybe Int -> WorldCount
WorldCount'
    { $sel:interiorCountPerFloorplan:WorldCount' :: Maybe Int
interiorCountPerFloorplan =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:floorplanCount:WorldCount' :: Maybe Int
floorplanCount = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of unique interiors per floorplan.
worldCount_interiorCountPerFloorplan :: Lens.Lens' WorldCount (Prelude.Maybe Prelude.Int)
worldCount_interiorCountPerFloorplan :: (Maybe Int -> f (Maybe Int)) -> WorldCount -> f WorldCount
worldCount_interiorCountPerFloorplan = (WorldCount -> Maybe Int)
-> (WorldCount -> Maybe Int -> WorldCount)
-> Lens WorldCount WorldCount (Maybe Int) (Maybe Int)
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)

-- | The number of unique floorplans.
worldCount_floorplanCount :: Lens.Lens' WorldCount (Prelude.Maybe Prelude.Int)
worldCount_floorplanCount :: (Maybe Int -> f (Maybe Int)) -> WorldCount -> f WorldCount
worldCount_floorplanCount = (WorldCount -> Maybe Int)
-> (WorldCount -> Maybe Int -> WorldCount)
-> Lens WorldCount WorldCount (Maybe Int) (Maybe Int)
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)

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

instance Prelude.Hashable WorldCount

instance Prelude.NFData WorldCount

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