{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Domains.Types.BillingRecord 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
import Amazonka.Route53Domains.Types.OperationType

-- | Information for one billing record.
--
-- /See:/ 'newBillingRecord' smart constructor.
data BillingRecord = BillingRecord'
  { -- | The date that the operation was billed, in Unix format.
    BillingRecord -> Maybe POSIX
billDate :: Prelude.Maybe Data.POSIX,
    -- | 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 ID of the invoice that is associated with the billing record.
    BillingRecord -> Maybe Text
invoiceId :: Prelude.Maybe Prelude.Text,
    -- | The operation that you were charged for.
    BillingRecord -> Maybe OperationType
operation :: Prelude.Maybe OperationType,
    -- | 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
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]
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
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. 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:
--
-- 'billDate', 'billingRecord_billDate' - The date that the operation was billed, in Unix format.
--
-- '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/.
--
-- 'invoiceId', 'billingRecord_invoiceId' - The ID of the invoice that is associated with the billing record.
--
-- 'operation', 'billingRecord_operation' - The operation that you were charged for.
--
-- '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'
    { $sel:billDate:BillingRecord' :: Maybe POSIX
billDate = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:BillingRecord' :: Maybe Text
domainName = forall a. Maybe a
Prelude.Nothing,
      $sel:invoiceId:BillingRecord' :: Maybe Text
invoiceId = forall a. Maybe a
Prelude.Nothing,
      $sel:operation:BillingRecord' :: Maybe OperationType
operation = forall a. Maybe a
Prelude.Nothing,
      $sel:price:BillingRecord' :: Maybe Double
price = forall a. Maybe a
Prelude.Nothing
    }

-- | The date that the operation was billed, in Unix format.
billingRecord_billDate :: Lens.Lens' BillingRecord (Prelude.Maybe Prelude.UTCTime)
billingRecord_billDate :: Lens' BillingRecord (Maybe UTCTime)
billingRecord_billDate = 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) 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

-- | 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 :: Lens' BillingRecord (Maybe Text)
billingRecord_domainName = 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 ID of the invoice that is associated with the billing record.
billingRecord_invoiceId :: Lens.Lens' BillingRecord (Prelude.Maybe Prelude.Text)
billingRecord_invoiceId :: Lens' BillingRecord (Maybe Text)
billingRecord_invoiceId = 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 operation that you were charged for.
billingRecord_operation :: Lens.Lens' BillingRecord (Prelude.Maybe OperationType)
billingRecord_operation :: Lens' BillingRecord (Maybe OperationType)
billingRecord_operation = 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 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 :: Lens' BillingRecord (Maybe Double)
billingRecord_price = 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 Data.FromJSON BillingRecord where
  parseJSON :: Value -> Parser BillingRecord
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BillingRecord"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe OperationType
-> Maybe Double
-> BillingRecord
BillingRecord'
            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
"BillDate")
            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
"DomainName")
            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
"InvoiceId")
            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
"Operation")
            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
"Price")
      )

instance Prelude.Hashable BillingRecord where
  hashWithSalt :: Int -> BillingRecord -> Int
hashWithSalt Int
_salt BillingRecord' {Maybe Double
Maybe Text
Maybe POSIX
Maybe OperationType
price :: Maybe Double
operation :: Maybe OperationType
invoiceId :: Maybe Text
domainName :: Maybe Text
billDate :: Maybe POSIX
$sel:price:BillingRecord' :: BillingRecord -> Maybe Double
$sel:operation:BillingRecord' :: BillingRecord -> Maybe OperationType
$sel:invoiceId:BillingRecord' :: BillingRecord -> Maybe Text
$sel:domainName:BillingRecord' :: BillingRecord -> Maybe Text
$sel:billDate:BillingRecord' :: BillingRecord -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
billDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
invoiceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OperationType
operation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
price

instance Prelude.NFData BillingRecord where
  rnf :: BillingRecord -> ()
rnf BillingRecord' {Maybe Double
Maybe Text
Maybe POSIX
Maybe OperationType
price :: Maybe Double
operation :: Maybe OperationType
invoiceId :: Maybe Text
domainName :: Maybe Text
billDate :: Maybe POSIX
$sel:price:BillingRecord' :: BillingRecord -> Maybe Double
$sel:operation:BillingRecord' :: BillingRecord -> Maybe OperationType
$sel:invoiceId:BillingRecord' :: BillingRecord -> Maybe Text
$sel:domainName:BillingRecord' :: BillingRecord -> Maybe Text
$sel:billDate:BillingRecord' :: BillingRecord -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
billDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
invoiceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OperationType
operation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
price