{-# 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.ServiceCatalog.Types.UsageInstruction
-- 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.ServiceCatalog.Types.UsageInstruction 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

-- | Additional information provided by the administrator.
--
-- /See:/ 'newUsageInstruction' smart constructor.
data UsageInstruction = UsageInstruction'
  { -- | The usage instruction type for the value.
    UsageInstruction -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The usage instruction value for this type.
    UsageInstruction -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (UsageInstruction -> UsageInstruction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageInstruction -> UsageInstruction -> Bool
$c/= :: UsageInstruction -> UsageInstruction -> Bool
== :: UsageInstruction -> UsageInstruction -> Bool
$c== :: UsageInstruction -> UsageInstruction -> Bool
Prelude.Eq, ReadPrec [UsageInstruction]
ReadPrec UsageInstruction
Int -> ReadS UsageInstruction
ReadS [UsageInstruction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageInstruction]
$creadListPrec :: ReadPrec [UsageInstruction]
readPrec :: ReadPrec UsageInstruction
$creadPrec :: ReadPrec UsageInstruction
readList :: ReadS [UsageInstruction]
$creadList :: ReadS [UsageInstruction]
readsPrec :: Int -> ReadS UsageInstruction
$creadsPrec :: Int -> ReadS UsageInstruction
Prelude.Read, Int -> UsageInstruction -> ShowS
[UsageInstruction] -> ShowS
UsageInstruction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageInstruction] -> ShowS
$cshowList :: [UsageInstruction] -> ShowS
show :: UsageInstruction -> String
$cshow :: UsageInstruction -> String
showsPrec :: Int -> UsageInstruction -> ShowS
$cshowsPrec :: Int -> UsageInstruction -> ShowS
Prelude.Show, forall x. Rep UsageInstruction x -> UsageInstruction
forall x. UsageInstruction -> Rep UsageInstruction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageInstruction x -> UsageInstruction
$cfrom :: forall x. UsageInstruction -> Rep UsageInstruction x
Prelude.Generic)

-- |
-- Create a value of 'UsageInstruction' 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:
--
-- 'type'', 'usageInstruction_type' - The usage instruction type for the value.
--
-- 'value', 'usageInstruction_value' - The usage instruction value for this type.
newUsageInstruction ::
  UsageInstruction
newUsageInstruction :: UsageInstruction
newUsageInstruction =
  UsageInstruction'
    { $sel:type':UsageInstruction' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:value:UsageInstruction' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The usage instruction type for the value.
usageInstruction_type :: Lens.Lens' UsageInstruction (Prelude.Maybe Prelude.Text)
usageInstruction_type :: Lens' UsageInstruction (Maybe Text)
usageInstruction_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageInstruction' {Maybe Text
type' :: Maybe Text
$sel:type':UsageInstruction' :: UsageInstruction -> Maybe Text
type'} -> Maybe Text
type') (\s :: UsageInstruction
s@UsageInstruction' {} Maybe Text
a -> UsageInstruction
s {$sel:type':UsageInstruction' :: Maybe Text
type' = Maybe Text
a} :: UsageInstruction)

-- | The usage instruction value for this type.
usageInstruction_value :: Lens.Lens' UsageInstruction (Prelude.Maybe Prelude.Text)
usageInstruction_value :: Lens' UsageInstruction (Maybe Text)
usageInstruction_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageInstruction' {Maybe Text
value :: Maybe Text
$sel:value:UsageInstruction' :: UsageInstruction -> Maybe Text
value} -> Maybe Text
value) (\s :: UsageInstruction
s@UsageInstruction' {} Maybe Text
a -> UsageInstruction
s {$sel:value:UsageInstruction' :: Maybe Text
value = Maybe Text
a} :: UsageInstruction)

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

instance Prelude.Hashable UsageInstruction where
  hashWithSalt :: Int -> UsageInstruction -> Int
hashWithSalt Int
_salt UsageInstruction' {Maybe Text
value :: Maybe Text
type' :: Maybe Text
$sel:value:UsageInstruction' :: UsageInstruction -> Maybe Text
$sel:type':UsageInstruction' :: UsageInstruction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData UsageInstruction where
  rnf :: UsageInstruction -> ()
rnf UsageInstruction' {Maybe Text
value :: Maybe Text
type' :: Maybe Text
$sel:value:UsageInstruction' :: UsageInstruction -> Maybe Text
$sel:type':UsageInstruction' :: UsageInstruction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value