{-# 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.LineItem
-- 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.LineItem 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.LineItemAssetInformation
import Amazonka.Outposts.Types.LineItemStatus
import Amazonka.Outposts.Types.ShipmentInformation
import qualified Amazonka.Prelude as Prelude

-- | Information about a line item.
--
-- /See:/ 'newLineItem' smart constructor.
data LineItem = LineItem'
  { -- | Information about assets.
    LineItem -> Maybe [LineItemAssetInformation]
assetInformationList :: Prelude.Maybe [LineItemAssetInformation],
    -- | The ID of the catalog item.
    LineItem -> Maybe Text
catalogItemId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the line item.
    LineItem -> Maybe Text
lineItemId :: Prelude.Maybe Prelude.Text,
    -- | The quantity of the line item.
    LineItem -> Maybe Natural
quantity :: Prelude.Maybe Prelude.Natural,
    -- | Information about a line item shipment.
    LineItem -> Maybe ShipmentInformation
shipmentInformation :: Prelude.Maybe ShipmentInformation,
    -- | The status of the line item.
    LineItem -> Maybe LineItemStatus
status :: Prelude.Maybe LineItemStatus
  }
  deriving (LineItem -> LineItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItem -> LineItem -> Bool
$c/= :: LineItem -> LineItem -> Bool
== :: LineItem -> LineItem -> Bool
$c== :: LineItem -> LineItem -> Bool
Prelude.Eq, ReadPrec [LineItem]
ReadPrec LineItem
Int -> ReadS LineItem
ReadS [LineItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LineItem]
$creadListPrec :: ReadPrec [LineItem]
readPrec :: ReadPrec LineItem
$creadPrec :: ReadPrec LineItem
readList :: ReadS [LineItem]
$creadList :: ReadS [LineItem]
readsPrec :: Int -> ReadS LineItem
$creadsPrec :: Int -> ReadS LineItem
Prelude.Read, Int -> LineItem -> ShowS
[LineItem] -> ShowS
LineItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItem] -> ShowS
$cshowList :: [LineItem] -> ShowS
show :: LineItem -> String
$cshow :: LineItem -> String
showsPrec :: Int -> LineItem -> ShowS
$cshowsPrec :: Int -> LineItem -> ShowS
Prelude.Show, forall x. Rep LineItem x -> LineItem
forall x. LineItem -> Rep LineItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LineItem x -> LineItem
$cfrom :: forall x. LineItem -> Rep LineItem x
Prelude.Generic)

-- |
-- Create a value of 'LineItem' 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:
--
-- 'assetInformationList', 'lineItem_assetInformationList' - Information about assets.
--
-- 'catalogItemId', 'lineItem_catalogItemId' - The ID of the catalog item.
--
-- 'lineItemId', 'lineItem_lineItemId' - The ID of the line item.
--
-- 'quantity', 'lineItem_quantity' - The quantity of the line item.
--
-- 'shipmentInformation', 'lineItem_shipmentInformation' - Information about a line item shipment.
--
-- 'status', 'lineItem_status' - The status of the line item.
newLineItem ::
  LineItem
newLineItem :: LineItem
newLineItem =
  LineItem'
    { $sel:assetInformationList:LineItem' :: Maybe [LineItemAssetInformation]
assetInformationList = forall a. Maybe a
Prelude.Nothing,
      $sel:catalogItemId:LineItem' :: Maybe Text
catalogItemId = forall a. Maybe a
Prelude.Nothing,
      $sel:lineItemId:LineItem' :: Maybe Text
lineItemId = forall a. Maybe a
Prelude.Nothing,
      $sel:quantity:LineItem' :: Maybe Natural
quantity = forall a. Maybe a
Prelude.Nothing,
      $sel:shipmentInformation:LineItem' :: Maybe ShipmentInformation
shipmentInformation = forall a. Maybe a
Prelude.Nothing,
      $sel:status:LineItem' :: Maybe LineItemStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about assets.
lineItem_assetInformationList :: Lens.Lens' LineItem (Prelude.Maybe [LineItemAssetInformation])
lineItem_assetInformationList :: Lens' LineItem (Maybe [LineItemAssetInformation])
lineItem_assetInformationList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItem' {Maybe [LineItemAssetInformation]
assetInformationList :: Maybe [LineItemAssetInformation]
$sel:assetInformationList:LineItem' :: LineItem -> Maybe [LineItemAssetInformation]
assetInformationList} -> Maybe [LineItemAssetInformation]
assetInformationList) (\s :: LineItem
s@LineItem' {} Maybe [LineItemAssetInformation]
a -> LineItem
s {$sel:assetInformationList:LineItem' :: Maybe [LineItemAssetInformation]
assetInformationList = Maybe [LineItemAssetInformation]
a} :: LineItem) 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 ID of the catalog item.
lineItem_catalogItemId :: Lens.Lens' LineItem (Prelude.Maybe Prelude.Text)
lineItem_catalogItemId :: Lens' LineItem (Maybe Text)
lineItem_catalogItemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItem' {Maybe Text
catalogItemId :: Maybe Text
$sel:catalogItemId:LineItem' :: LineItem -> Maybe Text
catalogItemId} -> Maybe Text
catalogItemId) (\s :: LineItem
s@LineItem' {} Maybe Text
a -> LineItem
s {$sel:catalogItemId:LineItem' :: Maybe Text
catalogItemId = Maybe Text
a} :: LineItem)

