{-# 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.OrganizationSummary
-- 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.WorkMail.Types.OrganizationSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The representation of an organization.
--
-- /See:/ 'newOrganizationSummary' smart constructor.
data OrganizationSummary = OrganizationSummary'
  { -- | The state associated with the organization.
    OrganizationSummary -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The alias associated with the organization.
    OrganizationSummary -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
    -- | The default email domain associated with the organization.
    OrganizationSummary -> Maybe Text
defaultMailDomain :: Prelude.Maybe Prelude.Text,
    -- | The error message associated with the organization. It is only present
    -- if unexpected behavior has occurred with regards to the organization. It
    -- provides insight or solutions regarding unexpected behavior.
    OrganizationSummary -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The identifier associated with the organization.
    OrganizationSummary -> Maybe Text
organizationId :: Prelude.Maybe Prelude.Text
  }
  deriving (OrganizationSummary -> OrganizationSummary -> Bool
(OrganizationSummary -> OrganizationSummary -> Bool)
-> (OrganizationSummary -> OrganizationSummary -> Bool)
-> Eq OrganizationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrganizationSummary -> OrganizationSummary -> Bool
$c/= :: OrganizationSummary -> OrganizationSummary -> Bool
== :: OrganizationSummary -> OrganizationSummary -> Bool
$c== :: OrganizationSummary -> OrganizationSummary -> Bool
Prelude.Eq, ReadPrec [OrganizationSummary]
ReadPrec OrganizationSummary
Int -> ReadS OrganizationSummary
ReadS [OrganizationSummary]
(Int -> ReadS OrganizationSummary)
-> ReadS [OrganizationSummary]
-> ReadPrec OrganizationSummary
-> ReadPrec [OrganizationSummary]
-> Read OrganizationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrganizationSummary]
$creadListPrec :: ReadPrec [OrganizationSummary]
readPrec :: ReadPrec OrganizationSummary
$creadPrec :: ReadPrec OrganizationSummary
readList :: ReadS [OrganizationSummary]
$creadList :: ReadS [OrganizationSummary]
readsPrec :: Int -> ReadS OrganizationSummary
$creadsPrec :: Int -> ReadS OrganizationSummary
Prelude.Read, Int -> OrganizationSummary -> ShowS
[OrganizationSummary] -> ShowS
OrganizationSummary -> String
(Int -> OrganizationSummary -> ShowS)
-> (OrganizationSummary -> String)
-> ([OrganizationSummary] -> ShowS)
-> Show OrganizationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrganizationSummary] -> ShowS
$cshowList :: [OrganizationSummary] -> ShowS
show :: OrganizationSummary -> String
$cshow :: OrganizationSummary -> String
showsPrec :: Int -> OrganizationSummary -> ShowS
$cshowsPrec :: Int -> OrganizationSummary -> ShowS
Prelude.Show, (forall x. OrganizationSummary -> Rep OrganizationSummary x)
-> (forall x. Rep OrganizationSummary x -> OrganizationSummary)
-> Generic OrganizationSummary
forall x. Rep OrganizationSummary x -> OrganizationSummary
forall x. OrganizationSummary -> Rep OrganizationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrganizationSummary x -> OrganizationSummary
$cfrom :: forall x. OrganizationSummary -> Rep OrganizationSummary x
Prelude.Generic)

-- |
-- Create a value of 'OrganizationSummary' 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:
--
-- 'state', 'organizationSummary_state' - The state associated with the organization.
--
-- 'alias', 'organizationSummary_alias' - The alias associated with the organization.
--
-- 'defaultMailDomain', 'organizationSummary_defaultMailDomain' - The default email domain associated with the organization.
--
-- 'errorMessage', 'organizationSummary_errorMessage' - The error message associated with the organization. It is only present
-- if unexpected behavior has occurred with regards to the organization. It
-- provides insight or solutions regarding unexpected behavior.
--
-- 'organizationId', 'organizationSummary_organizationId' - The identifier associated with the organization.
newOrganizationSummary ::
  OrganizationSummary
newOrganizationSummary :: OrganizationSummary
newOrganizationSummary =
  OrganizationSummary' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> OrganizationSummary
OrganizationSummary'
    { $sel:state:OrganizationSummary' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alias:OrganizationSummary' :: Maybe Text
alias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultMailDomain:OrganizationSummary' :: Maybe Text
defaultMailDomain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:OrganizationSummary' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationId:OrganizationSummary' :: Maybe Text
organizationId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state associated with the organization.
organizationSummary_state :: Lens.Lens' OrganizationSummary (Prelude.Maybe Prelude.Text)
organizationSummary_state :: (Maybe Text -> f (Maybe Text))
-> OrganizationSummary -> f OrganizationSummary
organizationSummary_state = (OrganizationSummary -> Maybe Text)
-> (OrganizationSummary -> Maybe Text -> OrganizationSummary)
-> Lens
     OrganizationSummary OrganizationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationSummary' {Maybe Text
state :: Maybe Text
$sel:state:OrganizationSummary' :: OrganizationSummary -> Maybe Text
state} -> Maybe Text
state) (\s :: OrganizationSummary
s@OrganizationSummary' {} Maybe Text
a -> OrganizationSummary
s {$sel:state:OrganizationSummary' :: Maybe Text
state = Maybe Text
a} :: OrganizationSummary)

