{-# 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.Connect.Types.HoursOfOperation
-- 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.Connect.Types.HoursOfOperation where

import Amazonka.Connect.Types.HoursOfOperationConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about of the hours of operation.
--
-- /See:/ 'newHoursOfOperation' smart constructor.
data HoursOfOperation = HoursOfOperation'
  { -- | Configuration information for the hours of operation.
    HoursOfOperation -> Maybe [HoursOfOperationConfig]
config :: Prelude.Maybe [HoursOfOperationConfig],
    -- | The name for the hours of operation.
    HoursOfOperation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the hours of operation.
    HoursOfOperation -> Maybe Text
hoursOfOperationArn :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the hours of operation.
    HoursOfOperation -> Maybe Text
hoursOfOperationId :: Prelude.Maybe Prelude.Text,
    -- | The time zone for the hours of operation.
    HoursOfOperation -> Maybe Text
timeZone :: Prelude.Maybe Prelude.Text,
    -- | The description for the hours of operation.
    HoursOfOperation -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | One or more tags.
    HoursOfOperation -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (HoursOfOperation -> HoursOfOperation -> Bool
(HoursOfOperation -> HoursOfOperation -> Bool)
-> (HoursOfOperation -> HoursOfOperation -> Bool)
-> Eq HoursOfOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HoursOfOperation -> HoursOfOperation -> Bool
$c/= :: HoursOfOperation -> HoursOfOperation -> Bool
== :: HoursOfOperation -> HoursOfOperation -> Bool
$c== :: HoursOfOperation -> HoursOfOperation -> Bool
Prelude.Eq, ReadPrec [HoursOfOperation]
ReadPrec HoursOfOperation
Int -> ReadS HoursOfOperation
ReadS [HoursOfOperation]
(Int -> ReadS HoursOfOperation)
-> ReadS [HoursOfOperation]
-> ReadPrec HoursOfOperation
-> ReadPrec [HoursOfOperation]
-> Read HoursOfOperation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HoursOfOperation]
$creadListPrec :: ReadPrec [HoursOfOperation]
readPrec :: ReadPrec HoursOfOperation
$creadPrec :: ReadPrec HoursOfOperation
readList :: ReadS [HoursOfOperation]
$creadList :: ReadS [HoursOfOperation]
readsPrec :: Int -> ReadS HoursOfOperation
$creadsPrec :: Int -> ReadS HoursOfOperation
Prelude.Read, Int -> HoursOfOperation -> ShowS
[HoursOfOperation] -> ShowS
HoursOfOperation -> String
(Int -> HoursOfOperation -> ShowS)
-> (HoursOfOperation -> String)
-> ([HoursOfOperation] -> ShowS)
-> Show HoursOfOperation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HoursOfOperation] -> ShowS
$cshowList :: [HoursOfOperation] -> ShowS
show :: HoursOfOperation -> String
$cshow :: HoursOfOperation -> String
showsPrec :: Int -> HoursOfOperation -> ShowS
$cshowsPrec :: Int -> HoursOfOperation -> ShowS
Prelude.Show, (forall x. HoursOfOperation -> Rep HoursOfOperation x)
-> (forall x. Rep HoursOfOperation x -> HoursOfOperation)
-> Generic HoursOfOperation
forall x. Rep HoursOfOperation x -> HoursOfOperation
forall x. HoursOfOperation -> Rep HoursOfOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HoursOfOperation x -> HoursOfOperation
$cfrom :: forall x. HoursOfOperation -> Rep HoursOfOperation x
Prelude.Generic)

-- |
-- Create a value of 'HoursOfOperation' 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:
--
-- 'config', 'hoursOfOperation_config' - Configuration information for the hours of operation.
--
-- 'name', 'hoursOfOperation_name' - The name for the hours of operation.
--
-- 'hoursOfOperationArn', 'hoursOfOperation_hoursOfOperationArn' - The Amazon Resource Name (ARN) for the hours of operation.
--
-- 'hoursOfOperationId', 'hoursOfOperation_hoursOfOperationId' - The identifier for the hours of operation.
--
-- 'timeZone', 'hoursOfOperation_timeZone' - The time zone for the hours of operation.
--
-- 'description', 'hoursOfOperation_description' - The description for the hours of operation.
--
-- 'tags', 'hoursOfOperation_tags' - One or more tags.
newHoursOfOperation ::
  HoursOfOperation
newHoursOfOperation :: HoursOfOperation
newHoursOfOperation =
  HoursOfOperation' :: Maybe [HoursOfOperationConfig]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> HoursOfOperation