-- | The ID of the line item.
lineItem_lineItemId :: Lens.Lens' LineItem (Prelude.Maybe Prelude.Text)
lineItem_lineItemId :: Lens' LineItem (Maybe Text)
lineItem_lineItemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItem' {Maybe Text
lineItemId :: Maybe Text
$sel:lineItemId:LineItem' :: LineItem -> Maybe Text
lineItemId} -> Maybe Text
lineItemId) (\s :: LineItem
s@LineItem' {} Maybe Text
a -> LineItem
s {$sel:lineItemId:LineItem' :: Maybe Text
lineItemId = Maybe Text
a} :: LineItem)

-- | The quantity of the line item.
lineItem_quantity :: Lens.Lens' LineItem (Prelude.Maybe Prelude.Natural)
lineItem_quantity :: Lens' LineItem (Maybe Natural)
lineItem_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItem' {Maybe Natural
quantity :: Maybe Natural
$sel:quantity:LineItem' :: LineItem -> Maybe Natural
quantity} -> Maybe Natural
quantity) (\s :: LineItem
s@LineItem' {} Maybe Natural
a -> LineItem
s {$sel:quantity:LineItem' :: Maybe Natural
quantity = Maybe Natural
a} :: LineItem)

-- | Information about a line item shipment.
lineItem_shipmentInformation :: Lens.Lens' LineItem (Prelude.Maybe ShipmentInformation)
lineItem_shipmentInformation :: Lens' LineItem (Maybe ShipmentInformation)
lineItem_shipmentInformation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItem' {Maybe ShipmentInformation
shipmentInformation :: Maybe ShipmentInformation
$sel:shipmentInformation:LineItem' :: LineItem -> Maybe ShipmentInformation
shipmentInformation} -> Maybe ShipmentInformation
shipmentInformation) (\s :: LineItem
s@LineItem' {} Maybe ShipmentInformation
a -> LineItem
s {$sel:shipmentInformation:LineItem' :: Maybe ShipmentInformation
shipmentInformation = Maybe ShipmentInformation
a} :: LineItem)

-- | The status of the line item.
lineItem_status :: Lens.Lens' LineItem (Prelude.Maybe LineItemStatus)
lineItem_status :: Lens' LineItem (Maybe LineItemStatus)
lineItem_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineItem' {Maybe LineItemStatus
status :: Maybe LineItemStatus
$sel:status:LineItem' :: LineItem -> Maybe LineItemStatus
status} -> Maybe LineItemStatus
status) (\s :: LineItem
s@LineItem' {} Maybe LineItemStatus
a -> LineItem
s {$sel:status:LineItem' :: Maybe LineItemStatus
status = Maybe LineItemStatus
a} :: LineItem)

instance Data.FromJSON LineItem where
  parseJSON :: Value -> Parser LineItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LineItem"
      ( \Object
x ->
          Maybe [LineItemAssetInformation]
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe ShipmentInformation
-> Maybe LineItemStatus
-> LineItem
LineItem'
            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
"AssetInformationList"
                            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
"CatalogItemId")
            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
"LineItemId")
            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
"Quantity")
            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
"ShipmentInformation")
            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 LineItem where
  hashWithSalt :: Int -> LineItem -> Int
hashWithSalt Int
_salt LineItem' {Maybe Natural
Maybe [LineItemAssetInformation]
Maybe Text
Maybe LineItemStatus
Maybe ShipmentInformation
status :: Maybe LineItemStatus
shipmentInformation :: Maybe ShipmentInformation
quantity :: Maybe Natural
lineItemId :: Maybe Text
catalogItemId :: Maybe Text
assetInformationList :: Maybe [LineItemAssetInformation]
$sel:status:LineItem' :: LineItem -> Maybe LineItemStatus
$sel:shipmentInformation:LineItem' :: LineItem -> Maybe ShipmentInformation
$sel:quantity:LineItem' :: LineItem -> Maybe Natural
$sel:lineItemId:LineItem' :: LineItem -> Maybe Text
$sel:catalogItemId:LineItem' :: LineItem -> Maybe Text
$sel:assetInformationList:LineItem' :: LineItem -> Maybe [LineItemAssetInformation]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LineItemAssetInformation]
assetInformationList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogItemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lineItemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
quantity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ShipmentInformation
shipmentInformation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LineItemStatus
status

instance Prelude.NFData LineItem where
  rnf :: LineItem -> ()
rnf LineItem' {Maybe Natural
Maybe [LineItemAssetInformation]
Maybe Text
Maybe LineItemStatus
Maybe ShipmentInformation
status :: Maybe LineItemStatus
shipmentInformation :: Maybe ShipmentInformation
quantity :: Maybe Natural
lineItemId :: Maybe Text
catalogItemId :: Maybe Text
assetInformationList :: Maybe [LineItemAssetInformation]
$sel:status:LineItem' :: LineItem -> Maybe LineItemStatus
$sel:shipmentInformation:LineItem' :: LineItem -> Maybe ShipmentInformation
$sel:quantity:LineItem' :: LineItem -> Maybe Natural
$sel:lineItemId:LineItem' :: LineItem -> Maybe Text
$sel:catalogItemId:LineItem' :: LineItem -> Maybe Text
$sel:assetInformationList:LineItem' :: LineItem -> Maybe [LineItemAssetInformation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [LineItemAssetInformation]
assetInformationList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogItemId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lineItemId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
quantity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ShipmentInformation
shipmentInformation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LineItemStatus
status