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

import Amazonka.AlexaBusiness.Types.BusinessReport
import Amazonka.AlexaBusiness.Types.BusinessReportContentRange
import Amazonka.AlexaBusiness.Types.BusinessReportFormat
import Amazonka.AlexaBusiness.Types.BusinessReportRecurrence
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

-- | The schedule of the usage report.
--
-- /See:/ 'newBusinessReportSchedule' smart constructor.
data BusinessReportSchedule = BusinessReportSchedule'
  { -- | The content range of the reports.
    BusinessReportSchedule -> Maybe BusinessReportContentRange
contentRange :: Prelude.Maybe BusinessReportContentRange,
    -- | The format of the generated report (individual CSV files or zipped files
    -- of individual files).
    BusinessReportSchedule -> Maybe BusinessReportFormat
format :: Prelude.Maybe BusinessReportFormat,
    -- | The details of the last business report delivery for a specified time
    -- interval.
    BusinessReportSchedule -> Maybe BusinessReport
lastBusinessReport :: Prelude.Maybe BusinessReport,
    -- | The recurrence of the reports.
    BusinessReportSchedule -> Maybe BusinessReportRecurrence
recurrence :: Prelude.Maybe BusinessReportRecurrence,
    -- | The S3 bucket name of the output reports.
    BusinessReportSchedule -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | The S3 key where the report is delivered.
    BusinessReportSchedule -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the business report schedule.
    BusinessReportSchedule -> Maybe Text
scheduleArn :: Prelude.Maybe Prelude.Text,
    -- | The name identifier of the schedule.
    BusinessReportSchedule -> Maybe Text
scheduleName :: Prelude.Maybe Prelude.Text
  }
  deriving (BusinessReportSchedule -> BusinessReportSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BusinessReportSchedule -> BusinessReportSchedule -> Bool
$c/= :: BusinessReportSchedule -> BusinessReportSchedule -> Bool
== :: BusinessReportSchedule -> BusinessReportSchedule -> Bool
$c== :: BusinessReportSchedule -> BusinessReportSchedule -> Bool
Prelude.Eq, ReadPrec [BusinessReportSchedule]
ReadPrec BusinessReportSchedule
Int -> ReadS BusinessReportSchedule
ReadS [BusinessReportSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BusinessReportSchedule]
$creadListPrec :: ReadPrec [BusinessReportSchedule]
readPrec :: ReadPrec BusinessReportSchedule
$creadPrec :: ReadPrec BusinessReportSchedule
readList :: ReadS [BusinessReportSchedule]
$creadList :: ReadS [BusinessReportSchedule]
readsPrec :: Int -> ReadS BusinessReportSchedule
$creadsPrec :: Int -> ReadS BusinessReportSchedule
Prelude.Read, Int -> BusinessReportSchedule -> ShowS
[BusinessReportSchedule] -> ShowS
BusinessReportSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BusinessReportSchedule] -> ShowS
$cshowList :: [BusinessReportSchedule] -> ShowS
show :: BusinessReportSchedule -> String
$cshow :: BusinessReportSchedule -> String
showsPrec :: Int -> BusinessReportSchedule -> ShowS
$cshowsPrec :: Int -> BusinessReportSchedule -> ShowS
Prelude.Show, forall x. Rep BusinessReportSchedule x -> BusinessReportSchedule
forall x. BusinessReportSchedule -> Rep BusinessReportSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BusinessReportSchedule x -> BusinessReportSchedule
$cfrom :: forall x. BusinessReportSchedule -> Rep BusinessReportSchedule x
Prelude.Generic)

-- |
-- Create a value of 'BusinessReportSchedule' 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:
--
-- 'contentRange', 'businessReportSchedule_contentRange' - The content range of the reports.
--
-- 'format', 'businessReportSchedule_format' - The format of the generated report (individual CSV files or zipped files
-- of individual files).
--
-- 'lastBusinessReport', 'businessReportSchedule_lastBusinessReport' - The details of the last business report delivery for a specified time
-- interval.
--
-- 'recurrence', 'businessReportSchedule_recurrence' - The recurrence of the reports.
--
-- 's3BucketName', 'businessReportSchedule_s3BucketName' - The S3 bucket name of the output reports.
--
-- 's3KeyPrefix', 'businessReportSchedule_s3KeyPrefix' - The S3 key where the report is delivered.
--
-- 'scheduleArn', 'businessReportSchedule_scheduleArn' - The ARN of the business report schedule.
--
-- 'scheduleName', 'businessReportSchedule_scheduleName' - The name identifier of the schedule.
newBusinessReportSchedule ::
  BusinessReportSchedule