-- | The alias associated with the organization.
organizationSummary_alias :: Lens.Lens' OrganizationSummary (Prelude.Maybe Prelude.Text)
organizationSummary_alias :: (Maybe Text -> f (Maybe Text))
-> OrganizationSummary -> f OrganizationSummary
organizationSummary_alias = (OrganizationSummary -> Maybe Text)
-> (OrganizationSummary -> Maybe Text -> OrganizationSummary)
-> Lens
     OrganizationSummary OrganizationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationSummary' {Maybe Text
alias :: Maybe Text
$sel:alias:OrganizationSummary' :: OrganizationSummary -> Maybe Text
alias} -> Maybe Text
alias) (\s :: OrganizationSummary
s@OrganizationSummary' {} Maybe Text
a -> OrganizationSummary
s {$sel:alias:OrganizationSummary' :: Maybe Text
alias = Maybe Text
a} :: OrganizationSummary)

-- | The default email domain associated with the organization.
organizationSummary_defaultMailDomain :: Lens.Lens' OrganizationSummary (Prelude.Maybe Prelude.Text)
organizationSummary_defaultMailDomain :: (Maybe Text -> f (Maybe Text))
-> OrganizationSummary -> f OrganizationSummary
organizationSummary_defaultMailDomain = (OrganizationSummary -> Maybe Text)
-> (OrganizationSummary -> Maybe Text -> OrganizationSummary)
-> Lens
     OrganizationSummary OrganizationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationSummary' {Maybe Text
defaultMailDomain :: Maybe Text
$sel:defaultMailDomain:OrganizationSummary' :: OrganizationSummary -> Maybe Text
defaultMailDomain} -> Maybe Text
defaultMailDomain) (\s :: OrganizationSummary
s@OrganizationSummary' {} Maybe Text
a -> OrganizationSummary
s {$sel:defaultMailDomain:OrganizationSummary' :: Maybe Text
defaultMailDomain = Maybe Text
a} :: OrganizationSummary)

-- | The error message associated with the organization. It is only present
-- if unexpected behavior has occurred with regards to the organization. It
-- provides insight or solutions regarding unexpected behavior.
organizationSummary_errorMessage :: Lens.Lens' OrganizationSummary (Prelude.Maybe Prelude.Text)
organizationSummary_errorMessage :: (Maybe Text -> f (Maybe Text))
-> OrganizationSummary -> f OrganizationSummary
organizationSummary_errorMessage = (OrganizationSummary -> Maybe Text)
-> (OrganizationSummary -> Maybe Text -> OrganizationSummary)
-> Lens
     OrganizationSummary OrganizationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationSummary' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:OrganizationSummary' :: OrganizationSummary -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: OrganizationSummary
s@OrganizationSummary' {} Maybe Text
a -> OrganizationSummary
s {$sel:errorMessage:OrganizationSummary' :: Maybe Text
errorMessage = Maybe Text
a} :: OrganizationSummary)

-- | The identifier associated with the organization.
organizationSummary_organizationId :: Lens.Lens' OrganizationSummary (Prelude.Maybe Prelude.Text)
organizationSummary_organizationId :: (Maybe Text -> f (Maybe Text))
-> OrganizationSummary -> f OrganizationSummary
organizationSummary_organizationId = (OrganizationSummary -> Maybe Text)
-> (OrganizationSummary -> Maybe Text -> OrganizationSummary)
-> Lens
     OrganizationSummary OrganizationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationSummary' {Maybe Text
organizationId :: Maybe Text
$sel:organizationId:OrganizationSummary' :: OrganizationSummary -> Maybe Text
organizationId} -> Maybe Text
organizationId) (\s :: OrganizationSummary
s@OrganizationSummary' {} Maybe Text
a -> OrganizationSummary
s {$sel:organizationId:OrganizationSummary' :: Maybe Text
organizationId = Maybe Text
a} :: OrganizationSummary)

instance Core.FromJSON OrganizationSummary where
  parseJSON :: Value -> Parser OrganizationSummary
parseJSON =
    String
-> (Object -> Parser OrganizationSummary)
-> Value
-> Parser OrganizationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrganizationSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> OrganizationSummary
OrganizationSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> OrganizationSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> OrganizationSummary)
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
"State")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> OrganizationSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> OrganizationSummary)
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
"Alias")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> OrganizationSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> OrganizationSummary)
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
"DefaultMailDomain")
            Parser (Maybe Text -> Maybe Text -> OrganizationSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> OrganizationSummary)
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
"ErrorMessage")
            Parser (Maybe Text -> OrganizationSummary)
-> Parser (Maybe Text) -> Parser OrganizationSummary
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
"OrganizationId")
      )

instance Prelude.Hashable OrganizationSummary

instance Prelude.NFData OrganizationSummary