{-# 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.TrialMinutes
-- 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.TrialMinutes where

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

-- | Represents information about free trial device minutes for an AWS
-- account.
--
-- /See:/ 'newTrialMinutes' smart constructor.
data TrialMinutes = TrialMinutes'
  { -- | The number of free trial minutes remaining in the account.
    TrialMinutes -> Maybe Double
remaining :: Prelude.Maybe Prelude.Double,
    -- | The total number of free trial minutes that the account started with.
    TrialMinutes -> Maybe Double
total :: Prelude.Maybe Prelude.Double
  }
  deriving (TrialMinutes -> TrialMinutes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrialMinutes -> TrialMinutes -> Bool
$c/= :: TrialMinutes -> TrialMinutes -> Bool
== :: TrialMinutes -> TrialMinutes -> Bool
$c== :: TrialMinutes -> TrialMinutes -> Bool
Prelude.Eq, ReadPrec [TrialMinutes]
ReadPrec TrialMinutes
Int -> ReadS TrialMinutes
ReadS [TrialMinutes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrialMinutes]
$creadListPrec :: ReadPrec [TrialMinutes]
readPrec :: ReadPrec TrialMinutes
$creadPrec :: ReadPrec TrialMinutes
readList :: ReadS [TrialMinutes]
$creadList :: ReadS [TrialMinutes]
readsPrec :: Int -> ReadS TrialMinutes
$creadsPrec :: Int -> ReadS TrialMinutes
Prelude.Read, Int -> TrialMinutes -> ShowS
[TrialMinutes] -> ShowS
TrialMinutes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrialMinutes] -> ShowS
$cshowList :: [TrialMinutes] -> ShowS
show :: TrialMinutes -> String
$cshow :: TrialMinutes -> String
showsPrec :: Int -> TrialMinutes -> ShowS
$cshowsPrec :: Int -> TrialMinutes -> ShowS
Prelude.Show, forall x. Rep TrialMinutes x -> TrialMinutes
forall x. TrialMinutes -> Rep TrialMinutes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrialMinutes x -> TrialMinutes
$cfrom :: forall x. TrialMinutes -> Rep TrialMinutes x
Prelude.Generic)

-- |
-- Create a value of 'TrialMinutes' 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:
--
-- 'remaining', 'trialMinutes_remaining' - The number of free trial minutes remaining in the account.
--
-- 'total', 'trialMinutes_total' - The total number of free trial minutes that the account started with.
newTrialMinutes ::
  TrialMinutes
newTrialMinutes :: TrialMinutes
newTrialMinutes =
  TrialMinutes'
    { $sel:remaining:TrialMinutes' :: Maybe Double
remaining = forall a. Maybe a
Prelude.Nothing,
      $sel:total:TrialMinutes' :: Maybe Double
total = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of free trial minutes remaining in the account.
trialMinutes_remaining :: Lens.Lens' TrialMinutes (Prelude.Maybe Prelude.Double)
trialMinutes_remaining :: Lens' TrialMinutes (Maybe Double)
trialMinutes_remaining = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialMinutes' {Maybe Double
remaining :: Maybe Double
$sel:remaining:TrialMinutes' :: TrialMinutes -> Maybe Double
remaining} -> Maybe Double
remaining) (\s :: TrialMinutes
s@TrialMinutes' {} Maybe Double
a -> TrialMinutes
s {$sel:remaining:TrialMinutes' :: Maybe Double
remaining = Maybe Double
a} :: TrialMinutes)

-- | The total number of free trial minutes that the account started with.
trialMinutes_total :: Lens.Lens' TrialMinutes (Prelude.Maybe Prelude.Double)
trialMinutes_total :: Lens' TrialMinutes (Maybe Double)
trialMinutes_total = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialMinutes' {Maybe Double
total :: Maybe Double
$sel:total:TrialMinutes' :: TrialMinutes -> Maybe Double
total} -> Maybe Double
total) (\s :: TrialMinutes
s@TrialMinutes' {} Maybe Double
a -> TrialMinutes
s {$sel:total:TrialMinutes' :: Maybe Double
total = Maybe Double
a} :: TrialMinutes)

instance Data.FromJSON TrialMinutes where
  parseJSON :: Value -> Parser TrialMinutes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrialMinutes"
      ( \Object
x ->
          Maybe Double -> Maybe Double -> TrialMinutes
TrialMinutes'
            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
"remaining")
            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
"total")
      )

instance Prelude.Hashable TrialMinutes where
  hashWithSalt :: Int -> TrialMinutes -> Int
hashWithSalt Int
_salt TrialMinutes' {Maybe Double
total :: Maybe Double
remaining :: Maybe Double
$sel:total:TrialMinutes' :: TrialMinutes -> Maybe Double
$sel:remaining:TrialMinutes' :: TrialMinutes -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
remaining
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
total

instance Prelude.NFData TrialMinutes where
  rnf :: TrialMinutes -> ()
rnf TrialMinutes' {Maybe Double
total :: Maybe Double
remaining :: Maybe Double
$sel:total:TrialMinutes' :: TrialMinutes -> Maybe Double
$sel:remaining:TrialMinutes' :: TrialMinutes -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
remaining
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
total