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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(BusinessReportRecurrence -> BusinessReportRecurrence -> Bool)
-> (BusinessReportRecurrence -> BusinessReportRecurrence -> Bool)
-> Eq BusinessReportRecurrence
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]
(Int -> ReadS BusinessReportRecurrence)
-> ReadS [BusinessReportRecurrence]
-> ReadPrec BusinessReportRecurrence
-> ReadPrec [BusinessReportRecurrence]
-> Read 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
(Int -> BusinessReportRecurrence -> ShowS)
-> (BusinessReportRecurrence -> String)
-> ([BusinessReportRecurrence] -> ShowS)
-> Show BusinessReportRecurrence
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.
 BusinessReportRecurrence -> Rep BusinessReportRecurrence x)
-> (forall x.
    Rep BusinessReportRecurrence x -> BusinessReportRecurrence)
-> Generic BusinessReportRecurrence
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' :: Maybe Text -> BusinessReportRecurrence
BusinessReportRecurrence'
    { $sel:startDate:BusinessReportRecurrence' :: Maybe Text
startDate =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The start date.
businessReportRecurrence_startDate :: Lens.Lens' BusinessReportRecurrence (Prelude.Maybe Prelude.Text)
businessReportRecurrence_startDate :: (Maybe Text -> f (Maybe Text))
-> BusinessReportRecurrence -> f BusinessReportRecurrence
businessReportRecurrence_startDate = (BusinessReportRecurrence -> Maybe Text)
-> (BusinessReportRecurrence
    -> Maybe Text -> BusinessReportRecurrence)
-> Lens
     BusinessReportRecurrence
     BusinessReportRecurrence
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON BusinessReportRecurrence where
  parseJSON :: Value -> Parser BusinessReportRecurrence
parseJSON =
    String
-> (Object -> Parser BusinessReportRecurrence)
-> Value
-> Parser BusinessReportRecurrence
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BusinessReportRecurrence"
      ( \Object
x ->
          Maybe Text -> BusinessReportRecurrence
BusinessReportRecurrence'
            (Maybe Text -> BusinessReportRecurrence)
-> Parser (Maybe Text) -> Parser BusinessReportRecurrence
forall (f :: * -> *) a b. Functor 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
"StartDate")
      )

instance Prelude.Hashable BusinessReportRecurrence

instance Prelude.NFData BusinessReportRecurrence

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