{-# 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.AlexaBusiness.Types.BusinessReport
-- 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.AlexaBusiness.Types.BusinessReport where

import Amazonka.AlexaBusiness.Types.BusinessReportFailureCode
import Amazonka.AlexaBusiness.Types.BusinessReportS3Location
import Amazonka.AlexaBusiness.Types.BusinessReportStatus
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

-- | Usage report with specified parameters.
--
-- /See:/ 'newBusinessReport' smart constructor.
data BusinessReport = BusinessReport'
  { -- | The time of report delivery.
    BusinessReport -> Maybe POSIX
deliveryTime :: Prelude.Maybe Data.POSIX,
    -- | The download link where a user can download the report.
    BusinessReport -> Maybe Text
downloadUrl :: Prelude.Maybe Prelude.Text,
    -- | The failure code.
    BusinessReport -> Maybe BusinessReportFailureCode
failureCode :: Prelude.Maybe BusinessReportFailureCode,
    -- | The S3 location of the output reports.
    BusinessReport -> Maybe BusinessReportS3Location
s3Location :: Prelude.Maybe BusinessReportS3Location,
    -- | The status of the report generation execution (RUNNING, SUCCEEDED, or
    -- FAILED).
    BusinessReport -> Maybe BusinessReportStatus
status :: Prelude.Maybe BusinessReportStatus
  }
  deriving (BusinessReport -> BusinessReport -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BusinessReport -> BusinessReport -> Bool
$c/= :: BusinessReport -> BusinessReport -> Bool
== :: BusinessReport -> BusinessReport -> Bool
$c== :: BusinessReport -> BusinessReport -> Bool
Prelude.Eq, ReadPrec [BusinessReport]
ReadPrec BusinessReport
Int -> ReadS BusinessReport
ReadS [BusinessReport]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BusinessReport]
$creadListPrec :: ReadPrec [BusinessReport]
readPrec :: ReadPrec BusinessReport
$creadPrec :: ReadPrec BusinessReport
readList :: ReadS [BusinessReport]
$creadList :: ReadS [BusinessReport]
readsPrec :: Int -> ReadS BusinessReport
$creadsPrec :: Int -> ReadS BusinessReport
Prelude.Read, Int -> BusinessReport -> ShowS
[BusinessReport] -> ShowS
BusinessReport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BusinessReport] -> ShowS
$cshowList :: [BusinessReport] -> ShowS
show :: BusinessReport -> String
$cshow :: BusinessReport -> String
showsPrec :: Int -> BusinessReport -> ShowS
$cshowsPrec :: Int -> BusinessReport -> ShowS
Prelude.Show, forall x. Rep BusinessReport x -> BusinessReport
forall x. BusinessReport -> Rep BusinessReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BusinessReport x -> BusinessReport
$cfrom :: forall x. BusinessReport -> Rep BusinessReport x
Prelude.Generic)

-- |
-- Create a value of 'BusinessReport' 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:
--
-- 'deliveryTime', 'businessReport_deliveryTime' - The time of report delivery.
--
-- 'downloadUrl', 'businessReport_downloadUrl' - The download link where a user can download the report.
--
-- 'failureCode', 'businessReport_failureCode' - The failure code.
--
-- 's3Location', 'businessReport_s3Location' - The S3 location of the output reports.
--
-- 'status', 'businessReport_status' - The status of the report generation execution (RUNNING, SUCCEEDED, or
-- FAILED).
newBusinessReport ::
  BusinessReport
newBusinessReport :: BusinessReport
newBusinessReport =
  BusinessReport'
    { $sel:deliveryTime:BusinessReport' :: Maybe POSIX
deliveryTime = forall a. Maybe a
Prelude.Nothing,
      $sel:downloadUrl:BusinessReport' :: Maybe Text
downloadUrl = forall a. Maybe a
Prelude.Nothing,
      $sel:failureCode:BusinessReport' :: Maybe BusinessReportFailureCode
failureCode = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Location:BusinessReport' :: Maybe BusinessReportS3Location
s3Location = forall a. Maybe a
Prelude.Nothing,
      $sel:status:BusinessReport' :: Maybe BusinessReportStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The time of report delivery.
businessReport_deliveryTime :: Lens.Lens' BusinessReport (Prelude.Maybe Prelude.UTCTime)
businessReport_deliveryTime :: Lens' BusinessReport (Maybe UTCTime)
businessReport_deliveryTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReport' {Maybe POSIX
deliveryTime :: Maybe POSIX
$sel:deliveryTime:BusinessReport' :: BusinessReport -> Maybe POSIX
deliveryTime} -> Maybe POSIX
deliveryTime) (\s :: BusinessReport
s@BusinessReport' {} Maybe POSIX
a -> BusinessReport
s {$sel:deliveryTime:BusinessReport' :: Maybe POSIX
deliveryTime = Maybe POSIX
a} :: BusinessReport) 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 download link where a user can download the report.
businessReport_downloadUrl :: Lens.Lens' BusinessReport (Prelude.Maybe Prelude.Text)
businessReport_downloadUrl :: Lens' BusinessReport (Maybe Text)
businessReport_downloadUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReport' {Maybe Text
downloadUrl :: Maybe Text
$sel:downloadUrl:BusinessReport' :: BusinessReport -> Maybe Text
downloadUrl} -> Maybe Text
downloadUrl) (\s :: BusinessReport
s@BusinessReport' {} Maybe Text
a -> BusinessReport
s {$sel:downloadUrl:BusinessReport' :: Maybe Text
downloadUrl = Maybe Text
a} :: BusinessReport)

