{-# 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.Outposts.Types.OrderSummary
-- 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.Outposts.Types.OrderSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Outposts.Types.LineItemStatus
import Amazonka.Outposts.Types.OrderStatus
import Amazonka.Outposts.Types.OrderType
import qualified Amazonka.Prelude as Prelude

-- | A summary of line items in your order.
--
-- /See:/ 'newOrderSummary' smart constructor.
data OrderSummary = OrderSummary'
  { -- | The status of all line items in the order.
    OrderSummary -> Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus :: Prelude.Maybe (Prelude.HashMap LineItemStatus Prelude.Natural),
    -- | The fulfilment date for the order.
    OrderSummary -> Maybe POSIX
orderFulfilledDate :: Prelude.Maybe Data.POSIX,
    -- | The ID of the order.
    OrderSummary -> Maybe Text
orderId :: Prelude.Maybe Prelude.Text,
    -- | The submission date for the order.
    OrderSummary -> Maybe POSIX
orderSubmissionDate :: Prelude.Maybe Data.POSIX,
    -- | The type of order.
    OrderSummary -> Maybe OrderType
orderType :: Prelude.Maybe OrderType,
    -- | The ID of the Outpost.
    OrderSummary -> Maybe Text
outpostId :: Prelude.Maybe Prelude.Text,
    -- | The status of the order.
    --
    -- -   @PREPARING@ - Order is received and is being prepared.
    --
    -- -   @IN_PROGRESS@ - Order is either being built, shipped, or installed.
    --     For more information, see the @LineItem@ status.
    --
    -- -   @COMPLETED@ - Order is complete.
    --
    -- -   @CANCELLED@ - Order is cancelled.
    --
    -- -   @ERROR@ - Customer should contact support.
    --
    -- The following statuses are deprecated: @RECEIVED@, @PENDING@,
    -- @PROCESSING@, @INSTALLING@, and @FULFILLED@.
    OrderSummary -> Maybe OrderStatus
status :: Prelude.Maybe OrderStatus
  }
  deriving (OrderSummary -> OrderSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrderSummary -> OrderSummary -> Bool
$c/= :: OrderSummary -> OrderSummary -> Bool
== :: OrderSummary -> OrderSummary -> Bool
$c== :: OrderSummary -> OrderSummary -> Bool
Prelude.Eq, ReadPrec [OrderSummary]
ReadPrec OrderSummary
Int -> ReadS OrderSummary
ReadS [OrderSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrderSummary]
$creadListPrec :: ReadPrec [OrderSummary]
readPrec :: ReadPrec OrderSummary
$creadPrec :: ReadPrec OrderSummary
readList :: ReadS [OrderSummary]
$creadList :: ReadS [OrderSummary]
readsPrec :: Int -> ReadS OrderSummary
$creadsPrec :: Int -> ReadS OrderSummary
Prelude.Read, Int -> OrderSummary -> ShowS
[OrderSummary] -> ShowS
OrderSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderSummary] -> ShowS
$cshowList :: [OrderSummary] -> ShowS
show :: OrderSummary -> String
$cshow :: OrderSummary -> String
showsPrec :: Int -> OrderSummary -> ShowS
$cshowsPrec :: Int -> OrderSummary -> ShowS
Prelude.Show, forall x. Rep OrderSummary x -> OrderSummary
forall x. OrderSummary -> Rep OrderSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrderSummary x -> OrderSummary
$cfrom :: forall x. OrderSummary -> Rep OrderSummary x
Prelude.Generic)

-- |
-- Create a value of 'OrderSummary' 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:
--
-- 'lineItemCountsByStatus', 'orderSummary_lineItemCountsByStatus' - The status of all line items in the order.
--
-- 'orderFulfilledDate', 'orderSummary_orderFulfilledDate' - The fulfilment date for the order.
--
-- 'orderId', 'orderSummary_orderId' - The ID of the order.
--
-- 'orderSubmissionDate', 'orderSummary_orderSubmissionDate' - The submission date for the order.
--
-- 'orderType', 'orderSummary_orderType' - The type of order.
--
-- 'outpostId', 'orderSummary_outpostId' - The ID of the Outpost.
--
-- 'status', 'orderSummary_status' - The status of the order.
--
-- -   @PREPARING@ - Order is received and is being prepared.
--
-- -   @IN_PROGRESS@ - Order is either being built, shipped, or installed.
--     For more information, see the @LineItem@ status.
--
-- -   @COMPLETED@ - Order is complete.
--
-- -   @CANCELLED@ - Order is cancelled.
--
-- -   @ERROR@ - Customer should contact support.
--
-- The following statuses are deprecated: @RECEIVED@, @PENDING@,
-- @PROCESSING@, @INSTALLING@, and @FULFILLED@.
newOrderSummary ::
  OrderSummary
