{-# 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.GuardDuty.Types.Invitation
-- 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.GuardDuty.Types.Invitation 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

-- | Contains information about the invitation to become a member account.
--
-- /See:/ 'newInvitation' smart constructor.
data Invitation = Invitation'
  { -- | The ID of the account that the invitation was sent from.
    Invitation -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the invitation. This value is used to validate the inviter
    -- account to the member account.
    Invitation -> Maybe Text
invitationId :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the invitation was sent.
    Invitation -> Maybe Text
invitedAt :: Prelude.Maybe Prelude.Text,
    -- | The status of the relationship between the inviter and invitee accounts.
    Invitation -> Maybe Text
relationshipStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (Invitation -> Invitation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Invitation -> Invitation -> Bool
$c/= :: Invitation -> Invitation -> Bool
== :: Invitation -> Invitation -> Bool
$c== :: Invitation -> Invitation -> Bool
Prelude.Eq, ReadPrec [Invitation]
ReadPrec Invitation
Int -> ReadS Invitation
ReadS [Invitation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Invitation]
$creadListPrec :: ReadPrec [Invitation]
readPrec :: ReadPrec Invitation
$creadPrec :: ReadPrec Invitation
readList :: ReadS [Invitation]
$creadList :: ReadS [Invitation]
readsPrec :: Int -> ReadS Invitation
$creadsPrec :: Int -> ReadS Invitation
Prelude.Read, Int -> Invitation -> ShowS
[Invitation] -> ShowS
Invitation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Invitation] -> ShowS
$cshowList :: [Invitation] -> ShowS
show :: Invitation -> String
$cshow :: Invitation -> String
showsPrec :: Int -> Invitation -> ShowS
$cshowsPrec :: Int -> Invitation -> ShowS
Prelude.Show, forall x. Rep Invitation x -> Invitation
forall x. Invitation -> Rep Invitation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Invitation x -> Invitation
$cfrom :: forall x. Invitation -> Rep Invitation x
Prelude.Generic)

-- |
-- Create a value of 'Invitation' 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:
--
-- 'accountId', 'invitation_accountId' - The ID of the account that the invitation was sent from.
--
-- 'invitationId', 'invitation_invitationId' - The ID of the invitation. This value is used to validate the inviter
-- account to the member account.
--
-- 'invitedAt', 'invitation_invitedAt' - The timestamp when the invitation was sent.
--
-- 'relationshipStatus', 'invitation_relationshipStatus' - The status of the relationship between the inviter and invitee accounts.
newInvitation ::
  Invitation
newInvitation :: Invitation
newInvitation =
  Invitation'
    { $sel:accountId:Invitation' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:invitationId:Invitation' :: Maybe Text
invitationId = forall a. Maybe a
Prelude.Nothing,
      $sel:invitedAt:Invitation' :: Maybe Text
invitedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:relationshipStatus:Invitation' :: Maybe Text
relationshipStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the account that the invitation was sent from.
invitation_accountId :: Lens.Lens' Invitation (Prelude.Maybe Prelude.Text)
invitation_accountId :: Lens' Invitation (Maybe Text)
invitation_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invitation' {Maybe Text
accountId :: Maybe Text
$sel:accountId:Invitation' :: Invitation -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Invitation
s@Invitation' {} Maybe Text
a -> Invitation
s {$sel:accountId:Invitation' :: Maybe Text
accountId = Maybe Text
a} :: Invitation)

-- | The ID of the invitation. This value is used to validate the inviter
-- account to the member account.
invitation_invitationId :: Lens.Lens' Invitation (Prelude.Maybe Prelude.Text)
invitation_invitationId :: Lens' Invitation (Maybe Text)
invitation_invitationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invitation' {Maybe Text
invitationId :: Maybe Text
$sel:invitationId:Invitation' :: Invitation -> Maybe Text
invitationId} -> Maybe Text
invitationId) (\s :: Invitation
s@Invitation' {} Maybe Text
a -> Invitation
s {$sel:invitationId:Invitation' :: Maybe Text
invitationId = Maybe Text
a} :: Invitation)

-- | The timestamp when the invitation was sent.
invitation_invitedAt :: Lens.Lens' Invitation (Prelude.Maybe Prelude.Text)
invitation_invitedAt :: Lens' Invitation (Maybe Text)
invitation_invitedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invitation' {Maybe Text
invitedAt :: Maybe Text
$sel:invitedAt:Invitation' :: Invitation -> Maybe Text
invitedAt} -> Maybe Text
invitedAt) (\s :: Invitation
s@Invitation' {} Maybe Text
a -> Invitation
s {$sel:invitedAt:Invitation' :: Maybe Text
invitedAt = Maybe Text
a} :: Invitation)

-- | The status of the relationship between the inviter and invitee accounts.
invitation_relationshipStatus :: Lens.Lens' Invitation (Prelude.Maybe Prelude.Text)
invitation_relationshipStatus :: Lens' Invitation (Maybe Text)
invitation_relationshipStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invitation' {Maybe Text
relationshipStatus :: Maybe Text
$sel:relationshipStatus:Invitation' :: Invitation -> Maybe Text
relationshipStatus} -> Maybe Text
relationshipStatus) (\s :: Invitation
s@Invitation' {} Maybe Text
a -> Invitation
s {$sel:relationshipStatus:Invitation' :: Maybe Text
relationshipStatus = Maybe Text
a} :: Invitation)

instance Data.FromJSON Invitation where
  parseJSON :: Value -> Parser Invitation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Invitation"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Invitation
Invitation'
            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
"accountId")
            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
"invitationId")
            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
"invitedAt")
            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
"relationshipStatus")
      )

instance Prelude.Hashable Invitation where
  hashWithSalt :: Int -> Invitation -> Int
hashWithSalt Int
_salt Invitation' {Maybe Text
relationshipStatus :: Maybe Text
invitedAt :: Maybe Text
invitationId :: Maybe Text
accountId :: Maybe Text
$sel:relationshipStatus:Invitation' :: Invitation -> Maybe Text
$sel:invitedAt:Invitation' :: Invitation -> Maybe Text
$sel:invitationId:Invitation' :: Invitation -> Maybe Text
$sel:accountId:Invitation' :: Invitation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
invitationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
invitedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
relationshipStatus

instance Prelude.NFData Invitation where
  rnf :: Invitation -> ()
rnf Invitation' {Maybe Text
relationshipStatus :: Maybe Text
invitedAt :: Maybe Text
invitationId :: Maybe Text
accountId :: Maybe Text
$sel:relationshipStatus:Invitation' :: Invitation -> Maybe Text
$sel:invitedAt:Invitation' :: Invitation -> Maybe Text
$sel:invitationId:Invitation' :: Invitation -> Maybe Text
$sel:accountId:Invitation' :: Invitation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
invitationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
invitedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
relationshipStatus