{-# 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 #-}
module Amazonka.DeviceFarm.Types.Offering where
import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types.DevicePlatform
import Amazonka.DeviceFarm.Types.OfferingType
import Amazonka.DeviceFarm.Types.RecurringCharge
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Offering = Offering'
{
Offering -> Maybe DevicePlatform
platform :: Prelude.Maybe DevicePlatform,
Offering -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Offering -> Maybe [RecurringCharge]
recurringCharges :: Prelude.Maybe [RecurringCharge],
Offering -> Maybe OfferingType
type' :: Prelude.Maybe OfferingType,
Offering -> Maybe Text
description :: Prelude.Maybe Prelude.Text
}
deriving (Offering -> Offering -> Bool
(Offering -> Offering -> Bool)
-> (Offering -> Offering -> Bool) -> Eq Offering
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Offering -> Offering -> Bool
$c/= :: Offering -> Offering -> Bool
== :: Offering -> Offering -> Bool
$c== :: Offering -> Offering -> Bool
Prelude.Eq, ReadPrec [Offering]
ReadPrec Offering
Int -> ReadS Offering
ReadS [Offering]
(Int -> ReadS Offering)
-> ReadS [Offering]
-> ReadPrec Offering
-> ReadPrec [Offering]
-> Read Offering
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Offering]
$creadListPrec :: ReadPrec [Offering]
readPrec :: ReadPrec Offering
$creadPrec :: ReadPrec Offering
readList :: ReadS [Offering]
$creadList :: ReadS [Offering]
readsPrec :: Int -> ReadS Offering
$creadsPrec :: Int -> ReadS Offering
Prelude.Read, Int -> Offering -> ShowS
[Offering] -> ShowS
Offering -> String
(Int -> Offering -> ShowS)
-> (Offering -> String) -> ([Offering] -> ShowS) -> Show Offering
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Offering] -> ShowS
$cshowList :: [Offering] -> ShowS
show :: Offering -> String
$cshow :: Offering -> String
showsPrec :: Int -> Offering -> ShowS
$cshowsPrec :: Int -> Offering -> ShowS
Prelude.Show, (forall x. Offering -> Rep Offering x)
-> (forall x. Rep Offering x -> Offering) -> Generic Offering
forall x. Rep Offering x -> Offering
forall x. Offering -> Rep Offering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Offering x -> Offering
$cfrom :: forall x. Offering -> Rep Offering x
Prelude.Generic)
newOffering ::
Offering
newOffering :: Offering
newOffering =
Offering' :: Maybe DevicePlatform
-> Maybe Text
-> Maybe [RecurringCharge]
-> Maybe OfferingType
-> Maybe Text
-> Offering
Offering'
{ $sel:platform:Offering' :: Maybe DevicePlatform
platform = Maybe DevicePlatform
forall a. Maybe a
Prelude.Nothing,
$sel:id:Offering' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:recurringCharges:Offering' :: Maybe [RecurringCharge]
recurringCharges = Maybe [RecurringCharge]
forall a. Maybe a
Prelude.Nothing,
$sel:type':Offering' :: Maybe OfferingType
type' = Maybe OfferingType
forall a. Maybe a
Prelude.Nothing,
$sel:description:Offering' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
offering_platform :: Lens.Lens' Offering (Prelude.Maybe DevicePlatform)
offering_platform :: (Maybe DevicePlatform -> f (Maybe DevicePlatform))
-> Offering -> f Offering
offering_platform = (Offering -> Maybe DevicePlatform)
-> (Offering -> Maybe DevicePlatform -> Offering)
-> Lens
Offering Offering (Maybe DevicePlatform) (Maybe DevicePlatform)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Maybe DevicePlatform
platform :: Maybe DevicePlatform
$sel:platform:Offering' :: Offering -> Maybe DevicePlatform
platform} -> Maybe DevicePlatform
platform) (\s :: Offering
s@Offering' {} Maybe DevicePlatform
a -> Offering
s {$sel:platform:Offering' :: Maybe DevicePlatform
platform = Maybe DevicePlatform
a} :: Offering)
offering_id :: Lens.Lens' Offering (Prelude.Maybe Prelude.Text)
offering_id :: (Maybe Text -> f (Maybe Text)) -> Offering -> f Offering
offering_id = (Offering -> Maybe Text)
-> (Offering -> Maybe Text -> Offering)
-> Lens Offering Offering (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Maybe Text
id :: Maybe Text
$sel:id:Offering' :: Offering -> Maybe Text
id} -> Maybe Text
id) (\s :: Offering
s@Offering' {} Maybe Text
a -> Offering
s {$sel:id:Offering' :: Maybe Text
id = Maybe Text
a} :: Offering)
offering_recurringCharges :: Lens.Lens' Offering (Prelude.Maybe [RecurringCharge])
offering_recurringCharges :: (Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> Offering -> f Offering
offering_recurringCharges = (Offering -> Maybe [RecurringCharge])
-> (Offering -> Maybe [RecurringCharge] -> Offering)
-> Lens
Offering
Offering
(Maybe [RecurringCharge])
(Maybe [RecurringCharge])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Maybe [RecurringCharge]
recurringCharges :: Maybe [RecurringCharge]
$sel:recurringCharges:Offering' :: Offering -> Maybe [RecurringCharge]
recurringCharges} -> Maybe [RecurringCharge]
recurringCharges) (\s :: Offering
s@Offering' {} Maybe [RecurringCharge]
a -> Offering
s {$sel:recurringCharges:Offering' :: Maybe [RecurringCharge]
recurringCharges = Maybe [RecurringCharge]
a} :: Offering) ((Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> Offering -> f Offering)
-> ((Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> (Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> Offering
-> f Offering
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RecurringCharge]
[RecurringCharge]
[RecurringCharge]
[RecurringCharge]
-> Iso
(Maybe [RecurringCharge])
(Maybe [RecurringCharge])
(Maybe [RecurringCharge])
(Maybe [RecurringCharge])
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 AnIso
[RecurringCharge]
[RecurringCharge]
[RecurringCharge]
[RecurringCharge]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
offering_type :: Lens.Lens' Offering (Prelude.Maybe OfferingType)
offering_type :: (Maybe OfferingType -> f (Maybe OfferingType))
-> Offering -> f Offering
offering_type = (Offering -> Maybe OfferingType)
-> (Offering -> Maybe OfferingType -> Offering)
-> Lens Offering Offering (Maybe OfferingType) (Maybe OfferingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Maybe OfferingType
type' :: Maybe OfferingType
$sel:type':Offering' :: Offering -> Maybe OfferingType
type'} -> Maybe OfferingType
type') (\s :: Offering
s@Offering' {} Maybe OfferingType
a -> Offering
s {$sel:type':Offering' :: Maybe OfferingType
type' = Maybe OfferingType
a} :: Offering)
offering_description :: Lens.Lens' Offering (Prelude.Maybe Prelude.Text)
offering_description :: (Maybe Text -> f (Maybe Text)) -> Offering -> f Offering
offering_description = (Offering -> Maybe Text)
-> (Offering -> Maybe Text -> Offering)
-> Lens Offering Offering (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Maybe Text
description :: Maybe Text
$sel:description:Offering' :: Offering -> Maybe Text
description} -> Maybe Text
description) (\s :: Offering
s@Offering' {} Maybe Text
a -> Offering
s {$sel:description:Offering' :: Maybe Text
description = Maybe Text
a} :: Offering)
instance Core.FromJSON Offering where
parseJSON :: Value -> Parser Offering
parseJSON =
String -> (Object -> Parser Offering) -> Value -> Parser Offering
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Offering"
( \Object
x ->
Maybe DevicePlatform
-> Maybe Text
-> Maybe [RecurringCharge]
-> Maybe OfferingType
-> Maybe Text
-> Offering
Offering'
(Maybe DevicePlatform
-> Maybe Text
-> Maybe [RecurringCharge]
-> Maybe OfferingType
-> Maybe Text
-> Offering)
-> Parser (Maybe DevicePlatform)
-> Parser
(Maybe Text
-> Maybe [RecurringCharge]
-> Maybe OfferingType
-> Maybe Text
-> Offering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DevicePlatform)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"platform")
Parser
(Maybe Text
-> Maybe [RecurringCharge]
-> Maybe OfferingType
-> Maybe Text
-> Offering)
-> Parser (Maybe Text)
-> Parser
(Maybe [RecurringCharge]
-> Maybe OfferingType -> Maybe Text -> Offering)
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
"id")
Parser
(Maybe [RecurringCharge]
-> Maybe OfferingType -> Maybe Text -> Offering)
-> Parser (Maybe [RecurringCharge])
-> Parser (Maybe OfferingType -> Maybe Text -> Offering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [RecurringCharge]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"recurringCharges"
Parser (Maybe (Maybe [RecurringCharge]))
-> Maybe [RecurringCharge] -> Parser (Maybe [RecurringCharge])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RecurringCharge]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe OfferingType -> Maybe Text -> Offering)
-> Parser (Maybe OfferingType) -> Parser (Maybe Text -> Offering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OfferingType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
Parser (Maybe Text -> Offering)
-> Parser (Maybe Text) -> Parser Offering
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 Offering
instance Prelude.NFData Offering