newOrderSummary :: OrderSummary
newOrderSummary =
  OrderSummary'
    { $sel:lineItemCountsByStatus:OrderSummary' :: Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:orderFulfilledDate:OrderSummary' :: Maybe POSIX
orderFulfilledDate = forall a. Maybe a
Prelude.Nothing,
      $sel:orderId:OrderSummary' :: Maybe Text
orderId = forall a. Maybe a
Prelude.Nothing,
      $sel:orderSubmissionDate:OrderSummary' :: Maybe POSIX
orderSubmissionDate = forall a. Maybe a
Prelude.Nothing,
      $sel:orderType:OrderSummary' :: Maybe OrderType
orderType = forall a. Maybe a
Prelude.Nothing,
      $sel:outpostId:OrderSummary' :: Maybe Text
outpostId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:OrderSummary' :: Maybe OrderStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The status of all line items in the order.
orderSummary_lineItemCountsByStatus :: Lens.Lens' OrderSummary (Prelude.Maybe (Prelude.HashMap LineItemStatus Prelude.Natural))
orderSummary_lineItemCountsByStatus :: Lens' OrderSummary (Maybe (HashMap LineItemStatus Natural))
orderSummary_lineItemCountsByStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus :: Maybe (HashMap LineItemStatus Natural)
$sel:lineItemCountsByStatus:OrderSummary' :: OrderSummary -> Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus} -> Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus) (\s :: OrderSummary
s@OrderSummary' {} Maybe (HashMap LineItemStatus Natural)
a -> OrderSummary
s {$sel:lineItemCountsByStatus:OrderSummary' :: Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus = Maybe (HashMap LineItemStatus Natural)
a} :: OrderSummary) 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 fulfilment date for the order.
orderSummary_orderFulfilledDate :: Lens.Lens' OrderSummary (Prelude.Maybe Prelude.UTCTime)
orderSummary_orderFulfilledDate :: Lens' OrderSummary (Maybe UTCTime)
orderSummary_orderFulfilledDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe POSIX
orderFulfilledDate :: Maybe POSIX
$sel:orderFulfilledDate:OrderSummary' :: OrderSummary -> Maybe POSIX
orderFulfilledDate} -> Maybe POSIX
orderFulfilledDate) (\s :: OrderSummary
s@OrderSummary' {} Maybe POSIX
a -> OrderSummary
s {$sel:orderFulfilledDate:OrderSummary' :: Maybe POSIX
orderFulfilledDate = Maybe POSIX
a} :: OrderSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ID of the order.
orderSummary_orderId :: Lens.Lens' OrderSummary (Prelude.Maybe Prelude.Text)
orderSummary_orderId :: Lens' OrderSummary (Maybe Text)
orderSummary_orderId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe Text
orderId :: Maybe Text
$sel:orderId:OrderSummary' :: OrderSummary -> Maybe Text
orderId} -> Maybe Text
orderId) (\s :: OrderSummary
s@OrderSummary' {} Maybe Text
a -> OrderSummary
s {$sel:orderId:OrderSummary' :: Maybe Text
orderId = Maybe Text
a} :: OrderSummary)

-- | The submission date for the order.
orderSummary_orderSubmissionDate :: Lens.Lens' OrderSummary (Prelude.Maybe Prelude.UTCTime)
orderSummary_orderSubmissionDate :: Lens' OrderSummary (Maybe UTCTime)
orderSummary_orderSubmissionDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe POSIX
orderSubmissionDate :: Maybe POSIX
$sel:orderSubmissionDate:OrderSummary' :: OrderSummary -> Maybe POSIX
orderSubmissionDate} -> Maybe POSIX
orderSubmissionDate) (\s :: OrderSummary
s@OrderSummary' {} Maybe POSIX
a -> OrderSummary
s {$sel:orderSubmissionDate:OrderSummary' :: Maybe POSIX
orderSubmissionDate = Maybe POSIX
a} :: OrderSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The type of order.
orderSummary_orderType :: Lens.Lens' OrderSummary (Prelude.Maybe OrderType)
orderSummary_orderType :: Lens' OrderSummary (Maybe OrderType)
orderSummary_orderType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe OrderType
orderType :: Maybe OrderType
$sel:orderType:OrderSummary' :: OrderSummary -> Maybe OrderType
orderType} -> Maybe OrderType
orderType) (\s :: OrderSummary
s@OrderSummary' {} Maybe OrderType
a -> OrderSummary
s {$sel:orderType:OrderSummary' :: Maybe OrderType
orderType = Maybe OrderType
a} :: OrderSummary)

-- | The ID of the Outpost.
orderSummary_outpostId :: Lens.Lens' OrderSummary (Prelude.Maybe Prelude.Text)
orderSummary_outpostId :: Lens' OrderSummary (Maybe Text)
orderSummary_outpostId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe Text
outpostId :: Maybe Text
$sel:outpostId:OrderSummary' :: OrderSummary -> Maybe Text
outpostId} -> Maybe Text
outpostId) (\s :: OrderSummary
s@OrderSummary' {} Maybe Text
a -> OrderSummary
s {$sel:outpostId:OrderSummary' :: Maybe Text
outpostId = Maybe Text
a} :: OrderSummary)

