{-# 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.WorkDocs.Types.ShareResult
-- 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.WorkDocs.Types.ShareResult 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.WorkDocs.Types.RoleType
import Amazonka.WorkDocs.Types.ShareStatusType

-- | Describes the share results of a resource.
--
-- /See:/ 'newShareResult' smart constructor.
data ShareResult = ShareResult'
  { -- | The ID of the invited user.
    ShareResult -> Maybe Text
inviteePrincipalId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the principal.
    ShareResult -> Maybe Text
principalId :: Prelude.Maybe Prelude.Text,
    -- | The role.
    ShareResult -> Maybe RoleType
role' :: Prelude.Maybe RoleType,
    -- | The ID of the resource that was shared.
    ShareResult -> Maybe Text
shareId :: Prelude.Maybe Prelude.Text,
    -- | The status.
    ShareResult -> Maybe ShareStatusType
status :: Prelude.Maybe ShareStatusType,
    -- | The status message.
    ShareResult -> Maybe (Sensitive Text)
statusMessage :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (ShareResult -> ShareResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShareResult -> ShareResult -> Bool
$c/= :: ShareResult -> ShareResult -> Bool
== :: ShareResult -> ShareResult -> Bool
$c== :: ShareResult -> ShareResult -> Bool
Prelude.Eq, Int -> ShareResult -> ShowS
[ShareResult] -> ShowS
ShareResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShareResult] -> ShowS
$cshowList :: [ShareResult] -> ShowS
show :: ShareResult -> String
$cshow :: ShareResult -> String
showsPrec :: Int -> ShareResult -> ShowS
$cshowsPrec :: Int -> ShareResult -> ShowS
Prelude.Show, forall x. Rep ShareResult x -> ShareResult
forall x. ShareResult -> Rep ShareResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShareResult x -> ShareResult
$cfrom :: forall x. ShareResult -> Rep ShareResult x
Prelude.Generic)

-- |
-- Create a value of 'ShareResult' 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:
--
-- 'inviteePrincipalId', 'shareResult_inviteePrincipalId' - The ID of the invited user.
--
-- 'principalId', 'shareResult_principalId' - The ID of the principal.
--
-- 'role'', 'shareResult_role' - The role.
--
-- 'shareId', 'shareResult_shareId' - The ID of the resource that was shared.
--
-- 'status', 'shareResult_status' - The status.
--
-- 'statusMessage', 'shareResult_statusMessage' - The status message.
newShareResult ::
  ShareResult
newShareResult :: ShareResult
newShareResult =
  ShareResult'
    { $sel:inviteePrincipalId:ShareResult' :: Maybe Text
inviteePrincipalId = forall a. Maybe a
Prelude.Nothing,
      $sel:principalId:ShareResult' :: Maybe Text
principalId = forall a. Maybe a
Prelude.Nothing,
      $sel:role':ShareResult' :: Maybe RoleType
role' = forall a. Maybe a
Prelude.Nothing,
      $sel:shareId:ShareResult' :: Maybe Text
shareId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ShareResult' :: Maybe ShareStatusType
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ShareResult' :: Maybe (Sensitive Text)
statusMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the invited user.
shareResult_inviteePrincipalId :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_inviteePrincipalId :: Lens' ShareResult (Maybe Text)
shareResult_inviteePrincipalId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe Text
inviteePrincipalId :: Maybe Text
$sel:inviteePrincipalId:ShareResult' :: ShareResult -> Maybe Text
inviteePrincipalId} -> Maybe Text
inviteePrincipalId) (\s :: ShareResult
s@ShareResult' {} Maybe Text
a -> ShareResult
s {$sel:inviteePrincipalId:ShareResult' :: Maybe Text
inviteePrincipalId = Maybe Text
a} :: ShareResult)

-- | The ID of the principal.
shareResult_principalId :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_principalId :: Lens' ShareResult (Maybe Text)
shareResult_principalId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe Text
principalId :: Maybe Text
$sel:principalId:ShareResult' :: ShareResult -> Maybe Text
principalId} -> Maybe Text
principalId) (\s :: ShareResult
s@ShareResult' {} Maybe Text
a -> ShareResult
s {$sel:principalId:ShareResult' :: Maybe Text
principalId = Maybe Text
a} :: ShareResult)

-- | The role.
shareResult_role :: Lens.Lens' ShareResult (Prelude.Maybe RoleType)
shareResult_role :: Lens' ShareResult (Maybe RoleType)
shareResult_role = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe RoleType
role' :: Maybe RoleType
$sel:role':ShareResult' :: ShareResult -> Maybe RoleType
role'} -> Maybe RoleType
role') (\s :: ShareResult
s@ShareResult' {} Maybe RoleType
a -> ShareResult
s {$sel:role':ShareResult' :: Maybe RoleType
role' = Maybe RoleType
a} :: ShareResult)

-- | The ID of the resource that was shared.
shareResult_shareId :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_shareId :: Lens' ShareResult (Maybe Text)
shareResult_shareId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe Text
shareId :: Maybe Text
$sel:shareId:ShareResult' :: ShareResult -> Maybe Text
shareId} -> Maybe Text
shareId) (\s :: ShareResult
s@ShareResult' {} Maybe Text
a -> ShareResult
s {$sel:shareId:ShareResult' :: Maybe Text
shareId = Maybe Text
a} :: ShareResult)

-- | The status.
shareResult_status :: Lens.Lens' ShareResult (Prelude.Maybe ShareStatusType)
shareResult_status :: Lens' ShareResult (Maybe ShareStatusType)
shareResult_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe ShareStatusType
status :: Maybe ShareStatusType
$sel:status:ShareResult' :: ShareResult -> Maybe ShareStatusType
status} -> Maybe ShareStatusType
status) (\s :: ShareResult
s@ShareResult' {} Maybe ShareStatusType
a -> ShareResult
s {$sel:status:ShareResult' :: Maybe ShareStatusType
status = Maybe ShareStatusType
a} :: ShareResult)

-- | The status message.
shareResult_statusMessage :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_statusMessage :: Lens' ShareResult (Maybe Text)
shareResult_statusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe (Sensitive Text)
statusMessage :: Maybe (Sensitive Text)
$sel:statusMessage:ShareResult' :: ShareResult -> Maybe (Sensitive Text)
statusMessage} -> Maybe (Sensitive Text)
statusMessage) (\s :: ShareResult
s@ShareResult' {} Maybe (Sensitive Text)
a -> ShareResult
s {$sel:statusMessage:ShareResult' :: Maybe (Sensitive Text)
statusMessage = Maybe (Sensitive Text)
a} :: ShareResult) 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. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON ShareResult where
  parseJSON :: Value -> Parser ShareResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ShareResult"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe RoleType
-> Maybe Text
-> Maybe ShareStatusType
-> Maybe (Sensitive Text)
-> ShareResult
ShareResult'
            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
"InviteePrincipalId")
            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
"PrincipalId")
            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
"Role")
            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
"ShareId")
            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
"Status")
            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
"StatusMessage")
      )

instance Prelude.Hashable ShareResult where
  hashWithSalt :: Int -> ShareResult -> Int
hashWithSalt Int
_salt ShareResult' {Maybe Text
Maybe (Sensitive Text)
Maybe RoleType
Maybe ShareStatusType
statusMessage :: Maybe (Sensitive Text)
status :: Maybe ShareStatusType
shareId :: Maybe Text
role' :: Maybe RoleType
principalId :: Maybe Text
inviteePrincipalId :: Maybe Text
$sel:statusMessage:ShareResult' :: ShareResult -> Maybe (Sensitive Text)
$sel:status:ShareResult' :: ShareResult -> Maybe ShareStatusType
$sel:shareId:ShareResult' :: ShareResult -> Maybe Text
$sel:role':ShareResult' :: ShareResult -> Maybe RoleType
$sel:principalId:ShareResult' :: ShareResult -> Maybe Text
$sel:inviteePrincipalId:ShareResult' :: ShareResult -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inviteePrincipalId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
principalId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RoleType
role'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
shareId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ShareStatusType
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
statusMessage

instance Prelude.NFData ShareResult where
  rnf :: ShareResult -> ()
rnf ShareResult' {Maybe Text
Maybe (Sensitive Text)
Maybe RoleType
Maybe ShareStatusType
statusMessage :: Maybe (Sensitive Text)
status :: Maybe ShareStatusType
shareId :: Maybe Text
role' :: Maybe RoleType
principalId :: Maybe Text
inviteePrincipalId :: Maybe Text
$sel:statusMessage:ShareResult' :: ShareResult -> Maybe (Sensitive Text)
$sel:status:ShareResult' :: ShareResult -> Maybe ShareStatusType
$sel:shareId:ShareResult' :: ShareResult -> Maybe Text
$sel:role':ShareResult' :: ShareResult -> Maybe RoleType
$sel:principalId:ShareResult' :: ShareResult -> Maybe Text
$sel:inviteePrincipalId:ShareResult' :: ShareResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inviteePrincipalId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
principalId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RoleType
role'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
shareId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ShareStatusType
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
statusMessage