{-# 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.Outposts.Types.Order where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Outposts.Types.LineItem
import Amazonka.Outposts.Types.OrderStatus
import Amazonka.Outposts.Types.PaymentOption
import qualified Amazonka.Prelude as Prelude
data Order = Order'
{
Order -> Maybe OrderStatus
status :: Prelude.Maybe OrderStatus,
Order -> Maybe POSIX
orderSubmissionDate :: Prelude.Maybe Core.POSIX,
Order -> Maybe [LineItem]
lineItems :: Prelude.Maybe [LineItem],
Order -> Maybe POSIX
orderFulfilledDate :: Prelude.Maybe Core.POSIX,
Order -> Maybe Text
orderId :: Prelude.Maybe Prelude.Text,
Order -> Maybe Text
outpostId :: Prelude.Maybe Prelude.Text,
Order -> Maybe PaymentOption
paymentOption :: Prelude.Maybe PaymentOption
}
deriving (Order -> Order -> Bool
(Order -> Order -> Bool) -> (Order -> Order -> Bool) -> Eq Order
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Order -> Order -> Bool
$c/= :: Order -> Order -> Bool
== :: Order -> Order -> Bool
$c== :: Order -> Order -> Bool
Prelude.Eq, ReadPrec [Order]
ReadPrec Order
Int -> ReadS Order
ReadS [Order]
(Int -> ReadS Order)
-> ReadS [Order]
-> ReadPrec Order
-> ReadPrec [Order]
-> Read Order
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Order]
$creadListPrec :: ReadPrec [Order]
readPrec :: ReadPrec Order
$creadPrec :: ReadPrec Order
readList :: ReadS [Order]
$creadList :: ReadS [Order]
readsPrec :: Int -> ReadS Order
$creadsPrec :: Int -> ReadS Order
Prelude.Read, Int -> Order -> ShowS
[Order] -> ShowS
Order -> String
(Int -> Order -> ShowS)
-> (Order -> String) -> ([Order] -> ShowS) -> Show Order
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Order] -> ShowS
$cshowList :: [Order] -> ShowS
show :: Order -> String
$cshow :: Order -> String
showsPrec :: Int -> Order -> ShowS
$cshowsPrec :: Int -> Order -> ShowS
Prelude.Show, (forall x. Order -> Rep Order x)
-> (forall x. Rep Order x -> Order) -> Generic Order
forall x. Rep Order x -> Order
forall x. Order -> Rep Order x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Order x -> Order
$cfrom :: forall x. Order -> Rep Order x
Prelude.Generic)
newOrder ::
Order
newOrder :: Order
newOrder =
Order' :: Maybe OrderStatus
-> Maybe POSIX
-> Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order
Order'
{ $sel:status:Order' :: Maybe OrderStatus
status = Maybe OrderStatus
forall a. Maybe a
Prelude.Nothing,
$sel:orderSubmissionDate:Order' :: Maybe POSIX
orderSubmissionDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:lineItems:Order' :: Maybe [LineItem]
lineItems = Maybe [LineItem]
forall a. Maybe a
Prelude.Nothing,
$sel:orderFulfilledDate:Order' :: Maybe POSIX
orderFulfilledDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:orderId:Order' :: Maybe Text
orderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:outpostId:Order' :: Maybe Text
outpostId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:paymentOption:Order' :: Maybe PaymentOption
paymentOption = Maybe PaymentOption
forall a. Maybe a
Prelude.Nothing
}
order_status :: Lens.Lens' Order (Prelude.Maybe OrderStatus)
order_status :: (Maybe OrderStatus -> f (Maybe OrderStatus)) -> Order -> f Order
order_status = (Order -> Maybe OrderStatus)
-> (Order -> Maybe OrderStatus -> Order)
-> Lens Order Order (Maybe OrderStatus) (Maybe OrderStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe OrderStatus
status :: Maybe OrderStatus
$sel:status:Order' :: Order -> Maybe OrderStatus
status} -> Maybe OrderStatus
status) (\s :: Order
s@Order' {} Maybe OrderStatus
a -> Order
s {$sel:status:Order' :: Maybe OrderStatus
status = Maybe OrderStatus
a} :: Order)
order_orderSubmissionDate :: Lens.Lens' Order (Prelude.Maybe Prelude.UTCTime)
order_orderSubmissionDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Order -> f Order
order_orderSubmissionDate = (Order -> Maybe POSIX)
-> (Order -> Maybe POSIX -> Order)
-> Lens Order Order (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe POSIX
orderSubmissionDate :: Maybe POSIX
$sel:orderSubmissionDate:Order' :: Order -> Maybe POSIX
orderSubmissionDate} -> Maybe POSIX
orderSubmissionDate) (\s :: Order
s@Order' {} Maybe POSIX
a -> Order
s {$sel:orderSubmissionDate:Order' :: Maybe POSIX
orderSubmissionDate = Maybe POSIX
a} :: Order) ((Maybe POSIX -> f (Maybe POSIX)) -> Order -> f Order)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Order
-> f Order
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
order_lineItems :: Lens.Lens' Order (Prelude.Maybe [LineItem])
order_lineItems :: (Maybe [LineItem] -> f (Maybe [LineItem])) -> Order -> f Order
order_lineItems = (Order -> Maybe [LineItem])
-> (Order -> Maybe [LineItem] -> Order)
-> Lens Order Order (Maybe [LineItem]) (Maybe [LineItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe [LineItem]
lineItems :: Maybe [LineItem]
$sel:lineItems:Order' :: Order -> Maybe [LineItem]
lineItems} -> Maybe [LineItem]
lineItems) (\s :: Order
s@Order' {} Maybe [LineItem]
a -> Order
s {$sel:lineItems:Order' :: Maybe [LineItem]
lineItems = Maybe [LineItem]
a} :: Order) ((Maybe [LineItem] -> f (Maybe [LineItem])) -> Order -> f Order)
-> ((Maybe [LineItem] -> f (Maybe [LineItem]))
-> Maybe [LineItem] -> f (Maybe [LineItem]))
-> (Maybe [LineItem] -> f (Maybe [LineItem]))
-> Order
-> f Order
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [LineItem] [LineItem] [LineItem] [LineItem]
-> Iso
(Maybe [LineItem])
(Maybe [LineItem])
(Maybe [LineItem])
(Maybe [LineItem])
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 [LineItem] [LineItem] [LineItem] [LineItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
order_orderFulfilledDate :: Lens.Lens' Order (Prelude.Maybe Prelude.UTCTime)
order_orderFulfilledDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Order -> f Order
order_orderFulfilledDate = (Order -> Maybe POSIX)
-> (Order -> Maybe POSIX -> Order)
-> Lens Order Order (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe POSIX
orderFulfilledDate :: Maybe POSIX
$sel:orderFulfilledDate:Order' :: Order -> Maybe POSIX
orderFulfilledDate} -> Maybe POSIX
orderFulfilledDate) (\s :: Order
s@Order' {} Maybe POSIX
a -> Order
s {$sel:orderFulfilledDate:Order' :: Maybe POSIX
orderFulfilledDate = Maybe POSIX
a} :: Order) ((Maybe POSIX -> f (Maybe POSIX)) -> Order -> f Order)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Order
-> f Order
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
order_orderId :: Lens.Lens' Order (Prelude.Maybe Prelude.Text)
order_orderId :: (Maybe Text -> f (Maybe Text)) -> Order -> f Order
order_orderId = (Order -> Maybe Text)
-> (Order -> Maybe Text -> Order)
-> Lens Order Order (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe Text
orderId :: Maybe Text
$sel:orderId:Order' :: Order -> Maybe Text
orderId} -> Maybe Text
orderId) (\s :: Order
s@Order' {} Maybe Text
a -> Order
s {$sel:orderId:Order' :: Maybe Text
orderId = Maybe Text
a} :: Order)
order_outpostId :: Lens.Lens' Order (Prelude.Maybe Prelude.Text)
order_outpostId :: (Maybe Text -> f (Maybe Text)) -> Order -> f Order
order_outpostId = (Order -> Maybe Text)
-> (Order -> Maybe Text -> Order)
-> Lens Order Order (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe Text
outpostId :: Maybe Text
$sel:outpostId:Order' :: Order -> Maybe Text
outpostId} -> Maybe Text
outpostId) (\s :: Order
s@Order' {} Maybe Text
a -> Order
s {$sel:outpostId:Order' :: Maybe Text
outpostId = Maybe Text
a} :: Order)
order_paymentOption :: Lens.Lens' Order (Prelude.Maybe PaymentOption)
order_paymentOption :: (Maybe PaymentOption -> f (Maybe PaymentOption))
-> Order -> f Order
order_paymentOption = (Order -> Maybe PaymentOption)
-> (Order -> Maybe PaymentOption -> Order)
-> Lens Order Order (Maybe PaymentOption) (Maybe PaymentOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Order' {Maybe PaymentOption
paymentOption :: Maybe PaymentOption
$sel:paymentOption:Order' :: Order -> Maybe PaymentOption
paymentOption} -> Maybe PaymentOption
paymentOption) (\s :: Order
s@Order' {} Maybe PaymentOption
a -> Order
s {$sel:paymentOption:Order' :: Maybe PaymentOption
paymentOption = Maybe PaymentOption
a} :: Order)
instance Core.FromJSON Order where
parseJSON :: Value -> Parser Order
parseJSON =
String -> (Object -> Parser Order) -> Value -> Parser Order
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Order"
( \Object
x ->
Maybe OrderStatus
-> Maybe POSIX
-> Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order
Order'
(Maybe OrderStatus
-> Maybe POSIX
-> Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order)
-> Parser (Maybe OrderStatus)
-> Parser
(Maybe POSIX
-> Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OrderStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
Parser
(Maybe POSIX
-> Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order)
-> Parser (Maybe POSIX)
-> Parser
(Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OrderSubmissionDate")
Parser
(Maybe [LineItem]
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe PaymentOption
-> Order)
-> Parser (Maybe [LineItem])
-> Parser
(Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe PaymentOption -> Order)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [LineItem]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LineItems" Parser (Maybe (Maybe [LineItem]))
-> Maybe [LineItem] -> Parser (Maybe [LineItem])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LineItem]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe PaymentOption -> Order)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text -> Maybe Text -> Maybe PaymentOption -> Order)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OrderFulfilledDate")
Parser (Maybe Text -> Maybe Text -> Maybe PaymentOption -> Order)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe PaymentOption -> Order)
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
"OrderId")
Parser (Maybe Text -> Maybe PaymentOption -> Order)
-> Parser (Maybe Text) -> Parser (Maybe PaymentOption -> Order)
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
"OutpostId")
Parser (Maybe PaymentOption -> Order)
-> Parser (Maybe PaymentOption) -> Parser Order
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PaymentOption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PaymentOption")
)
instance Prelude.Hashable Order
instance Prelude.NFData Order