-- | The status of the order.
--
-- -   @PREPARING@ - Order is received and is being prepared.
--
-- -   @IN_PROGRESS@ - Order is either being built, shipped, or installed.
--     For more information, see the @LineItem@ status.
--
-- -   @COMPLETED@ - Order is complete.
--
-- -   @CANCELLED@ - Order is cancelled.
--
-- -   @ERROR@ - Customer should contact support.
--
-- The following statuses are deprecated: @RECEIVED@, @PENDING@,
-- @PROCESSING@, @INSTALLING@, and @FULFILLED@.
orderSummary_status :: Lens.Lens' OrderSummary (Prelude.Maybe OrderStatus)
orderSummary_status :: Lens' OrderSummary (Maybe OrderStatus)
orderSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderSummary' {Maybe OrderStatus
status :: Maybe OrderStatus
$sel:status:OrderSummary' :: OrderSummary -> Maybe OrderStatus
status} -> Maybe OrderStatus
status) (\s :: OrderSummary
s@OrderSummary' {} Maybe OrderStatus
a -> OrderSummary
s {$sel:status:OrderSummary' :: Maybe OrderStatus
status = Maybe OrderStatus
a} :: OrderSummary)

instance Data.FromJSON OrderSummary where
  parseJSON :: Value -> Parser OrderSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OrderSummary"
      ( \Object
x ->
          Maybe (HashMap LineItemStatus Natural)
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe OrderType
-> Maybe Text
-> Maybe OrderStatus
-> OrderSummary
OrderSummary'
            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
"LineItemCountsByStatus"
                            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
"OrderFulfilledDate")
            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
"OrderId")
            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
"OrderSubmissionDate")
            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
"OrderType")
            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
"OutpostId")
            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
"Status")
      )

instance Prelude.Hashable OrderSummary where
  hashWithSalt :: Int -> OrderSummary -> Int
hashWithSalt Int
_salt OrderSummary' {Maybe Text
Maybe (HashMap LineItemStatus Natural)
Maybe POSIX
Maybe OrderStatus
Maybe OrderType
status :: Maybe OrderStatus
outpostId :: Maybe Text
orderType :: Maybe OrderType
orderSubmissionDate :: Maybe POSIX
orderId :: Maybe Text
orderFulfilledDate :: Maybe POSIX
lineItemCountsByStatus :: Maybe (HashMap LineItemStatus Natural)
$sel:status:OrderSummary' :: OrderSummary -> Maybe OrderStatus
$sel:outpostId:OrderSummary' :: OrderSummary -> Maybe Text
$sel:orderType:OrderSummary' :: OrderSummary -> Maybe OrderType
$sel:orderSubmissionDate:OrderSummary' :: OrderSummary -> Maybe POSIX
$sel:orderId:OrderSummary' :: OrderSummary -> Maybe Text
$sel:orderFulfilledDate:OrderSummary' :: OrderSummary -> Maybe POSIX
$sel:lineItemCountsByStatus:OrderSummary' :: OrderSummary -> Maybe (HashMap LineItemStatus Natural)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
orderFulfilledDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
orderId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
orderSubmissionDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OrderType
orderType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outpostId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OrderStatus
status

instance Prelude.NFData OrderSummary where
  rnf :: OrderSummary -> ()
rnf OrderSummary' {Maybe Text
Maybe (HashMap LineItemStatus Natural)
Maybe POSIX
Maybe OrderStatus
Maybe OrderType
status :: Maybe OrderStatus
outpostId :: Maybe Text
orderType :: Maybe OrderType
orderSubmissionDate :: Maybe POSIX
orderId :: Maybe Text
orderFulfilledDate :: Maybe POSIX
lineItemCountsByStatus :: Maybe (HashMap LineItemStatus Natural)
$sel:status:OrderSummary' :: OrderSummary -> Maybe OrderStatus
$sel:outpostId:OrderSummary' :: OrderSummary -> Maybe Text
$sel:orderType:OrderSummary' :: OrderSummary -> Maybe OrderType
$sel:orderSubmissionDate:OrderSummary' :: OrderSummary -> Maybe POSIX
$sel:orderId:OrderSummary' :: OrderSummary -> Maybe Text
$sel:orderFulfilledDate:OrderSummary' :: OrderSummary -> Maybe POSIX
$sel:lineItemCountsByStatus:OrderSummary' :: OrderSummary -> Maybe (HashMap LineItemStatus Natural)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap LineItemStatus Natural)
lineItemCountsByStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
orderFulfilledDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
orderId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
orderSubmissionDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OrderType
orderType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outpostId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OrderStatus
status