{-# 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.Route53Domains.Types.BillingRecord
-- 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.Route53Domains.Types.BillingRecord where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Domains.Types.OperationType

-- | Information for one billing record.
--
-- /See:/ 'newBillingRecord' smart constructor.
data BillingRecord = BillingRecord'
  { -- | The operation that you were charged for.
    BillingRecord -> Maybe OperationType
operation :: Prelude.Maybe OperationType,
    -- | The ID of the invoice that is associated with the billing record.
    BillingRecord -> Maybe Text
invoiceId :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain that the billing record applies to. If the domain
    -- name contains characters other than a-z, 0-9, and - (hyphen), such as an
    -- internationalized domain name, then this value is in Punycode. For more
    -- information, see
    -- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html DNS Domain Name Format>
    -- in the /Amazon Route 53 Developer Guide/.
    BillingRecord -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | The date that the operation was billed, in Unix format.
    BillingRecord -> Maybe POSIX
billDate :: Prelude.Maybe Core.POSIX,
    -- | The price that you were charged for the operation, in US dollars.
    --
    -- Example value: 12.0
    BillingRecord -> Maybe Double
price :: Prelude.Maybe Prelude.Double
  }
  deriving (BillingRecord -> BillingRecord -> Bool
(BillingRecord -> BillingRecord -> Bool)
-> (BillingRecord -> BillingRecord -> Bool) -> Eq BillingRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BillingRecord -> BillingRecord -> Bool
$c/= :: BillingRecord -> BillingRecord -> Bool
== :: BillingRecord -> BillingRecord -> Bool
$c== :: BillingRecord -> BillingRecord -> Bool
Prelude.Eq, ReadPrec [BillingRecord]
ReadPrec BillingRecord
Int -> ReadS BillingRecord
ReadS [BillingRecord]
(Int -> ReadS BillingRecord)
-> ReadS [BillingRecord]
-> ReadPrec BillingRecord
-> ReadPrec [BillingRecord]
-> Read BillingRecord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BillingRecord]
$creadListPrec :: ReadPrec [BillingRecord]
readPrec :: ReadPrec BillingRecord
$creadPrec :: ReadPrec BillingRecord
readList :: ReadS [BillingRecord]
$creadList :: ReadS [BillingRecord]
readsPrec :: Int -> ReadS BillingRecord
$creadsPrec :: Int -> ReadS BillingRecord
Prelude.Read, Int -> BillingRecord -> ShowS
[BillingRecord] -> ShowS
BillingRecord -> String
(Int -> BillingRecord -> ShowS)
-> (BillingRecord -> String)
-> ([BillingRecord] -> ShowS)
-> Show BillingRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BillingRecord] -> ShowS
$cshowList :: [BillingRecord] -> ShowS
show :: BillingRecord -> String
$cshow :: BillingRecord -> String
showsPrec :: Int -> BillingRecord -> ShowS
$cshowsPrec :: Int -> BillingRecord -> ShowS
Prelude.Show, (forall x. BillingRecord -> Rep BillingRecord x)
-> (forall x. Rep BillingRecord x -> BillingRecord)
-> Generic BillingRecord
forall x. Rep BillingRecord x -> BillingRecord
forall x. BillingRecord -> Rep BillingRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BillingRecord x -> BillingRecord
$cfrom :: forall x. BillingRecord -> Rep BillingRecord x
Prelude.Generic)

-- |
-- Create a value of 'BillingRecord' 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:
--
-- 'operation', 'billingRecord_operation' - The operation that you were charged for.
--
-- 'invoiceId', 'billingRecord_invoiceId' - The ID of the invoice that is associated with the billing record.
--
-- 'domainName', 'billingRecord_domainName' - The name of the domain that the billing record applies to. If the domain
-- name contains characters other than a-z, 0-9, and - (hyphen), such as an
-- internationalized domain name, then this value is in Punycode. For more
-- information, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html DNS Domain Name Format>
-- in the /Amazon Route 53 Developer Guide/.
--
-- 'billDate', 'billingRecord_billDate' - The date that the operation was billed, in Unix format.
--
-- 'price', 'billingRecord_price' - The price that you were charged for the operation, in US dollars.
--
-- Example value: 12.0
newBillingRecord ::
  BillingRecord
newBillingRecord :: BillingRecord
newBillingRecord =
  BillingRecord' :: Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Double
-> BillingRecord
BillingRecord'
    { $sel:operation:BillingRecord' :: Maybe OperationType
operation = Maybe OperationType
forall a. Maybe a
Prelude.Nothing,
      $sel:invoiceId:BillingRecord' :: Maybe Text
invoiceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:BillingRecord' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:billDate:BillingRecord' :: Maybe POSIX
billDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:price:BillingRecord' :: Maybe Double
price = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The operation that you were charged for.
billingRecord_operation :: Lens.Lens' BillingRecord (Prelude.Maybe OperationType)
billingRecord_operation :: (Maybe OperationType -> f (Maybe OperationType))
-> BillingRecord -> f BillingRecord
billingRecord_operation = (BillingRecord -> Maybe OperationType)
-> (BillingRecord -> Maybe OperationType -> BillingRecord)
-> Lens
     BillingRecord
     BillingRecord
     (Maybe OperationType)
     (Maybe OperationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingRecord' {Maybe OperationType
operation :: Maybe OperationType
$sel:operation:BillingRecord' :: BillingRecord -> Maybe OperationType
operation} -> Maybe OperationType
operation) (\s :: BillingRecord
s@BillingRecord' {} Maybe OperationType
a -> BillingRecord
s {$sel:operation:BillingRecord' :: Maybe OperationType
operation = Maybe OperationType
a} :: BillingRecord)

