{-# 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 #-}
module Amazonka.Connect.Types.HoursOfOperationConfig where
import Amazonka.Connect.Types.HoursOfOperationDays
import Amazonka.Connect.Types.HoursOfOperationTimeSlice
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data HoursOfOperationConfig = HoursOfOperationConfig'
{
HoursOfOperationConfig -> HoursOfOperationDays
day :: HoursOfOperationDays,
HoursOfOperationConfig -> HoursOfOperationTimeSlice
startTime :: HoursOfOperationTimeSlice,
HoursOfOperationConfig -> HoursOfOperationTimeSlice
endTime :: HoursOfOperationTimeSlice
}
deriving (HoursOfOperationConfig -> HoursOfOperationConfig -> Bool
(HoursOfOperationConfig -> HoursOfOperationConfig -> Bool)
-> (HoursOfOperationConfig -> HoursOfOperationConfig -> Bool)
-> Eq HoursOfOperationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HoursOfOperationConfig -> HoursOfOperationConfig -> Bool
$c/= :: HoursOfOperationConfig -> HoursOfOperationConfig -> Bool
== :: HoursOfOperationConfig -> HoursOfOperationConfig -> Bool
$c== :: HoursOfOperationConfig -> HoursOfOperationConfig -> Bool
Prelude.Eq, ReadPrec [HoursOfOperationConfig]
ReadPrec HoursOfOperationConfig
Int -> ReadS HoursOfOperationConfig
ReadS [HoursOfOperationConfig]
(Int -> ReadS HoursOfOperationConfig)
-> ReadS [HoursOfOperationConfig]
-> ReadPrec HoursOfOperationConfig
-> ReadPrec [HoursOfOperationConfig]
-> Read HoursOfOperationConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HoursOfOperationConfig]
$creadListPrec :: ReadPrec [HoursOfOperationConfig]
readPrec :: ReadPrec HoursOfOperationConfig
$creadPrec :: ReadPrec HoursOfOperationConfig
readList :: ReadS [HoursOfOperationConfig]
$creadList :: ReadS [HoursOfOperationConfig]
readsPrec :: Int -> ReadS HoursOfOperationConfig
$creadsPrec :: Int -> ReadS HoursOfOperationConfig
Prelude.Read, Int -> HoursOfOperationConfig -> ShowS
[HoursOfOperationConfig] -> ShowS
HoursOfOperationConfig -> String
(Int -> HoursOfOperationConfig -> ShowS)
-> (HoursOfOperationConfig -> String)
-> ([HoursOfOperationConfig] -> ShowS)
-> Show HoursOfOperationConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HoursOfOperationConfig] -> ShowS
$cshowList :: [HoursOfOperationConfig] -> ShowS
show :: HoursOfOperationConfig -> String
$cshow :: HoursOfOperationConfig -> String
showsPrec :: Int -> HoursOfOperationConfig -> ShowS
$cshowsPrec :: Int -> HoursOfOperationConfig -> ShowS
Prelude.Show, (forall x. HoursOfOperationConfig -> Rep HoursOfOperationConfig x)
-> (forall x.
Rep HoursOfOperationConfig x -> HoursOfOperationConfig)
-> Generic HoursOfOperationConfig
forall x. Rep HoursOfOperationConfig x -> HoursOfOperationConfig
forall x. HoursOfOperationConfig -> Rep HoursOfOperationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HoursOfOperationConfig x -> HoursOfOperationConfig
$cfrom :: forall x. HoursOfOperationConfig -> Rep HoursOfOperationConfig x
Prelude.Generic)
newHoursOfOperationConfig ::
HoursOfOperationDays ->
HoursOfOperationTimeSlice ->
HoursOfOperationTimeSlice ->
HoursOfOperationConfig
newHoursOfOperationConfig :: HoursOfOperationDays
-> HoursOfOperationTimeSlice
-> HoursOfOperationTimeSlice
-> HoursOfOperationConfig
newHoursOfOperationConfig HoursOfOperationDays
pDay_ HoursOfOperationTimeSlice
pStartTime_ HoursOfOperationTimeSlice
pEndTime_ =
HoursOfOperationConfig' :: HoursOfOperationDays
-> HoursOfOperationTimeSlice
-> HoursOfOperationTimeSlice
-> HoursOfOperationConfig
HoursOfOperationConfig'
{ $sel:day:HoursOfOperationConfig' :: HoursOfOperationDays
day = HoursOfOperationDays
pDay_,
$sel:startTime:HoursOfOperationConfig' :: HoursOfOperationTimeSlice
startTime = HoursOfOperationTimeSlice
pStartTime_,
$sel:endTime:HoursOfOperationConfig' :: HoursOfOperationTimeSlice
endTime = HoursOfOperationTimeSlice
pEndTime_
}
hoursOfOperationConfig_day :: Lens.Lens' HoursOfOperationConfig HoursOfOperationDays
hoursOfOperationConfig_day :: (HoursOfOperationDays -> f HoursOfOperationDays)
-> HoursOfOperationConfig -> f HoursOfOperationConfig
hoursOfOperationConfig_day = (HoursOfOperationConfig -> HoursOfOperationDays)
-> (HoursOfOperationConfig
-> HoursOfOperationDays -> HoursOfOperationConfig)
-> Lens
HoursOfOperationConfig
HoursOfOperationConfig
HoursOfOperationDays
HoursOfOperationDays
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperationConfig' {HoursOfOperationDays
day :: HoursOfOperationDays
$sel:day:HoursOfOperationConfig' :: HoursOfOperationConfig -> HoursOfOperationDays
day} -> HoursOfOperationDays
day) (\s :: HoursOfOperationConfig
s@HoursOfOperationConfig' {} HoursOfOperationDays
a -> HoursOfOperationConfig
s {$sel:day:HoursOfOperationConfig' :: HoursOfOperationDays
day = HoursOfOperationDays
a} :: HoursOfOperationConfig)
hoursOfOperationConfig_startTime :: Lens.Lens' HoursOfOperationConfig HoursOfOperationTimeSlice
hoursOfOperationConfig_startTime :: (HoursOfOperationTimeSlice -> f HoursOfOperationTimeSlice)
-> HoursOfOperationConfig -> f HoursOfOperationConfig
hoursOfOperationConfig_startTime = (HoursOfOperationConfig -> HoursOfOperationTimeSlice)
-> (HoursOfOperationConfig
-> HoursOfOperationTimeSlice -> HoursOfOperationConfig)
-> Lens
HoursOfOperationConfig
HoursOfOperationConfig
HoursOfOperationTimeSlice
HoursOfOperationTimeSlice
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperationConfig' {HoursOfOperationTimeSlice
startTime :: HoursOfOperationTimeSlice
$sel:startTime:HoursOfOperationConfig' :: HoursOfOperationConfig -> HoursOfOperationTimeSlice
startTime} -> HoursOfOperationTimeSlice
startTime) (\s :: HoursOfOperationConfig
s@HoursOfOperationConfig' {} HoursOfOperationTimeSlice
a -> HoursOfOperationConfig
s {$sel:startTime:HoursOfOperationConfig' :: HoursOfOperationTimeSlice
startTime = HoursOfOperationTimeSlice
a} :: HoursOfOperationConfig)
hoursOfOperationConfig_endTime :: Lens.Lens' HoursOfOperationConfig HoursOfOperationTimeSlice
hoursOfOperationConfig_endTime :: (HoursOfOperationTimeSlice -> f HoursOfOperationTimeSlice)
-> HoursOfOperationConfig -> f HoursOfOperationConfig
hoursOfOperationConfig_endTime = (HoursOfOperationConfig -> HoursOfOperationTimeSlice)
-> (HoursOfOperationConfig
-> HoursOfOperationTimeSlice -> HoursOfOperationConfig)
-> Lens
HoursOfOperationConfig
HoursOfOperationConfig
HoursOfOperationTimeSlice
HoursOfOperationTimeSlice
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperationConfig' {HoursOfOperationTimeSlice
endTime :: HoursOfOperationTimeSlice
$sel:endTime:HoursOfOperationConfig' :: HoursOfOperationConfig -> HoursOfOperationTimeSlice
endTime} -> HoursOfOperationTimeSlice
endTime) (\s :: HoursOfOperationConfig
s@HoursOfOperationConfig' {} HoursOfOperationTimeSlice
a -> HoursOfOperationConfig
s {$sel:endTime:HoursOfOperationConfig' :: HoursOfOperationTimeSlice
endTime = HoursOfOperationTimeSlice
a} :: HoursOfOperationConfig)
instance Core.FromJSON HoursOfOperationConfig where
parseJSON :: Value -> Parser HoursOfOperationConfig
parseJSON =
String
-> (Object -> Parser HoursOfOperationConfig)
-> Value
-> Parser HoursOfOperationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HoursOfOperationConfig"
( \Object
x ->
HoursOfOperationDays
-> HoursOfOperationTimeSlice
-> HoursOfOperationTimeSlice
-> HoursOfOperationConfig
HoursOfOperationConfig'
(HoursOfOperationDays
-> HoursOfOperationTimeSlice
-> HoursOfOperationTimeSlice
-> HoursOfOperationConfig)
-> Parser HoursOfOperationDays
-> Parser
(HoursOfOperationTimeSlice
-> HoursOfOperationTimeSlice -> HoursOfOperationConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser HoursOfOperationDays
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Day")
Parser
(HoursOfOperationTimeSlice
-> HoursOfOperationTimeSlice -> HoursOfOperationConfig)
-> Parser HoursOfOperationTimeSlice
-> Parser (HoursOfOperationTimeSlice -> HoursOfOperationConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HoursOfOperationTimeSlice
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StartTime")
Parser (HoursOfOperationTimeSlice -> HoursOfOperationConfig)
-> Parser HoursOfOperationTimeSlice
-> Parser HoursOfOperationConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HoursOfOperationTimeSlice
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndTime")
)
instance Prelude.Hashable HoursOfOperationConfig
instance Prelude.NFData HoursOfOperationConfig
instance Core.ToJSON HoursOfOperationConfig where
toJSON :: HoursOfOperationConfig -> Value
toJSON HoursOfOperationConfig' {HoursOfOperationDays
HoursOfOperationTimeSlice
endTime :: HoursOfOperationTimeSlice
startTime :: HoursOfOperationTimeSlice
day :: HoursOfOperationDays
$sel:endTime:HoursOfOperationConfig' :: HoursOfOperationConfig -> HoursOfOperationTimeSlice
$sel:startTime:HoursOfOperationConfig' :: HoursOfOperationConfig -> HoursOfOperationTimeSlice
$sel:day:HoursOfOperationConfig' :: HoursOfOperationConfig -> HoursOfOperationDays
..} =
[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
"Day" Text -> HoursOfOperationDays -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HoursOfOperationDays
day),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StartTime" Text -> HoursOfOperationTimeSlice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HoursOfOperationTimeSlice
startTime),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndTime" Text -> HoursOfOperationTimeSlice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HoursOfOperationTimeSlice
endTime)
]
)