newBusinessReportSchedule :: BusinessReportSchedule
newBusinessReportSchedule =
  BusinessReportSchedule'
    { $sel:contentRange:BusinessReportSchedule' :: Maybe BusinessReportContentRange
contentRange =
        forall a. Maybe a
Prelude.Nothing,
      $sel:format:BusinessReportSchedule' :: Maybe BusinessReportFormat
format = forall a. Maybe a
Prelude.Nothing,
      $sel:lastBusinessReport:BusinessReportSchedule' :: Maybe BusinessReport
lastBusinessReport = forall a. Maybe a
Prelude.Nothing,
      $sel:recurrence:BusinessReportSchedule' :: Maybe BusinessReportRecurrence
recurrence = forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:BusinessReportSchedule' :: Maybe Text
s3BucketName = forall a. Maybe a
Prelude.Nothing,
      $sel:s3KeyPrefix:BusinessReportSchedule' :: Maybe Text
s3KeyPrefix = forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleArn:BusinessReportSchedule' :: Maybe Text
scheduleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleName:BusinessReportSchedule' :: Maybe Text
scheduleName = forall a. Maybe a
Prelude.Nothing
    }

-- | The content range of the reports.
businessReportSchedule_contentRange :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe BusinessReportContentRange)
businessReportSchedule_contentRange :: Lens' BusinessReportSchedule (Maybe BusinessReportContentRange)
businessReportSchedule_contentRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe BusinessReportContentRange
contentRange :: Maybe BusinessReportContentRange
$sel:contentRange:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportContentRange
contentRange} -> Maybe BusinessReportContentRange
contentRange) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe BusinessReportContentRange
a -> BusinessReportSchedule
s {$sel:contentRange:BusinessReportSchedule' :: Maybe BusinessReportContentRange
contentRange = Maybe BusinessReportContentRange
a} :: BusinessReportSchedule)

-- | The format of the generated report (individual CSV files or zipped files
-- of individual files).
businessReportSchedule_format :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe BusinessReportFormat)
businessReportSchedule_format :: Lens' BusinessReportSchedule (Maybe BusinessReportFormat)
businessReportSchedule_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe BusinessReportFormat
format :: Maybe BusinessReportFormat
$sel:format:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportFormat
format} -> Maybe BusinessReportFormat
format) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe BusinessReportFormat
a -> BusinessReportSchedule
s {$sel:format:BusinessReportSchedule' :: Maybe BusinessReportFormat
format = Maybe BusinessReportFormat
a} :: BusinessReportSchedule)

-- | The details of the last business report delivery for a specified time
-- interval.
businessReportSchedule_lastBusinessReport :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe BusinessReport)
businessReportSchedule_lastBusinessReport :: Lens' BusinessReportSchedule (Maybe BusinessReport)
businessReportSchedule_lastBusinessReport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe BusinessReport
lastBusinessReport :: Maybe BusinessReport
$sel:lastBusinessReport:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReport
lastBusinessReport} -> Maybe BusinessReport
lastBusinessReport) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe BusinessReport
a -> BusinessReportSchedule
s {$sel:lastBusinessReport:BusinessReportSchedule' :: Maybe BusinessReport
lastBusinessReport = Maybe BusinessReport
a} :: BusinessReportSchedule)

-- | The recurrence of the reports.
businessReportSchedule_recurrence :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe BusinessReportRecurrence)
businessReportSchedule_recurrence :: Lens' BusinessReportSchedule (Maybe BusinessReportRecurrence)
businessReportSchedule_recurrence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe BusinessReportRecurrence
recurrence :: Maybe BusinessReportRecurrence
$sel:recurrence:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportRecurrence
recurrence} -> Maybe BusinessReportRecurrence
recurrence) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe BusinessReportRecurrence
a -> BusinessReportSchedule
s {$sel:recurrence:BusinessReportSchedule' :: Maybe BusinessReportRecurrence
recurrence = Maybe BusinessReportRecurrence
a} :: BusinessReportSchedule)

-- | The S3 bucket name of the output reports.
businessReportSchedule_s3BucketName :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe Prelude.Text)
businessReportSchedule_s3BucketName :: Lens' BusinessReportSchedule (Maybe Text)
businessReportSchedule_s3BucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe Text
a -> BusinessReportSchedule
s {$sel:s3BucketName:BusinessReportSchedule' :: Maybe Text
s3BucketName = Maybe Text
a} :: BusinessReportSchedule)

