{-# 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.Nimble.Types.NewStudioMember
-- 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.Nimble.Types.NewStudioMember where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types.StudioPersona
import qualified Amazonka.Prelude as Prelude

-- |
--
-- /See:/ 'newNewStudioMember' smart constructor.
data NewStudioMember = NewStudioMember'
  { -- | The persona.
    NewStudioMember -> StudioPersona
persona :: StudioPersona,
    -- | The principal ID.
    NewStudioMember -> Text
principalId :: Prelude.Text
  }
  deriving (NewStudioMember -> NewStudioMember -> Bool
(NewStudioMember -> NewStudioMember -> Bool)
-> (NewStudioMember -> NewStudioMember -> Bool)
-> Eq NewStudioMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NewStudioMember -> NewStudioMember -> Bool
$c/= :: NewStudioMember -> NewStudioMember -> Bool
== :: NewStudioMember -> NewStudioMember -> Bool
$c== :: NewStudioMember -> NewStudioMember -> Bool
Prelude.Eq, ReadPrec [NewStudioMember]
ReadPrec NewStudioMember
Int -> ReadS NewStudioMember
ReadS [NewStudioMember]
(Int -> ReadS NewStudioMember)
-> ReadS [NewStudioMember]
-> ReadPrec NewStudioMember
-> ReadPrec [NewStudioMember]
-> Read NewStudioMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NewStudioMember]
$creadListPrec :: ReadPrec [NewStudioMember]
readPrec :: ReadPrec NewStudioMember
$creadPrec :: ReadPrec NewStudioMember
readList :: ReadS [NewStudioMember]
$creadList :: ReadS [NewStudioMember]
readsPrec :: Int -> ReadS NewStudioMember
$creadsPrec :: Int -> ReadS NewStudioMember
Prelude.Read, Int -> NewStudioMember -> ShowS
[NewStudioMember] -> ShowS
NewStudioMember -> String
(Int -> NewStudioMember -> ShowS)
-> (NewStudioMember -> String)
-> ([NewStudioMember] -> ShowS)
-> Show NewStudioMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NewStudioMember] -> ShowS
$cshowList :: [NewStudioMember] -> ShowS
show :: NewStudioMember -> String
$cshow :: NewStudioMember -> String
showsPrec :: Int -> NewStudioMember -> ShowS
$cshowsPrec :: Int -> NewStudioMember -> ShowS
Prelude.Show, (forall x. NewStudioMember -> Rep NewStudioMember x)
-> (forall x. Rep NewStudioMember x -> NewStudioMember)
-> Generic NewStudioMember
forall x. Rep NewStudioMember x -> NewStudioMember
forall x. NewStudioMember -> Rep NewStudioMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NewStudioMember x -> NewStudioMember
$cfrom :: forall x. NewStudioMember -> Rep NewStudioMember x
Prelude.Generic)

-- |
-- Create a value of 'NewStudioMember' 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:
--
-- 'persona', 'newStudioMember_persona' - The persona.
--
-- 'principalId', 'newStudioMember_principalId' - The principal ID.
newNewStudioMember ::
  -- | 'persona'
  StudioPersona ->
  -- | 'principalId'
  Prelude.Text ->
  NewStudioMember
newNewStudioMember :: StudioPersona -> Text -> NewStudioMember
newNewStudioMember StudioPersona
pPersona_ Text
pPrincipalId_ =
  NewStudioMember' :: StudioPersona -> Text -> NewStudioMember
NewStudioMember'
    { $sel:persona:NewStudioMember' :: StudioPersona
persona = StudioPersona
pPersona_,
      $sel:principalId:NewStudioMember' :: Text
principalId = Text
pPrincipalId_
    }

-- | The persona.
newStudioMember_persona :: Lens.Lens' NewStudioMember StudioPersona
newStudioMember_persona :: (StudioPersona -> f StudioPersona)
-> NewStudioMember -> f NewStudioMember
newStudioMember_persona = (NewStudioMember -> StudioPersona)
-> (NewStudioMember -> StudioPersona -> NewStudioMember)
-> Lens NewStudioMember NewStudioMember StudioPersona StudioPersona
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewStudioMember' {StudioPersona
persona :: StudioPersona
$sel:persona:NewStudioMember' :: NewStudioMember -> StudioPersona
persona} -> StudioPersona
persona) (\s :: NewStudioMember
s@NewStudioMember' {} StudioPersona
a -> NewStudioMember
s {$sel:persona:NewStudioMember' :: StudioPersona
persona = StudioPersona
a} :: NewStudioMember)

-- | The principal ID.
newStudioMember_principalId :: Lens.Lens' NewStudioMember Prelude.Text
newStudioMember_principalId :: (Text -> f Text) -> NewStudioMember -> f NewStudioMember
newStudioMember_principalId = (NewStudioMember -> Text)
-> (NewStudioMember -> Text -> NewStudioMember)
-> Lens NewStudioMember NewStudioMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewStudioMember' {Text
principalId :: Text
$sel:principalId:NewStudioMember' :: NewStudioMember -> Text
principalId} -> Text
principalId) (\s :: NewStudioMember
s@NewStudioMember' {} Text
a -> NewStudioMember
s {$sel:principalId:NewStudioMember' :: Text
principalId = Text
a} :: NewStudioMember)

instance Prelude.Hashable NewStudioMember

instance Prelude.NFData NewStudioMember

instance Core.ToJSON NewStudioMember where
  toJSON :: NewStudioMember -> Value
toJSON NewStudioMember' {Text
StudioPersona
principalId :: Text
persona :: StudioPersona
$sel:principalId:NewStudioMember' :: NewStudioMember -> Text
$sel:persona:NewStudioMember' :: NewStudioMember -> StudioPersona
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"persona" Text -> StudioPersona -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= StudioPersona
persona),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"principalId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
principalId)
          ]
      )