{-# 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.BusinessReportRecurrence
-- 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.BusinessReportRecurrence 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

-- | The recurrence of the reports.
--
-- /See:/ 'newBusinessReportRecurrence' smart constructor.
data BusinessReportRecurrence = BusinessReportRecurrence'
  { -- | The start date.
    BusinessReportRecurrence -> Maybe Text
startDate :: Prelude.Maybe Prelude.Text
  }
  deriving (BusinessReportRecurrence -> BusinessReportRecurrence -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BusinessReportRecurrence -> BusinessReportRecurrence -> Bool
$c/= :: BusinessReportRecurrence -> BusinessReportRecurrence -> Bool
== :: BusinessReportRecurrence -> BusinessReportRecurrence -> Bool
$c== :: BusinessReportRecurrence -> BusinessReportRecurrence -> Bool
Prelude.Eq, ReadPrec [BusinessReportRecurrence]
ReadPrec BusinessReportRecurrence
Int -> ReadS BusinessReportRecurrence
ReadS [BusinessReportRecurrence]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BusinessReportRecurrence]
$creadListPrec :: ReadPrec [BusinessReportRecurrence]
readPrec :: ReadPrec BusinessReportRecurrence
$creadPrec :: ReadPrec BusinessReportRecurrence
readList :: ReadS [BusinessReportRecurrence]
$creadList :: ReadS [BusinessReportRecurrence]
readsPrec :: Int -> ReadS BusinessReportRecurrence
$creadsPrec :: Int -> ReadS BusinessReportRecurrence
Prelude.Read, Int -> BusinessReportRecurrence -> ShowS
[BusinessReportRecurrence] -> ShowS
BusinessReportRecurrence -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BusinessReportRecurrence] -> ShowS
$cshowList :: [BusinessReportRecurrence] -> ShowS
show :: BusinessReportRecurrence -> String
$cshow :: BusinessReportRecurrence -> String
showsPrec :: Int -> BusinessReportRecurrence -> ShowS
$cshowsPrec :: Int -> BusinessReportRecurrence -> ShowS
Prelude.Show, forall x.
Rep BusinessReportRecurrence x -> BusinessReportRecurrence
forall x.
BusinessReportRecurrence -> Rep BusinessReportRecurrence x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BusinessReportRecurrence x -> BusinessReportRecurrence
$cfrom :: forall x.
BusinessReportRecurrence -> Rep BusinessReportRecurrence x
Prelude.Generic)

-- |
-- Create a value of 'BusinessReportRecurrence' 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:
--
-- 'startDate', 'businessReportRecurrence_startDate' - The start date.
newBusinessReportRecurrence ::
  BusinessReportRecurrence
newBusinessReportRecurrence :: BusinessReportRecurrence
newBusinessReportRecurrence =
  BusinessReportRecurrence'
    { $sel:startDate:BusinessReportRecurrence' :: Maybe Text
startDate =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The start date.
businessReportRecurrence_startDate :: Lens.Lens' BusinessReportRecurrence (Prelude.Maybe Prelude.Text)
businessReportRecurrence_startDate :: Lens' BusinessReportRecurrence (Maybe Text)
businessReportRecurrence_startDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportRecurrence' {Maybe Text
startDate :: Maybe Text
$sel:startDate:BusinessReportRecurrence' :: BusinessReportRecurrence -> Maybe Text
startDate} -> Maybe Text
startDate) (\s :: BusinessReportRecurrence
s@BusinessReportRecurrence' {} Maybe Text
a -> BusinessReportRecurrence
s {$sel:startDate:BusinessReportRecurrence' :: Maybe Text
startDate = Maybe Text
a} :: BusinessReportRecurrence)

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

instance Prelude.Hashable BusinessReportRecurrence where
  hashWithSalt :: Int -> BusinessReportRecurrence -> Int
hashWithSalt Int
_salt BusinessReportRecurrence' {Maybe Text
startDate :: Maybe Text
$sel:startDate:BusinessReportRecurrence' :: BusinessReportRecurrence -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
startDate

instance Prelude.NFData BusinessReportRecurrence where
  rnf :: BusinessReportRecurrence -> ()
rnf BusinessReportRecurrence' {Maybe Text
startDate :: Maybe Text
$sel:startDate:BusinessReportRecurrence' :: BusinessReportRecurrence -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
startDate

instance Data.ToJSON BusinessReportRecurrence where
  toJSON :: BusinessReportRecurrence -> Value
toJSON BusinessReportRecurrence' {Maybe Text
startDate :: Maybe Text
$sel:startDate:BusinessReportRecurrence' :: BusinessReportRecurrence -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"StartDate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
startDate]
      )