{-# 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.DeviceFarm.Types.OfferingStatus
-- 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.DeviceFarm.Types.OfferingStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types.Offering
import Amazonka.DeviceFarm.Types.OfferingTransactionType
import qualified Amazonka.Prelude as Prelude

-- | The status of the offering.
--
-- /See:/ 'newOfferingStatus' smart constructor.
data OfferingStatus = OfferingStatus'
  { -- | The date on which the offering is effective.
    OfferingStatus -> Maybe POSIX
effectiveOn :: Prelude.Maybe Data.POSIX,
    -- | Represents the metadata of an offering status.
    OfferingStatus -> Maybe Offering
offering :: Prelude.Maybe Offering,
    -- | The number of available devices in the offering.
    OfferingStatus -> Maybe Int
quantity :: Prelude.Maybe Prelude.Int,
    -- | The type specified for the offering status.
    OfferingStatus -> Maybe OfferingTransactionType
type' :: Prelude.Maybe OfferingTransactionType
  }
  deriving (OfferingStatus -> OfferingStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OfferingStatus -> OfferingStatus -> Bool
$c/= :: OfferingStatus -> OfferingStatus -> Bool
== :: OfferingStatus -> OfferingStatus -> Bool
$c== :: OfferingStatus -> OfferingStatus -> Bool
Prelude.Eq, ReadPrec [OfferingStatus]
ReadPrec OfferingStatus
Int -> ReadS OfferingStatus
ReadS [OfferingStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OfferingStatus]
$creadListPrec :: ReadPrec [OfferingStatus]
readPrec :: ReadPrec OfferingStatus
$creadPrec :: ReadPrec OfferingStatus
readList :: ReadS [OfferingStatus]
$creadList :: ReadS [OfferingStatus]
readsPrec :: Int -> ReadS OfferingStatus
$creadsPrec :: Int -> ReadS OfferingStatus
Prelude.Read, Int -> OfferingStatus -> ShowS
[OfferingStatus] -> ShowS
OfferingStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OfferingStatus] -> ShowS
$cshowList :: [OfferingStatus] -> ShowS
show :: OfferingStatus -> String
$cshow :: OfferingStatus -> String
showsPrec :: Int -> OfferingStatus -> ShowS
$cshowsPrec :: Int -> OfferingStatus -> ShowS
Prelude.Show, forall x. Rep OfferingStatus x -> OfferingStatus
forall x. OfferingStatus -> Rep OfferingStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OfferingStatus x -> OfferingStatus
$cfrom :: forall x. OfferingStatus -> Rep OfferingStatus x
Prelude.Generic)

-- |
-- Create a value of 'OfferingStatus' 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:
--
-- 'effectiveOn', 'offeringStatus_effectiveOn' - The date on which the offering is effective.
--
-- 'offering', 'offeringStatus_offering' - Represents the metadata of an offering status.
--
-- 'quantity', 'offeringStatus_quantity' - The number of available devices in the offering.
--
-- 'type'', 'offeringStatus_type' - The type specified for the offering status.
newOfferingStatus ::
  OfferingStatus
newOfferingStatus :: OfferingStatus
newOfferingStatus =
  OfferingStatus'
    { $sel:effectiveOn:OfferingStatus' :: Maybe POSIX
effectiveOn = forall a. Maybe a
Prelude.Nothing,
      $sel:offering:OfferingStatus' :: Maybe Offering
offering = forall a. Maybe a
Prelude.Nothing,
      $sel:quantity:OfferingStatus' :: Maybe Int
quantity = forall a. Maybe a
Prelude.Nothing,
      $sel:type':OfferingStatus' :: Maybe OfferingTransactionType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The date on which the offering is effective.
offeringStatus_effectiveOn :: Lens.Lens' OfferingStatus (Prelude.Maybe Prelude.UTCTime)
offeringStatus_effectiveOn :: Lens' OfferingStatus (Maybe UTCTime)
offeringStatus_effectiveOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfferingStatus' {Maybe POSIX
effectiveOn :: Maybe POSIX
$sel:effectiveOn:OfferingStatus' :: OfferingStatus -> Maybe POSIX
effectiveOn} -> Maybe POSIX
effectiveOn) (\s :: OfferingStatus
s@OfferingStatus' {} Maybe POSIX
a -> OfferingStatus
s {$sel:effectiveOn:OfferingStatus' :: Maybe POSIX
effectiveOn = Maybe POSIX
a} :: OfferingStatus) 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