-- | The S3 key where the report is delivered.
businessReportSchedule_s3KeyPrefix :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe Prelude.Text)
businessReportSchedule_s3KeyPrefix :: Lens' BusinessReportSchedule (Maybe Text)
businessReportSchedule_s3KeyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe Text
a -> BusinessReportSchedule
s {$sel:s3KeyPrefix:BusinessReportSchedule' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: BusinessReportSchedule)

-- | The ARN of the business report schedule.
businessReportSchedule_scheduleArn :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe Prelude.Text)
businessReportSchedule_scheduleArn :: Lens' BusinessReportSchedule (Maybe Text)
businessReportSchedule_scheduleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe Text
scheduleArn :: Maybe Text
$sel:scheduleArn:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
scheduleArn} -> Maybe Text
scheduleArn) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe Text
a -> BusinessReportSchedule
s {$sel:scheduleArn:BusinessReportSchedule' :: Maybe Text
scheduleArn = Maybe Text
a} :: BusinessReportSchedule)

-- | The name identifier of the schedule.
businessReportSchedule_scheduleName :: Lens.Lens' BusinessReportSchedule (Prelude.Maybe Prelude.Text)
businessReportSchedule_scheduleName :: Lens' BusinessReportSchedule (Maybe Text)
businessReportSchedule_scheduleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportSchedule' {Maybe Text
scheduleName :: Maybe Text
$sel:scheduleName:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
scheduleName} -> Maybe Text
scheduleName) (\s :: BusinessReportSchedule
s@BusinessReportSchedule' {} Maybe Text
a -> BusinessReportSchedule
s {$sel:scheduleName:BusinessReportSchedule' :: Maybe Text
scheduleName = Maybe Text
a} :: BusinessReportSchedule)

instance Data.FromJSON BusinessReportSchedule where
  parseJSON :: Value -> Parser BusinessReportSchedule
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BusinessReportSchedule"
      ( \Object
x ->
          Maybe BusinessReportContentRange
-> Maybe BusinessReportFormat
-> Maybe BusinessReport
-> Maybe BusinessReportRecurrence
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> BusinessReportSchedule
BusinessReportSchedule'
            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
"ContentRange")
            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
"Format")
            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
"LastBusinessReport")
            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
"Recurrence")
            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
"S3BucketName")
            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
"S3KeyPrefix")
            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
"ScheduleArn")
            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
"ScheduleName")
      )

instance Prelude.Hashable BusinessReportSchedule where
  hashWithSalt :: Int -> BusinessReportSchedule -> Int
hashWithSalt Int
_salt BusinessReportSchedule' {Maybe Text
Maybe BusinessReportFormat
Maybe BusinessReportContentRange
Maybe BusinessReportRecurrence
Maybe BusinessReport
scheduleName :: Maybe Text
scheduleArn :: Maybe Text
s3KeyPrefix :: Maybe Text
s3BucketName :: Maybe Text
recurrence :: Maybe BusinessReportRecurrence
lastBusinessReport :: Maybe BusinessReport
format :: Maybe BusinessReportFormat
contentRange :: Maybe BusinessReportContentRange
$sel:scheduleName:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:scheduleArn:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:s3KeyPrefix:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:s3BucketName:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:recurrence:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportRecurrence
$sel:lastBusinessReport:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReport
$sel:format:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportFormat
$sel:contentRange:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportContentRange
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReportContentRange
contentRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReportFormat
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReport
lastBusinessReport
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BusinessReportRecurrence
recurrence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3BucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3KeyPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduleName

instance Prelude.NFData BusinessReportSchedule where
  rnf :: BusinessReportSchedule -> ()
rnf BusinessReportSchedule' {Maybe Text
Maybe BusinessReportFormat
Maybe BusinessReportContentRange
Maybe BusinessReportRecurrence
Maybe BusinessReport
scheduleName :: Maybe Text
scheduleArn :: Maybe Text
s3KeyPrefix :: Maybe Text
s3BucketName :: Maybe Text
recurrence :: Maybe BusinessReportRecurrence
lastBusinessReport :: Maybe BusinessReport
format :: Maybe BusinessReportFormat
contentRange :: Maybe BusinessReportContentRange
$sel:scheduleName:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:scheduleArn:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:s3KeyPrefix:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:s3BucketName:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe Text
$sel:recurrence:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportRecurrence
$sel:lastBusinessReport:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReport
$sel:format:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportFormat
$sel:contentRange:BusinessReportSchedule' :: BusinessReportSchedule -> Maybe BusinessReportContentRange
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReportContentRange
contentRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReportFormat
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReport
lastBusinessReport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BusinessReportRecurrence
recurrence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3BucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3KeyPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduleName