{-# 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.WorkMail.Types.AvailabilityConfiguration
-- 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.WorkMail.Types.AvailabilityConfiguration 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
import Amazonka.WorkMail.Types.AvailabilityProviderType
import Amazonka.WorkMail.Types.LambdaAvailabilityProvider
import Amazonka.WorkMail.Types.RedactedEwsAvailabilityProvider

-- | List all the @AvailabilityConfiguration@\'s for the given WorkMail
-- organization.
--
-- /See:/ 'newAvailabilityConfiguration' smart constructor.
data AvailabilityConfiguration = AvailabilityConfiguration'
  { -- | The date and time at which the availability configuration was created.
    AvailabilityConfiguration -> Maybe POSIX
dateCreated :: Prelude.Maybe Data.POSIX,
    -- | The date and time at which the availability configuration was last
    -- modified.
    AvailabilityConfiguration -> Maybe POSIX
dateModified :: Prelude.Maybe Data.POSIX,
    -- | Displays the domain to which the provider applies.
    AvailabilityConfiguration -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | If @ProviderType@ is @EWS@, then this field contains
    -- @RedactedEwsAvailabilityProvider@. Otherwise, it is not required.
    AvailabilityConfiguration -> Maybe RedactedEwsAvailabilityProvider
ewsProvider :: Prelude.Maybe RedactedEwsAvailabilityProvider,
    -- | If ProviderType is @LAMBDA@ then this field contains
    -- @LambdaAvailabilityProvider@. Otherwise, it is not required.
    AvailabilityConfiguration -> Maybe LambdaAvailabilityProvider
lambdaProvider :: Prelude.Maybe LambdaAvailabilityProvider,
    -- | Displays the provider type that applies to this domain.
    AvailabilityConfiguration -> Maybe AvailabilityProviderType
providerType :: Prelude.Maybe AvailabilityProviderType
  }
  deriving (AvailabilityConfiguration -> AvailabilityConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AvailabilityConfiguration -> AvailabilityConfiguration -> Bool
$c/= :: AvailabilityConfiguration -> AvailabilityConfiguration -> Bool
== :: AvailabilityConfiguration -> AvailabilityConfiguration -> Bool
$c== :: AvailabilityConfiguration -> AvailabilityConfiguration -> Bool
Prelude.Eq, ReadPrec [AvailabilityConfiguration]
ReadPrec AvailabilityConfiguration
Int -> ReadS AvailabilityConfiguration
ReadS [AvailabilityConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AvailabilityConfiguration]
$creadListPrec :: ReadPrec [AvailabilityConfiguration]
readPrec :: ReadPrec AvailabilityConfiguration
$creadPrec :: ReadPrec AvailabilityConfiguration
readList :: ReadS [AvailabilityConfiguration]
$creadList :: ReadS [AvailabilityConfiguration]
readsPrec :: Int -> ReadS AvailabilityConfiguration
$creadsPrec :: Int -> ReadS AvailabilityConfiguration
Prelude.Read, Int -> AvailabilityConfiguration -> ShowS
[AvailabilityConfiguration] -> ShowS
AvailabilityConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AvailabilityConfiguration] -> ShowS
$cshowList :: [AvailabilityConfiguration] -> ShowS
show :: AvailabilityConfiguration -> String
$cshow :: AvailabilityConfiguration -> String
showsPrec :: Int -> AvailabilityConfiguration -> ShowS
$cshowsPrec :: Int -> AvailabilityConfiguration -> ShowS
Prelude.Show, forall x.
Rep AvailabilityConfiguration x -> AvailabilityConfiguration
forall x.
AvailabilityConfiguration -> Rep AvailabilityConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AvailabilityConfiguration x -> AvailabilityConfiguration
$cfrom :: forall x.
AvailabilityConfiguration -> Rep AvailabilityConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AvailabilityConfiguration' 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:
--
-- 'dateCreated', 'availabilityConfiguration_dateCreated' - The date and time at which the availability configuration was created.
--
-- 'dateModified', 'availabilityConfiguration_dateModified' - The date and time at which the availability configuration was last
-- modified.
--
-- 'domainName', 'availabilityConfiguration_domainName' - Displays the domain to which the provider applies.
--
-- 'ewsProvider', 'availabilityConfiguration_ewsProvider' - If @ProviderType@ is @EWS@, then this field contains
-- @RedactedEwsAvailabilityProvider@. Otherwise, it is not required.
--
-- 'lambdaProvider', 'availabilityConfiguration_lambdaProvider' - If ProviderType is @LAMBDA@ then this field contains
-- @LambdaAvailabilityProvider@. Otherwise, it is not required.
--
-- 'providerType', 'availabilityConfiguration_providerType' - Displays the provider type that applies to this domain.
newAvailabilityConfiguration ::
  AvailabilityConfiguration
newAvailabilityConfiguration :: AvailabilityConfiguration
newAvailabilityConfiguration =
  AvailabilityConfiguration'
    { $sel:dateCreated:AvailabilityConfiguration' :: Maybe POSIX
dateCreated =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dateModified:AvailabilityConfiguration' :: Maybe POSIX
dateModified = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:AvailabilityConfiguration' :: Maybe Text
domainName = forall a. Maybe a
Prelude.Nothing,
      $sel:ewsProvider:AvailabilityConfiguration' :: Maybe RedactedEwsAvailabilityProvider
ewsProvider = forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaProvider:AvailabilityConfiguration' :: Maybe LambdaAvailabilityProvider
lambdaProvider = forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:AvailabilityConfiguration' :: Maybe AvailabilityProviderType
providerType = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time at which the availability configuration was created.
availabilityConfiguration_dateCreated :: Lens.Lens' AvailabilityConfiguration (Prelude.Maybe Prelude.UTCTime)
availabilityConfiguration_dateCreated :: Lens' AvailabilityConfiguration (Maybe UTCTime)
availabilityConfiguration_dateCreated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityConfiguration' {Maybe POSIX
dateCreated :: Maybe POSIX
$sel:dateCreated:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe POSIX
dateCreated} -> Maybe POSIX
dateCreated) (\s :: AvailabilityConfiguration
s@AvailabilityConfiguration' {} Maybe POSIX
a -> AvailabilityConfiguration
s {$sel:dateCreated:AvailabilityConfiguration' :: Maybe POSIX
dateCreated = Maybe POSIX
a} :: AvailabilityConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date and time at which the availability configuration was last
-- modified.
availabilityConfiguration_dateModified :: Lens.Lens' AvailabilityConfiguration (Prelude.Maybe Prelude.UTCTime)
availabilityConfiguration_dateModified :: Lens' AvailabilityConfiguration (Maybe UTCTime)
availabilityConfiguration_dateModified = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityConfiguration' {Maybe POSIX
dateModified :: Maybe POSIX
$sel:dateModified:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe POSIX
dateModified} -> Maybe POSIX
dateModified) (\s :: AvailabilityConfiguration
s@AvailabilityConfiguration' {} Maybe POSIX
a -> AvailabilityConfiguration
s {$sel:dateModified:AvailabilityConfiguration' :: Maybe POSIX
dateModified = Maybe POSIX
a} :: AvailabilityConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Displays the domain to which the provider applies.
availabilityConfiguration_domainName :: Lens.Lens' AvailabilityConfiguration (Prelude.Maybe Prelude.Text)
availabilityConfiguration_domainName :: Lens' AvailabilityConfiguration (Maybe Text)
availabilityConfiguration_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityConfiguration' {Maybe Text
domainName :: Maybe Text
$sel:domainName:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: AvailabilityConfiguration
s@AvailabilityConfiguration' {} Maybe Text
a -> AvailabilityConfiguration
s {$sel:domainName:AvailabilityConfiguration' :: Maybe Text
domainName = Maybe Text
a} :: AvailabilityConfiguration)