-- | Represents the metadata of an offering status.
offeringStatus_offering :: Lens.Lens' OfferingStatus (Prelude.Maybe Offering)
offeringStatus_offering :: Lens' OfferingStatus (Maybe Offering)
offeringStatus_offering = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfferingStatus' {Maybe Offering
offering :: Maybe Offering
$sel:offering:OfferingStatus' :: OfferingStatus -> Maybe Offering
offering} -> Maybe Offering
offering) (\s :: OfferingStatus
s@OfferingStatus' {} Maybe Offering
a -> OfferingStatus
s {$sel:offering:OfferingStatus' :: Maybe Offering
offering = Maybe Offering
a} :: OfferingStatus)

-- | The number of available devices in the offering.
offeringStatus_quantity :: Lens.Lens' OfferingStatus (Prelude.Maybe Prelude.Int)
offeringStatus_quantity :: Lens' OfferingStatus (Maybe Int)
offeringStatus_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfferingStatus' {Maybe Int
quantity :: Maybe Int
$sel:quantity:OfferingStatus' :: OfferingStatus -> Maybe Int
quantity} -> Maybe Int
quantity) (\s :: OfferingStatus
s@OfferingStatus' {} Maybe Int
a -> OfferingStatus
s {$sel:quantity:OfferingStatus' :: Maybe Int
quantity = Maybe Int
a} :: OfferingStatus)

-- | The type specified for the offering status.
offeringStatus_type :: Lens.Lens' OfferingStatus (Prelude.Maybe OfferingTransactionType)
offeringStatus_type :: Lens' OfferingStatus (Maybe OfferingTransactionType)
offeringStatus_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OfferingStatus' {Maybe OfferingTransactionType
type' :: Maybe OfferingTransactionType
$sel:type':OfferingStatus' :: OfferingStatus -> Maybe OfferingTransactionType
type'} -> Maybe OfferingTransactionType
type') (\s :: OfferingStatus
s@OfferingStatus' {} Maybe OfferingTransactionType
a -> OfferingStatus
s {$sel:type':OfferingStatus' :: Maybe OfferingTransactionType
type' = Maybe OfferingTransactionType
a} :: OfferingStatus)

instance Data.FromJSON OfferingStatus where
  parseJSON :: Value -> Parser OfferingStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OfferingStatus"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Offering
-> Maybe Int
-> Maybe OfferingTransactionType
-> OfferingStatus
OfferingStatus'
            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
"effectiveOn")
            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
"offering")
            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
"type")
      )

instance Prelude.Hashable OfferingStatus where
  hashWithSalt :: Int -> OfferingStatus -> Int
hashWithSalt Int
_salt OfferingStatus' {Maybe Int
Maybe POSIX
Maybe OfferingTransactionType
Maybe Offering
type' :: Maybe OfferingTransactionType
quantity :: Maybe Int
offering :: Maybe Offering
effectiveOn :: Maybe POSIX
$sel:type':OfferingStatus' :: OfferingStatus -> Maybe OfferingTransactionType
$sel:quantity:OfferingStatus' :: OfferingStatus -> Maybe Int
$sel:offering:OfferingStatus' :: OfferingStatus -> Maybe Offering
$sel:effectiveOn:OfferingStatus' :: OfferingStatus -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
effectiveOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Offering
offering
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
quantity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OfferingTransactionType
type'

instance Prelude.NFData OfferingStatus where
  rnf :: OfferingStatus -> ()
rnf OfferingStatus' {Maybe Int
Maybe POSIX
Maybe OfferingTransactionType
Maybe Offering
type' :: Maybe OfferingTransactionType
quantity :: Maybe Int
offering :: Maybe Offering
effectiveOn :: Maybe POSIX
$sel:type':OfferingStatus' :: OfferingStatus -> Maybe OfferingTransactionType
$sel:quantity:OfferingStatus' :: OfferingStatus -> Maybe Int
$sel:offering:OfferingStatus' :: OfferingStatus -> Maybe Offering
$sel:effectiveOn:OfferingStatus' :: OfferingStatus -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
effectiveOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Offering
offering
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
quantity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OfferingTransactionType
type'