HoursOfOperation'
    { $sel:config:HoursOfOperation' :: Maybe [HoursOfOperationConfig]
config = Maybe [HoursOfOperationConfig]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:HoursOfOperation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hoursOfOperationArn:HoursOfOperation' :: Maybe Text
hoursOfOperationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hoursOfOperationId:HoursOfOperation' :: Maybe Text
hoursOfOperationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeZone:HoursOfOperation' :: Maybe Text
timeZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:HoursOfOperation' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:HoursOfOperation' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration information for the hours of operation.
hoursOfOperation_config :: Lens.Lens' HoursOfOperation (Prelude.Maybe [HoursOfOperationConfig])
hoursOfOperation_config :: (Maybe [HoursOfOperationConfig]
 -> f (Maybe [HoursOfOperationConfig]))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_config = (HoursOfOperation -> Maybe [HoursOfOperationConfig])
-> (HoursOfOperation
    -> Maybe [HoursOfOperationConfig] -> HoursOfOperation)
-> Lens
     HoursOfOperation
     HoursOfOperation
     (Maybe [HoursOfOperationConfig])
     (Maybe [HoursOfOperationConfig])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe [HoursOfOperationConfig]
config :: Maybe [HoursOfOperationConfig]
$sel:config:HoursOfOperation' :: HoursOfOperation -> Maybe [HoursOfOperationConfig]
config} -> Maybe [HoursOfOperationConfig]
config) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe [HoursOfOperationConfig]
a -> HoursOfOperation
s {$sel:config:HoursOfOperation' :: Maybe [HoursOfOperationConfig]
config = Maybe [HoursOfOperationConfig]
a} :: HoursOfOperation) ((Maybe [HoursOfOperationConfig]
  -> f (Maybe [HoursOfOperationConfig]))
 -> HoursOfOperation -> f HoursOfOperation)
-> ((Maybe [HoursOfOperationConfig]
     -> f (Maybe [HoursOfOperationConfig]))
    -> Maybe [HoursOfOperationConfig]
    -> f (Maybe [HoursOfOperationConfig]))
-> (Maybe [HoursOfOperationConfig]
    -> f (Maybe [HoursOfOperationConfig]))
-> HoursOfOperation
-> f HoursOfOperation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HoursOfOperationConfig]
  [HoursOfOperationConfig]
  [HoursOfOperationConfig]
  [HoursOfOperationConfig]
-> Iso
     (Maybe [HoursOfOperationConfig])
     (Maybe [HoursOfOperationConfig])
     (Maybe [HoursOfOperationConfig])
     (Maybe [HoursOfOperationConfig])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [HoursOfOperationConfig]
  [HoursOfOperationConfig]
  [HoursOfOperationConfig]
  [HoursOfOperationConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name for the hours of operation.
hoursOfOperation_name :: Lens.Lens' HoursOfOperation (Prelude.Maybe Prelude.Text)
hoursOfOperation_name :: (Maybe Text -> f (Maybe Text))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_name = (HoursOfOperation -> Maybe Text)
-> (HoursOfOperation -> Maybe Text -> HoursOfOperation)
-> Lens HoursOfOperation HoursOfOperation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe Text
name :: Maybe Text
$sel:name:HoursOfOperation' :: HoursOfOperation -> Maybe Text
name} -> Maybe Text
name) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe Text
a -> HoursOfOperation
s {$sel:name:HoursOfOperation' :: Maybe Text
name = Maybe Text
a} :: HoursOfOperation)

-- | The Amazon Resource Name (ARN) for the hours of operation.
hoursOfOperation_hoursOfOperationArn :: Lens.Lens' HoursOfOperation (Prelude.Maybe Prelude.Text)
hoursOfOperation_hoursOfOperationArn :: (Maybe Text -> f (Maybe Text))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_hoursOfOperationArn = (HoursOfOperation -> Maybe Text)
-> (HoursOfOperation -> Maybe Text -> HoursOfOperation)
-> Lens HoursOfOperation HoursOfOperation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe Text
hoursOfOperationArn :: Maybe Text
$sel:hoursOfOperationArn:HoursOfOperation' :: HoursOfOperation -> Maybe Text
hoursOfOperationArn} -> Maybe Text
hoursOfOperationArn) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe Text
a -> HoursOfOperation
s {$sel:hoursOfOperationArn:HoursOfOperation' :: Maybe Text
hoursOfOperationArn = Maybe Text
a} :: HoursOfOperation)