-- | If @ProviderType@ is @EWS@, then this field contains
-- @RedactedEwsAvailabilityProvider@. Otherwise, it is not required.
availabilityConfiguration_ewsProvider :: Lens.Lens' AvailabilityConfiguration (Prelude.Maybe RedactedEwsAvailabilityProvider)
availabilityConfiguration_ewsProvider :: Lens'
  AvailabilityConfiguration (Maybe RedactedEwsAvailabilityProvider)
availabilityConfiguration_ewsProvider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityConfiguration' {Maybe RedactedEwsAvailabilityProvider
ewsProvider :: Maybe RedactedEwsAvailabilityProvider
$sel:ewsProvider:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe RedactedEwsAvailabilityProvider
ewsProvider} -> Maybe RedactedEwsAvailabilityProvider
ewsProvider) (\s :: AvailabilityConfiguration
s@AvailabilityConfiguration' {} Maybe RedactedEwsAvailabilityProvider
a -> AvailabilityConfiguration
s {$sel:ewsProvider:AvailabilityConfiguration' :: Maybe RedactedEwsAvailabilityProvider
ewsProvider = Maybe RedactedEwsAvailabilityProvider
a} :: AvailabilityConfiguration)

-- | If ProviderType is @LAMBDA@ then this field contains
-- @LambdaAvailabilityProvider@. Otherwise, it is not required.
availabilityConfiguration_lambdaProvider :: Lens.Lens' AvailabilityConfiguration (Prelude.Maybe LambdaAvailabilityProvider)
availabilityConfiguration_lambdaProvider :: Lens' AvailabilityConfiguration (Maybe LambdaAvailabilityProvider)
availabilityConfiguration_lambdaProvider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityConfiguration' {Maybe LambdaAvailabilityProvider
lambdaProvider :: Maybe LambdaAvailabilityProvider
$sel:lambdaProvider:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe LambdaAvailabilityProvider
lambdaProvider} -> Maybe LambdaAvailabilityProvider
lambdaProvider) (\s :: AvailabilityConfiguration
s@AvailabilityConfiguration' {} Maybe LambdaAvailabilityProvider
a -> AvailabilityConfiguration
s {$sel:lambdaProvider:AvailabilityConfiguration' :: Maybe LambdaAvailabilityProvider
lambdaProvider = Maybe LambdaAvailabilityProvider
a} :: AvailabilityConfiguration)