-- | The failure code.
businessReport_failureCode :: Lens.Lens' BusinessReport (Prelude.Maybe BusinessReportFailureCode)
businessReport_failureCode :: Lens' BusinessReport (Maybe BusinessReportFailureCode)
businessReport_failureCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReport' {Maybe BusinessReportFailureCode
failureCode :: Maybe BusinessReportFailureCode
$sel:failureCode:BusinessReport' :: BusinessReport -> Maybe BusinessReportFailureCode
failureCode} -> Maybe BusinessReportFailureCode
failureCode) (\s :: BusinessReport
s@BusinessReport' {} Maybe BusinessReportFailureCode
a -> BusinessReport
s {$sel:failureCode:BusinessReport' :: Maybe BusinessReportFailureCode
failureCode = Maybe BusinessReportFailureCode
a} :: BusinessReport)

-- | The S3 location of the output reports.
businessReport_s3Location :: Lens.Lens' BusinessReport (Prelude.Maybe BusinessReportS3Location)
businessReport_s3Location :: Lens' BusinessReport (Maybe BusinessReportS3Location)
businessReport_s3Location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReport' {Maybe BusinessReportS3Location
s3Location :: Maybe BusinessReportS3Location
$sel:s3Location:BusinessReport' :: BusinessReport -> Maybe BusinessReportS3Location
s3Location} -> Maybe BusinessReportS3Location
s3Location) (\s :: BusinessReport
s@BusinessReport' {} Maybe BusinessReportS3Location
a -> BusinessReport
s {$sel:s3Location:BusinessReport' :: Maybe BusinessReportS3Location
s3Location = Maybe BusinessReportS3Location
a} :: BusinessReport)

-- | The status of the report generation execution (RUNNING, SUCCEEDED, or
-- FAILED).
businessReport_status :: Lens.Lens' BusinessReport (Prelude.Maybe BusinessReportStatus)
businessReport_status :: Lens' BusinessReport (Maybe BusinessReportStatus)
businessReport_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReport' {Maybe BusinessReportStatus
status :: Maybe BusinessReportStatus
$sel:status:BusinessReport' :: BusinessReport -> Maybe BusinessReportStatus
status} -> Maybe BusinessReportStatus
status) (\s :: BusinessReport
s@BusinessReport' {} Maybe BusinessReportStatus
a -> BusinessReport
s {$sel:status:BusinessReport' :: Maybe BusinessReportStatus
status = Maybe BusinessReportStatus
a} :: BusinessReport)

instance Data.FromJSON BusinessReport where
  parseJSON :: Value -> Parser BusinessReport
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BusinessReport"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe BusinessReportFailureCode
-> Maybe BusinessReportS3Location
-> Maybe BusinessReportStatus
-> BusinessReport
BusinessReport'
            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
"DeliveryTime")
            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
"DownloadUrl")
            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
"FailureCode")
            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
"S3Location")
            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
"Status")
      )

instance Prelude.Hashable BusinessReport where
  hashWithSalt :: Int -> BusinessReport -> Int
hashWithSalt Int
_salt BusinessReport' {Maybe Text
Maybe POSIX
Maybe BusinessReportFailureCode
Maybe BusinessReportS3Location
Maybe BusinessReportStatus
status :: Maybe BusinessReportStatus
s3Location :: Maybe BusinessReportS3Location
failureCode :: Maybe BusinessReportFailureCode
downloadUrl :: Maybe Text
deliveryTime :: Maybe POSIX
$sel:status:BusinessReport' :: BusinessReport -> Maybe BusinessReportStatus
$sel:s3Location:BusinessReport' :: BusinessReport -> Maybe BusinessReportS3Location
$sel:failureCode:BusinessReport' :: BusinessReport -> Maybe BusinessReportFailureCode
$sel:downloadUrl:BusinessReport' :: BusinessReport -> Maybe Text
$sel:deliveryTime:BusinessReport' :: BusinessReport -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
deliveryTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
downloadUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReportFailureCode
failureCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReportS3Location
s3Location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReportStatus
status

instance Prelude.NFData BusinessReport where
  rnf :: BusinessReport -> ()
rnf BusinessReport' {Maybe Text
Maybe POSIX
Maybe BusinessReportFailureCode
Maybe BusinessReportS3Location
Maybe BusinessReportStatus
status :: Maybe BusinessReportStatus
s3Location :: Maybe BusinessReportS3Location
failureCode :: Maybe BusinessReportFailureCode
downloadUrl :: Maybe Text
deliveryTime :: Maybe POSIX
$sel:status:BusinessReport' :: BusinessReport -> Maybe BusinessReportStatus
$sel:s3Location:BusinessReport' :: BusinessReport -> Maybe BusinessReportS3Location
$sel:failureCode:BusinessReport' :: BusinessReport -> Maybe BusinessReportFailureCode
$sel:downloadUrl:BusinessReport' :: BusinessReport -> Maybe Text
$sel:deliveryTime:BusinessReport' :: BusinessReport -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
deliveryTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
downloadUrl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReportFailureCode
failureCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReportS3Location
s3Location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReportStatus
status