{-# 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.DeviceFarm.Types.OfferingPromotion
-- 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.DeviceFarm.Types.OfferingPromotion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents information about an offering promotion.
--
-- /See:/ 'newOfferingPromotion' smart constructor.
data OfferingPromotion = OfferingPromotion'
  { -- | The ID of the offering promotion.
    OfferingPromotion -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | A string that describes the offering promotion.
    OfferingPromotion -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (OfferingPromotion -> OfferingPromotion -> Bool
(OfferingPromotion -> OfferingPromotion -> Bool)
-> (OfferingPromotion -> OfferingPromotion -> Bool)
-> Eq OfferingPromotion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OfferingPromotion -> OfferingPromotion -> Bool
$c/= :: OfferingPromotion -> OfferingPromotion -> Bool
== :: OfferingPromotion -> OfferingPromotion -> Bool
$c== :: OfferingPromotion -> OfferingPromotion -> Bool
Prelude.Eq, ReadPrec [OfferingPromotion]
ReadPrec OfferingPromotion
Int -> ReadS OfferingPromotion
ReadS [OfferingPromotion]
(Int -> ReadS OfferingPromotion)
-> ReadS [OfferingPromotion]
-> ReadPrec OfferingPromotion
-> ReadPrec [OfferingPromotion]
-> Read OfferingPromotion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OfferingPromotion]
$creadListPrec :: ReadPrec [OfferingPromotion]
readPrec :: ReadPrec OfferingPromotion
$creadPrec :: ReadPrec OfferingPromotion
readList :: ReadS [OfferingPromotion]
$creadList :: ReadS [OfferingPromotion]
readsPrec :: Int -> ReadS OfferingPromotion
$creadsPrec :: Int -> ReadS OfferingPromotion
Prelude.Read, Int -> OfferingPromotion -> ShowS
[OfferingPromotion] -> ShowS
OfferingPromotion -> String
(Int -> OfferingPromotion -> ShowS)
-> (OfferingPromotion -> String)
-> ([OfferingPromotion] -> ShowS)
-> Show OfferingPromotion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OfferingPromotion] -> ShowS
$cshowList :: [OfferingPromotion] -> ShowS
show :: OfferingPromotion -> String
$cshow :: OfferingPromotion -> String
showsPrec :: Int -> OfferingPromotion -> ShowS
$cshowsPrec :: Int -> OfferingPromotion -> ShowS
Prelude.Show, (forall x. OfferingPromotion -> Rep OfferingPromotion x)
-> (forall x. Rep OfferingPromotion x -> OfferingPromotion)
-> Generic OfferingPromotion
forall x. Rep OfferingPromotion x -> OfferingPromotion
forall x. OfferingPromotion -> Rep OfferingPromotion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OfferingPromotion x -> OfferingPromotion
$cfrom :: forall x. OfferingPromotion -> Rep OfferingPromotion x
Prelude.Generic)

-- |
-- Create a value of 'OfferingPromotion' 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:
--
-- 'id', 'offeringPromotion_id' - The ID of the offering promotion.
--
-- 'description', 'offeringPromotion_description' - A string that describes the offering promotion.
newOfferingPromotion ::
  OfferingPromotion
newOfferingPromotion :: OfferingPromotion
newOfferingPromotion =
  OfferingPromotion' :: Maybe Text -> Maybe Text -> OfferingPromotion
OfferingPromotion'
    { $sel:id:OfferingPromotion' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:OfferingPromotion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the offering promotion.
offeringPromotion_id :: Lens.Lens' OfferingPromotion (Prelude.Maybe Prelude.Text)
offeringPromotion_id :: (Maybe Text -> f (Maybe Text))
-> OfferingPromotion -> f OfferingPromotion
offeringPromotion_id = (OfferingPromotion -> Maybe Text)
-> (OfferingPromotion -> Maybe Text -> OfferingPromotion)
-> Lens
     OfferingPromotion OfferingPromotion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfferingPromotion' {Maybe Text
id :: Maybe Text
$sel:id:OfferingPromotion' :: OfferingPromotion -> Maybe Text
id} -> Maybe Text
id) (\s :: OfferingPromotion
s@OfferingPromotion' {} Maybe Text
a -> OfferingPromotion
s {$sel:id:OfferingPromotion' :: Maybe Text
id = Maybe Text
a} :: OfferingPromotion)

-- | A string that describes the offering promotion.
offeringPromotion_description :: Lens.Lens' OfferingPromotion (Prelude.Maybe Prelude.Text)
offeringPromotion_description :: (Maybe Text -> f (Maybe Text))
-> OfferingPromotion -> f OfferingPromotion
offeringPromotion_description = (OfferingPromotion -> Maybe Text)
-> (OfferingPromotion -> Maybe Text -> OfferingPromotion)
-> Lens
     OfferingPromotion OfferingPromotion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfferingPromotion' {Maybe Text
description :: Maybe Text
$sel:description:OfferingPromotion' :: OfferingPromotion -> Maybe Text
description} -> Maybe Text
description) (\s :: OfferingPromotion
s@OfferingPromotion' {} Maybe Text
a -> OfferingPromotion
s {$sel:description:OfferingPromotion' :: Maybe Text
description = Maybe Text
a} :: OfferingPromotion)

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

instance Prelude.Hashable OfferingPromotion

instance Prelude.NFData OfferingPromotion