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

import Amazonka.AlexaBusiness.Types.BusinessReportInterval
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The content range of the report.
--
-- /See:/ 'newBusinessReportContentRange' smart constructor.
data BusinessReportContentRange = BusinessReportContentRange'
  { -- | The interval of the content range.
    BusinessReportContentRange -> BusinessReportInterval
interval :: BusinessReportInterval
  }
  deriving (BusinessReportContentRange -> BusinessReportContentRange -> Bool
(BusinessReportContentRange -> BusinessReportContentRange -> Bool)
-> (BusinessReportContentRange
    -> BusinessReportContentRange -> Bool)
-> Eq BusinessReportContentRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BusinessReportContentRange -> BusinessReportContentRange -> Bool
$c/= :: BusinessReportContentRange -> BusinessReportContentRange -> Bool
== :: BusinessReportContentRange -> BusinessReportContentRange -> Bool
$c== :: BusinessReportContentRange -> BusinessReportContentRange -> Bool
Prelude.Eq, ReadPrec [BusinessReportContentRange]
ReadPrec BusinessReportContentRange
Int -> ReadS BusinessReportContentRange
ReadS [BusinessReportContentRange]
(Int -> ReadS BusinessReportContentRange)
-> ReadS [BusinessReportContentRange]
-> ReadPrec BusinessReportContentRange
-> ReadPrec [BusinessReportContentRange]
-> Read BusinessReportContentRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BusinessReportContentRange]
$creadListPrec :: ReadPrec [BusinessReportContentRange]
readPrec :: ReadPrec BusinessReportContentRange
$creadPrec :: ReadPrec BusinessReportContentRange
readList :: ReadS [BusinessReportContentRange]
$creadList :: ReadS [BusinessReportContentRange]
readsPrec :: Int -> ReadS BusinessReportContentRange
$creadsPrec :: Int -> ReadS BusinessReportContentRange
Prelude.Read, Int -> BusinessReportContentRange -> ShowS
[BusinessReportContentRange] -> ShowS
BusinessReportContentRange -> String
(Int -> BusinessReportContentRange -> ShowS)
-> (BusinessReportContentRange -> String)
-> ([BusinessReportContentRange] -> ShowS)
-> Show BusinessReportContentRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BusinessReportContentRange] -> ShowS
$cshowList :: [BusinessReportContentRange] -> ShowS
show :: BusinessReportContentRange -> String
$cshow :: BusinessReportContentRange -> String
showsPrec :: Int -> BusinessReportContentRange -> ShowS
$cshowsPrec :: Int -> BusinessReportContentRange -> ShowS
Prelude.Show, (forall x.
 BusinessReportContentRange -> Rep BusinessReportContentRange x)
-> (forall x.
    Rep BusinessReportContentRange x -> BusinessReportContentRange)
-> Generic BusinessReportContentRange
forall x.
Rep BusinessReportContentRange x -> BusinessReportContentRange
forall x.
BusinessReportContentRange -> Rep BusinessReportContentRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BusinessReportContentRange x -> BusinessReportContentRange
$cfrom :: forall x.
BusinessReportContentRange -> Rep BusinessReportContentRange x
Prelude.Generic)

-- |
-- Create a value of 'BusinessReportContentRange' 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:
--
-- 'interval', 'businessReportContentRange_interval' - The interval of the content range.
newBusinessReportContentRange ::
  -- | 'interval'
  BusinessReportInterval ->
  BusinessReportContentRange
newBusinessReportContentRange :: BusinessReportInterval -> BusinessReportContentRange
newBusinessReportContentRange BusinessReportInterval
pInterval_ =
  BusinessReportContentRange' :: BusinessReportInterval -> BusinessReportContentRange
BusinessReportContentRange' {$sel:interval:BusinessReportContentRange' :: BusinessReportInterval
interval = BusinessReportInterval
pInterval_}

-- | The interval of the content range.
businessReportContentRange_interval :: Lens.Lens' BusinessReportContentRange BusinessReportInterval
businessReportContentRange_interval :: (BusinessReportInterval -> f BusinessReportInterval)
-> BusinessReportContentRange -> f BusinessReportContentRange
businessReportContentRange_interval = (BusinessReportContentRange -> BusinessReportInterval)
-> (BusinessReportContentRange
    -> BusinessReportInterval -> BusinessReportContentRange)
-> Lens
     BusinessReportContentRange
     BusinessReportContentRange
     BusinessReportInterval
     BusinessReportInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BusinessReportContentRange' {BusinessReportInterval
interval :: BusinessReportInterval
$sel:interval:BusinessReportContentRange' :: BusinessReportContentRange -> BusinessReportInterval
interval} -> BusinessReportInterval
interval) (\s :: BusinessReportContentRange
s@BusinessReportContentRange' {} BusinessReportInterval
a -> BusinessReportContentRange
s {$sel:interval:BusinessReportContentRange' :: BusinessReportInterval
interval = BusinessReportInterval
a} :: BusinessReportContentRange)

instance Core.FromJSON BusinessReportContentRange where
  parseJSON :: Value -> Parser BusinessReportContentRange
parseJSON =
    String
-> (Object -> Parser BusinessReportContentRange)
-> Value
-> Parser BusinessReportContentRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BusinessReportContentRange"
      ( \Object
x ->
          BusinessReportInterval -> BusinessReportContentRange
BusinessReportContentRange'
            (BusinessReportInterval -> BusinessReportContentRange)
-> Parser BusinessReportInterval
-> Parser BusinessReportContentRange
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser BusinessReportInterval
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Interval")
      )

instance Prelude.Hashable BusinessReportContentRange

instance Prelude.NFData BusinessReportContentRange

instance Core.ToJSON BusinessReportContentRange where
  toJSON :: BusinessReportContentRange -> Value
toJSON BusinessReportContentRange' {BusinessReportInterval
interval :: BusinessReportInterval
$sel:interval:BusinessReportContentRange' :: BusinessReportContentRange -> BusinessReportInterval
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Interval" Text -> BusinessReportInterval -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BusinessReportInterval
interval)]
      )