-- | The ID of the invoice that is associated with the billing record.
billingRecord_invoiceId :: Lens.Lens' BillingRecord (Prelude.Maybe Prelude.Text)
billingRecord_invoiceId :: (Maybe Text -> f (Maybe Text)) -> BillingRecord -> f BillingRecord
billingRecord_invoiceId = (BillingRecord -> Maybe Text)
-> (BillingRecord -> Maybe Text -> BillingRecord)
-> Lens BillingRecord BillingRecord (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingRecord' {Maybe Text
invoiceId :: Maybe Text
$sel:invoiceId:BillingRecord' :: BillingRecord -> Maybe Text
invoiceId} -> Maybe Text
invoiceId) (\s :: BillingRecord
s@BillingRecord' {} Maybe Text
a -> BillingRecord
s {$sel:invoiceId:BillingRecord' :: Maybe Text
invoiceId = Maybe Text
a} :: BillingRecord)

-- | The name of the domain that the billing record applies to. If the domain
-- name contains characters other than a-z, 0-9, and - (hyphen), such as an
-- internationalized domain name, then this value is in Punycode. For more
-- information, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html DNS Domain Name Format>
-- in the /Amazon Route 53 Developer Guide/.
billingRecord_domainName :: Lens.Lens' BillingRecord (Prelude.Maybe Prelude.Text)
billingRecord_domainName :: (Maybe Text -> f (Maybe Text)) -> BillingRecord -> f BillingRecord
billingRecord_domainName = (BillingRecord -> Maybe Text)
-> (BillingRecord -> Maybe Text -> BillingRecord)
-> Lens BillingRecord BillingRecord (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingRecord' {Maybe Text
domainName :: Maybe Text
$sel:domainName:BillingRecord' :: BillingRecord -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: BillingRecord
s@BillingRecord' {} Maybe Text
a -> BillingRecord
s {$sel:domainName:BillingRecord' :: Maybe Text
domainName = Maybe Text
a} :: BillingRecord)

-- | The date that the operation was billed, in Unix format.
billingRecord_billDate :: Lens.Lens' BillingRecord (Prelude.Maybe Prelude.UTCTime)
billingRecord_billDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> BillingRecord -> f BillingRecord
billingRecord_billDate = (BillingRecord -> Maybe POSIX)
-> (BillingRecord -> Maybe POSIX -> BillingRecord)
-> Lens BillingRecord BillingRecord (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingRecord' {Maybe POSIX
billDate :: Maybe POSIX
$sel:billDate:BillingRecord' :: BillingRecord -> Maybe POSIX
billDate} -> Maybe POSIX
billDate) (\s :: BillingRecord
s@BillingRecord' {} Maybe POSIX
a -> BillingRecord
s {$sel:billDate:BillingRecord' :: Maybe POSIX
billDate = Maybe POSIX
a} :: BillingRecord) ((Maybe POSIX -> f (Maybe POSIX))
 -> BillingRecord -> f BillingRecord)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> BillingRecord
-> f BillingRecord
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The price that you were charged for the operation, in US dollars.
--
-- Example value: 12.0
billingRecord_price :: Lens.Lens' BillingRecord (Prelude.Maybe Prelude.Double)
billingRecord_price :: (Maybe Double -> f (Maybe Double))
-> BillingRecord -> f BillingRecord
billingRecord_price = (BillingRecord -> Maybe Double)
-> (BillingRecord -> Maybe Double -> BillingRecord)
-> Lens BillingRecord BillingRecord (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingRecord' {Maybe Double
price :: Maybe Double
$sel:price:BillingRecord' :: BillingRecord -> Maybe Double
price} -> Maybe Double
price) (\s :: BillingRecord
s@BillingRecord' {} Maybe Double
a -> BillingRecord
s {$sel:price:BillingRecord' :: Maybe Double
price = Maybe Double
a} :: BillingRecord)

instance Core.FromJSON BillingRecord where
  parseJSON :: Value -> Parser BillingRecord
parseJSON =
    String
-> (Object -> Parser BillingRecord)
-> Value
-> Parser BillingRecord
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BillingRecord"
      ( \Object
x ->
          Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Double
-> BillingRecord
BillingRecord'
            (Maybe OperationType
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Double
 -> BillingRecord)
-> Parser (Maybe OperationType)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe POSIX -> Maybe Double -> BillingRecord)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OperationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Operation")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe POSIX -> Maybe Double -> BillingRecord)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe Double -> BillingRecord)
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
"InvoiceId")
            Parser (Maybe Text -> Maybe POSIX -> Maybe Double -> BillingRecord)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Double -> BillingRecord)
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
"DomainName")
            Parser (Maybe POSIX -> Maybe Double -> BillingRecord)
-> Parser (Maybe POSIX) -> Parser (Maybe Double -> BillingRecord)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BillDate")
            Parser (Maybe Double -> BillingRecord)
-> Parser (Maybe Double) -> Parser BillingRecord
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Price")
      )

instance Prelude.Hashable BillingRecord

instance Prelude.NFData BillingRecord