-- | The identifier for the hours of operation.
hoursOfOperation_hoursOfOperationId :: Lens.Lens' HoursOfOperation (Prelude.Maybe Prelude.Text)
hoursOfOperation_hoursOfOperationId :: (Maybe Text -> f (Maybe Text))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_hoursOfOperationId = (HoursOfOperation -> Maybe Text)
-> (HoursOfOperation -> Maybe Text -> HoursOfOperation)
-> Lens HoursOfOperation HoursOfOperation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe Text
hoursOfOperationId :: Maybe Text
$sel:hoursOfOperationId:HoursOfOperation' :: HoursOfOperation -> Maybe Text
hoursOfOperationId} -> Maybe Text
hoursOfOperationId) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe Text
a -> HoursOfOperation
s {$sel:hoursOfOperationId:HoursOfOperation' :: Maybe Text
hoursOfOperationId = Maybe Text
a} :: HoursOfOperation)

-- | The time zone for the hours of operation.
hoursOfOperation_timeZone :: Lens.Lens' HoursOfOperation (Prelude.Maybe Prelude.Text)
hoursOfOperation_timeZone :: (Maybe Text -> f (Maybe Text))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_timeZone = (HoursOfOperation -> Maybe Text)
-> (HoursOfOperation -> Maybe Text -> HoursOfOperation)
-> Lens HoursOfOperation HoursOfOperation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe Text
timeZone :: Maybe Text
$sel:timeZone:HoursOfOperation' :: HoursOfOperation -> Maybe Text
timeZone} -> Maybe Text
timeZone) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe Text
a -> HoursOfOperation
s {$sel:timeZone:HoursOfOperation' :: Maybe Text
timeZone = Maybe Text
a} :: HoursOfOperation)

-- | The description for the hours of operation.
hoursOfOperation_description :: Lens.Lens' HoursOfOperation (Prelude.Maybe Prelude.Text)
hoursOfOperation_description :: (Maybe Text -> f (Maybe Text))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_description = (HoursOfOperation -> Maybe Text)
-> (HoursOfOperation -> Maybe Text -> HoursOfOperation)
-> Lens HoursOfOperation HoursOfOperation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe Text
description :: Maybe Text
$sel:description:HoursOfOperation' :: HoursOfOperation -> Maybe Text
description} -> Maybe Text
description) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe Text
a -> HoursOfOperation
s {$sel:description:HoursOfOperation' :: Maybe Text
description = Maybe Text
a} :: HoursOfOperation)

-- | One or more tags.
hoursOfOperation_tags :: Lens.Lens' HoursOfOperation (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
hoursOfOperation_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> HoursOfOperation -> f HoursOfOperation
hoursOfOperation_tags = (HoursOfOperation -> Maybe (HashMap Text Text))
-> (HoursOfOperation
    -> Maybe (HashMap Text Text) -> HoursOfOperation)
-> Lens
     HoursOfOperation
     HoursOfOperation
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoursOfOperation' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:HoursOfOperation' :: HoursOfOperation -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: HoursOfOperation
s@HoursOfOperation' {} Maybe (HashMap Text Text)
a -> HoursOfOperation
s {$sel:tags:HoursOfOperation' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: HoursOfOperation) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> HoursOfOperation -> f HoursOfOperation)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> HoursOfOperation
-> f HoursOfOperation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON HoursOfOperation where
  parseJSON :: Value -> Parser HoursOfOperation
parseJSON =
    String
-> (Object -> Parser HoursOfOperation)
-> Value
-> Parser HoursOfOperation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HoursOfOperation"
      ( \Object
x ->
          Maybe [HoursOfOperationConfig]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> HoursOfOperation
HoursOfOperation'
            (Maybe [HoursOfOperationConfig]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> HoursOfOperation)
-> Parser (Maybe [HoursOfOperationConfig])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> HoursOfOperation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [HoursOfOperationConfig]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Config" Parser (Maybe (Maybe [HoursOfOperationConfig]))
-> Maybe [HoursOfOperationConfig]
-> Parser (Maybe [HoursOfOperationConfig])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HoursOfOperationConfig]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> HoursOfOperation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> HoursOfOperation)
forall (f :: * -> *) a b. Applicative f => 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
"Name")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> HoursOfOperation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> HoursOfOperation)
forall (f :: * -> *) a b. Applicative f => 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
"HoursOfOperationArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> HoursOfOperation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe (HashMap Text Text) -> HoursOfOperation)
forall (f :: * -> *) a b. Applicative f => 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
"HoursOfOperationId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe (HashMap Text Text) -> HoursOfOperation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe (HashMap Text Text) -> HoursOfOperation)
forall (f :: * -> *) a b. Applicative f => 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
"TimeZone")
            Parser
  (Maybe Text -> Maybe (HashMap Text Text) -> HoursOfOperation)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> HoursOfOperation)
forall (f :: * -> *) a b. Applicative f => 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
"Description")
            Parser (Maybe (HashMap Text Text) -> HoursOfOperation)
-> Parser (Maybe (HashMap Text Text)) -> Parser HoursOfOperation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable HoursOfOperation

instance Prelude.NFData HoursOfOperation