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

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

-- | Information about a line item.
--
-- /See:/ 'newLineItem' smart constructor.
data LineItem = LineItem'
  { -- | The status of the line item.
    LineItem -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The quantity of the line item.
    LineItem -> Maybe Natural
quantity :: Prelude.Maybe Prelude.Natural,
    -- | 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
  }
  deriving (LineItem -> LineItem -> Bool
(LineItem -> LineItem -> Bool)
-> (LineItem -> LineItem -> Bool) -> Eq LineItem
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]
(Int -> ReadS LineItem)
-> ReadS [LineItem]
-> ReadPrec LineItem
-> ReadPrec [LineItem]
-> Read 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
(Int -> LineItem -> ShowS)
-> (LineItem -> String) -> ([LineItem] -> ShowS) -> Show LineItem
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. LineItem -> Rep LineItem x)
-> (forall x. Rep LineItem x -> LineItem) -> Generic LineItem
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:
--
-- 'status', 'lineItem_status' - The status of the line item.
--
-- 'quantity', 'lineItem_quantity' - The quantity of the line item.
--
-- 'catalogItemId', 'lineItem_catalogItemId' - The ID of the catalog item.
--
-- 'lineItemId', 'lineItem_lineItemId' - The ID of the line item.
newLineItem ::
  LineItem
newLineItem :: LineItem
newLineItem =
  LineItem' :: Maybe Text -> Maybe Natural -> Maybe Text -> Maybe Text -> LineItem
LineItem'
    { $sel:status:LineItem' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:quantity:LineItem' :: Maybe Natural
quantity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:catalogItemId:LineItem' :: Maybe Text
catalogItemId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lineItemId:LineItem' :: Maybe Text
lineItemId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The quantity of the line item.
lineItem_quantity :: Lens.Lens' LineItem (Prelude.Maybe Prelude.Natural)
lineItem_quantity :: (Maybe Natural -> f (Maybe Natural)) -> LineItem -> f LineItem
lineItem_quantity = (LineItem -> Maybe Natural)
-> (LineItem -> Maybe Natural -> LineItem)
-> Lens LineItem LineItem (Maybe Natural) (Maybe Natural)
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)

-- | The ID of the catalog item.
lineItem_catalogItemId :: Lens.Lens' LineItem (Prelude.Maybe Prelude.Text)
lineItem_catalogItemId :: (Maybe Text -> f (Maybe Text)) -> LineItem -> f LineItem
lineItem_catalogItemId = (LineItem -> Maybe Text)
-> (LineItem -> Maybe Text -> LineItem)
-> Lens LineItem LineItem (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> LineItem -> f LineItem
lineItem_lineItemId = (LineItem -> Maybe Text)
-> (LineItem -> Maybe Text -> LineItem)
-> Lens LineItem LineItem (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON LineItem where
  parseJSON :: Value -> Parser LineItem
parseJSON =
    String -> (Object -> Parser LineItem) -> Value -> Parser LineItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LineItem"
      ( \Object
x ->
          Maybe Text -> Maybe Natural -> Maybe Text -> Maybe Text -> LineItem
LineItem'
            (Maybe Text
 -> Maybe Natural -> Maybe Text -> Maybe Text -> LineItem)
-> Parser (Maybe Text)
-> Parser (Maybe Natural -> Maybe Text -> Maybe Text -> LineItem)
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
"Status")
            Parser (Maybe Natural -> Maybe Text -> Maybe Text -> LineItem)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> Maybe Text -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Quantity")
            Parser (Maybe Text -> Maybe Text -> LineItem)
-> Parser (Maybe Text) -> Parser (Maybe Text -> LineItem)
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
"CatalogItemId")
            Parser (Maybe Text -> LineItem)
-> Parser (Maybe Text) -> Parser LineItem
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
"LineItemId")
      )

instance Prelude.Hashable LineItem

instance Prelude.NFData LineItem