-- | Displays the provider type that applies to this domain.
availabilityConfiguration_providerType :: Lens.Lens' AvailabilityConfiguration (Prelude.Maybe AvailabilityProviderType)
availabilityConfiguration_providerType :: Lens' AvailabilityConfiguration (Maybe AvailabilityProviderType)
availabilityConfiguration_providerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityConfiguration' {Maybe AvailabilityProviderType
providerType :: Maybe AvailabilityProviderType
$sel:providerType:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe AvailabilityProviderType
providerType} -> Maybe AvailabilityProviderType
providerType) (\s :: AvailabilityConfiguration
s@AvailabilityConfiguration' {} Maybe AvailabilityProviderType
a -> AvailabilityConfiguration
s {$sel:providerType:AvailabilityConfiguration' :: Maybe AvailabilityProviderType
providerType = Maybe AvailabilityProviderType
a} :: AvailabilityConfiguration)

instance Data.FromJSON AvailabilityConfiguration where
  parseJSON :: Value -> Parser AvailabilityConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AvailabilityConfiguration"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe RedactedEwsAvailabilityProvider
-> Maybe LambdaAvailabilityProvider
-> Maybe AvailabilityProviderType
-> AvailabilityConfiguration
AvailabilityConfiguration'
            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
"DateCreated")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DateModified")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DomainName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EwsProvider")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LambdaProvider")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ProviderType")
      )

instance Prelude.Hashable AvailabilityConfiguration where
  hashWithSalt :: Int -> AvailabilityConfiguration -> Int
hashWithSalt Int
_salt AvailabilityConfiguration' {Maybe Text
Maybe POSIX
Maybe AvailabilityProviderType
Maybe LambdaAvailabilityProvider
Maybe RedactedEwsAvailabilityProvider
providerType :: Maybe AvailabilityProviderType
lambdaProvider :: Maybe LambdaAvailabilityProvider
ewsProvider :: Maybe RedactedEwsAvailabilityProvider
domainName :: Maybe Text
dateModified :: Maybe POSIX
dateCreated :: Maybe POSIX
$sel:providerType:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe AvailabilityProviderType
$sel:lambdaProvider:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe LambdaAvailabilityProvider
$sel:ewsProvider:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe RedactedEwsAvailabilityProvider
$sel:domainName:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe Text
$sel:dateModified:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe POSIX
$sel:dateCreated:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
dateCreated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
dateModified
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RedactedEwsAvailabilityProvider
ewsProvider
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaAvailabilityProvider
lambdaProvider
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AvailabilityProviderType
providerType

instance Prelude.NFData AvailabilityConfiguration where
  rnf :: AvailabilityConfiguration -> ()
rnf AvailabilityConfiguration' {Maybe Text
Maybe POSIX
Maybe AvailabilityProviderType
Maybe LambdaAvailabilityProvider
Maybe RedactedEwsAvailabilityProvider
providerType :: Maybe AvailabilityProviderType
lambdaProvider :: Maybe LambdaAvailabilityProvider
ewsProvider :: Maybe RedactedEwsAvailabilityProvider
domainName :: Maybe Text
dateModified :: Maybe POSIX
dateCreated :: Maybe POSIX
$sel:providerType:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe AvailabilityProviderType
$sel:lambdaProvider:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe LambdaAvailabilityProvider
$sel:ewsProvider:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe RedactedEwsAvailabilityProvider
$sel:domainName:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe Text
$sel:dateModified:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe POSIX
$sel:dateCreated:AvailabilityConfiguration' :: AvailabilityConfiguration -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
dateCreated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
dateModified
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RedactedEwsAvailabilityProvider
ewsProvider
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaAvailabilityProvider
lambdaProvider
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AvailabilityProviderType
providerType