{-# 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.PrivateNetworks.Types.SitePlan
-- 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.PrivateNetworks.Types.SitePlan 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.PrivateNetworks.Types.NameValuePair
import Amazonka.PrivateNetworks.Types.NetworkResourceDefinition

-- | Information about a site plan.
--
-- /See:/ 'newSitePlan' smart constructor.
data SitePlan = SitePlan'
  { -- | The options of the plan.
    SitePlan -> Maybe [NameValuePair]
options :: Prelude.Maybe [NameValuePair],
    -- | The resource definitions of the plan.
    SitePlan -> Maybe [NetworkResourceDefinition]
resourceDefinitions :: Prelude.Maybe [NetworkResourceDefinition]
  }
  deriving (SitePlan -> SitePlan -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SitePlan -> SitePlan -> Bool
$c/= :: SitePlan -> SitePlan -> Bool
== :: SitePlan -> SitePlan -> Bool
$c== :: SitePlan -> SitePlan -> Bool
Prelude.Eq, ReadPrec [SitePlan]
ReadPrec SitePlan
Int -> ReadS SitePlan
ReadS [SitePlan]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SitePlan]
$creadListPrec :: ReadPrec [SitePlan]
readPrec :: ReadPrec SitePlan
$creadPrec :: ReadPrec SitePlan
readList :: ReadS [SitePlan]
$creadList :: ReadS [SitePlan]
readsPrec :: Int -> ReadS SitePlan
$creadsPrec :: Int -> ReadS SitePlan
Prelude.Read, Int -> SitePlan -> ShowS
[SitePlan] -> ShowS
SitePlan -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SitePlan] -> ShowS
$cshowList :: [SitePlan] -> ShowS
show :: SitePlan -> String
$cshow :: SitePlan -> String
showsPrec :: Int -> SitePlan -> ShowS
$cshowsPrec :: Int -> SitePlan -> ShowS
Prelude.Show, forall x. Rep SitePlan x -> SitePlan
forall x. SitePlan -> Rep SitePlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SitePlan x -> SitePlan
$cfrom :: forall x. SitePlan -> Rep SitePlan x
Prelude.Generic)

-- |
-- Create a value of 'SitePlan' 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:
--
-- 'options', 'sitePlan_options' - The options of the plan.
--
-- 'resourceDefinitions', 'sitePlan_resourceDefinitions' - The resource definitions of the plan.
newSitePlan ::
  SitePlan
newSitePlan :: SitePlan
newSitePlan =
  SitePlan'
    { $sel:options:SitePlan' :: Maybe [NameValuePair]
options = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceDefinitions:SitePlan' :: Maybe [NetworkResourceDefinition]
resourceDefinitions = forall a. Maybe a
Prelude.Nothing
    }

-- | The options of the plan.
sitePlan_options :: Lens.Lens' SitePlan (Prelude.Maybe [NameValuePair])
sitePlan_options :: Lens' SitePlan (Maybe [NameValuePair])
sitePlan_options = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SitePlan' {Maybe [NameValuePair]
options :: Maybe [NameValuePair]
$sel:options:SitePlan' :: SitePlan -> Maybe [NameValuePair]
options} -> Maybe [NameValuePair]
options) (\s :: SitePlan
s@SitePlan' {} Maybe [NameValuePair]
a -> SitePlan
s {$sel:options:SitePlan' :: Maybe [NameValuePair]
options = Maybe [NameValuePair]
a} :: SitePlan) 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 resource definitions of the plan.
sitePlan_resourceDefinitions :: Lens.Lens' SitePlan (Prelude.Maybe [NetworkResourceDefinition])
sitePlan_resourceDefinitions :: Lens' SitePlan (Maybe [NetworkResourceDefinition])
sitePlan_resourceDefinitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SitePlan' {Maybe [NetworkResourceDefinition]
resourceDefinitions :: Maybe [NetworkResourceDefinition]
$sel:resourceDefinitions:SitePlan' :: SitePlan -> Maybe [NetworkResourceDefinition]
resourceDefinitions} -> Maybe [NetworkResourceDefinition]
resourceDefinitions) (\s :: SitePlan
s@SitePlan' {} Maybe [NetworkResourceDefinition]
a -> SitePlan
s {$sel:resourceDefinitions:SitePlan' :: Maybe [NetworkResourceDefinition]
resourceDefinitions = Maybe [NetworkResourceDefinition]
a} :: SitePlan) 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 SitePlan where
  parseJSON :: Value -> Parser SitePlan
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SitePlan"
      ( \Object
x ->
          Maybe [NameValuePair]
-> Maybe [NetworkResourceDefinition] -> SitePlan
SitePlan'
            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
"options" 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
"resourceDefinitions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SitePlan where
  hashWithSalt :: Int -> SitePlan -> Int
hashWithSalt Int
_salt SitePlan' {Maybe [NameValuePair]
Maybe [NetworkResourceDefinition]
resourceDefinitions :: Maybe [NetworkResourceDefinition]
options :: Maybe [NameValuePair]
$sel:resourceDefinitions:SitePlan' :: SitePlan -> Maybe [NetworkResourceDefinition]
$sel:options:SitePlan' :: SitePlan -> Maybe [NameValuePair]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NameValuePair]
options
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NetworkResourceDefinition]
resourceDefinitions

instance Prelude.NFData SitePlan where
  rnf :: SitePlan -> ()
rnf SitePlan' {Maybe [NameValuePair]
Maybe [NetworkResourceDefinition]
resourceDefinitions :: Maybe [NetworkResourceDefinition]
options :: Maybe [NameValuePair]
$sel:resourceDefinitions:SitePlan' :: SitePlan -> Maybe [NetworkResourceDefinition]
$sel:options:SitePlan' :: SitePlan -> Maybe [NameValuePair]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [NameValuePair]
options
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [NetworkResourceDefinition]
resourceDefinitions

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