{-# 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.Snowball.Types.Shipment
-- 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.Snowball.Types.Shipment where

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

-- | The @Status@ and @TrackingNumber@ information for an inbound or outbound
-- shipment.
--
-- /See:/ 'newShipment' smart constructor.
data Shipment = Shipment'
  { -- | Status information for a shipment.
    Shipment -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The tracking number for this job. Using this tracking number with your
    -- region\'s carrier\'s website, you can track a Snow device as the carrier
    -- transports it.
    --
    -- For India, the carrier is Amazon Logistics. For all other regions, UPS
    -- is the carrier.
    Shipment -> Maybe Text
trackingNumber :: Prelude.Maybe Prelude.Text
  }
  deriving (Shipment -> Shipment -> Bool
(Shipment -> Shipment -> Bool)
-> (Shipment -> Shipment -> Bool) -> Eq Shipment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Shipment -> Shipment -> Bool
$c/= :: Shipment -> Shipment -> Bool
== :: Shipment -> Shipment -> Bool
$c== :: Shipment -> Shipment -> Bool
Prelude.Eq, ReadPrec [Shipment]
ReadPrec Shipment
Int -> ReadS Shipment
ReadS [Shipment]
(Int -> ReadS Shipment)
-> ReadS [Shipment]
-> ReadPrec Shipment
-> ReadPrec [Shipment]
-> Read Shipment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Shipment]
$creadListPrec :: ReadPrec [Shipment]
readPrec :: ReadPrec Shipment
$creadPrec :: ReadPrec Shipment
readList :: ReadS [Shipment]
$creadList :: ReadS [Shipment]
readsPrec :: Int -> ReadS Shipment
$creadsPrec :: Int -> ReadS Shipment
Prelude.Read, Int -> Shipment -> ShowS
[Shipment] -> ShowS
Shipment -> String
(Int -> Shipment -> ShowS)
-> (Shipment -> String) -> ([Shipment] -> ShowS) -> Show Shipment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Shipment] -> ShowS
$cshowList :: [Shipment] -> ShowS
show :: Shipment -> String
$cshow :: Shipment -> String
showsPrec :: Int -> Shipment -> ShowS
$cshowsPrec :: Int -> Shipment -> ShowS
Prelude.Show, (forall x. Shipment -> Rep Shipment x)
-> (forall x. Rep Shipment x -> Shipment) -> Generic Shipment
forall x. Rep Shipment x -> Shipment
forall x. Shipment -> Rep Shipment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Shipment x -> Shipment
$cfrom :: forall x. Shipment -> Rep Shipment x
Prelude.Generic)

-- |
-- Create a value of 'Shipment' 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', 'shipment_status' - Status information for a shipment.
--
-- 'trackingNumber', 'shipment_trackingNumber' - The tracking number for this job. Using this tracking number with your
-- region\'s carrier\'s website, you can track a Snow device as the carrier
-- transports it.
--
-- For India, the carrier is Amazon Logistics. For all other regions, UPS
-- is the carrier.
newShipment ::
  Shipment
newShipment :: Shipment
newShipment =
  Shipment' :: Maybe Text -> Maybe Text -> Shipment
Shipment'
    { $sel:status:Shipment' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:trackingNumber:Shipment' :: Maybe Text
trackingNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Status information for a shipment.
shipment_status :: Lens.Lens' Shipment (Prelude.Maybe Prelude.Text)
shipment_status :: (Maybe Text -> f (Maybe Text)) -> Shipment -> f Shipment
shipment_status = (Shipment -> Maybe Text)
-> (Shipment -> Maybe Text -> Shipment)
-> Lens Shipment Shipment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shipment' {Maybe Text
status :: Maybe Text
$sel:status:Shipment' :: Shipment -> Maybe Text
status} -> Maybe Text
status) (\s :: Shipment
s@Shipment' {} Maybe Text
a -> Shipment
s {$sel:status:Shipment' :: Maybe Text
status = Maybe Text
a} :: Shipment)

-- | The tracking number for this job. Using this tracking number with your
-- region\'s carrier\'s website, you can track a Snow device as the carrier
-- transports it.
--
-- For India, the carrier is Amazon Logistics. For all other regions, UPS
-- is the carrier.
shipment_trackingNumber :: Lens.Lens' Shipment (Prelude.Maybe Prelude.Text)
shipment_trackingNumber :: (Maybe Text -> f (Maybe Text)) -> Shipment -> f Shipment
shipment_trackingNumber = (Shipment -> Maybe Text)
-> (Shipment -> Maybe Text -> Shipment)
-> Lens Shipment Shipment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shipment' {Maybe Text
trackingNumber :: Maybe Text
$sel:trackingNumber:Shipment' :: Shipment -> Maybe Text
trackingNumber} -> Maybe Text
trackingNumber) (\s :: Shipment
s@Shipment' {} Maybe Text
a -> Shipment
s {$sel:trackingNumber:Shipment' :: Maybe Text
trackingNumber = Maybe Text
a} :: Shipment)

instance Core.FromJSON Shipment where
  parseJSON :: Value -> Parser Shipment
parseJSON =
    String -> (Object -> Parser Shipment) -> Value -> Parser Shipment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Shipment"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Shipment
Shipment'
            (Maybe Text -> Maybe Text -> Shipment)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Shipment)
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 Text -> Shipment)
-> Parser (Maybe Text) -> Parser Shipment
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
"TrackingNumber")
      )

instance Prelude.Hashable Shipment

instance Prelude.NFData Shipment