{-# 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.IoTWireless.Types.SessionKeysAbpV1_0_x
-- 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.IoTWireless.Types.SessionKeysAbpV1_0_x 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

-- | Session keys for ABP v1.1
--
-- /See:/ 'newSessionKeysAbpV1_0_x' smart constructor.
data SessionKeysAbpV1_0_x = SessionKeysAbpV1_0_x'
  { -- | The AppSKey value.
    SessionKeysAbpV1_0_x -> Maybe Text
appSKey :: Prelude.Maybe Prelude.Text,
    -- | The NwkSKey value.
    SessionKeysAbpV1_0_x -> Maybe Text
nwkSKey :: Prelude.Maybe Prelude.Text
  }
  deriving (SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
$c/= :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
== :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
$c== :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
Prelude.Eq, ReadPrec [SessionKeysAbpV1_0_x]
ReadPrec SessionKeysAbpV1_0_x
Int -> ReadS SessionKeysAbpV1_0_x
ReadS [SessionKeysAbpV1_0_x]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionKeysAbpV1_0_x]
$creadListPrec :: ReadPrec [SessionKeysAbpV1_0_x]
readPrec :: ReadPrec SessionKeysAbpV1_0_x
$creadPrec :: ReadPrec SessionKeysAbpV1_0_x
readList :: ReadS [SessionKeysAbpV1_0_x]
$creadList :: ReadS [SessionKeysAbpV1_0_x]
readsPrec :: Int -> ReadS SessionKeysAbpV1_0_x
$creadsPrec :: Int -> ReadS SessionKeysAbpV1_0_x
Prelude.Read, Int -> SessionKeysAbpV1_0_x -> ShowS
[SessionKeysAbpV1_0_x] -> ShowS
SessionKeysAbpV1_0_x -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionKeysAbpV1_0_x] -> ShowS
$cshowList :: [SessionKeysAbpV1_0_x] -> ShowS
show :: SessionKeysAbpV1_0_x -> String
$cshow :: SessionKeysAbpV1_0_x -> String
showsPrec :: Int -> SessionKeysAbpV1_0_x -> ShowS
$cshowsPrec :: Int -> SessionKeysAbpV1_0_x -> ShowS
Prelude.Show, forall x. Rep SessionKeysAbpV1_0_x x -> SessionKeysAbpV1_0_x
forall x. SessionKeysAbpV1_0_x -> Rep SessionKeysAbpV1_0_x x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionKeysAbpV1_0_x x -> SessionKeysAbpV1_0_x
$cfrom :: forall x. SessionKeysAbpV1_0_x -> Rep SessionKeysAbpV1_0_x x
Prelude.Generic)

-- |
-- Create a value of 'SessionKeysAbpV1_0_x' 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:
--
-- 'appSKey', 'sessionKeysAbpV1_0_x_appSKey' - The AppSKey value.
--
-- 'nwkSKey', 'sessionKeysAbpV1_0_x_nwkSKey' - The NwkSKey value.
newSessionKeysAbpV1_0_x ::
  SessionKeysAbpV1_0_x
newSessionKeysAbpV1_0_x :: SessionKeysAbpV1_0_x
newSessionKeysAbpV1_0_x =
  SessionKeysAbpV1_0_x'
    { $sel:appSKey:SessionKeysAbpV1_0_x' :: Maybe Text
appSKey = forall a. Maybe a
Prelude.Nothing,
      $sel:nwkSKey:SessionKeysAbpV1_0_x' :: Maybe Text
nwkSKey = forall a. Maybe a
Prelude.Nothing
    }

-- | The AppSKey value.
sessionKeysAbpV1_0_x_appSKey :: Lens.Lens' SessionKeysAbpV1_0_x (Prelude.Maybe Prelude.Text)
sessionKeysAbpV1_0_x_appSKey :: Lens' SessionKeysAbpV1_0_x (Maybe Text)
sessionKeysAbpV1_0_x_appSKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionKeysAbpV1_0_x' {Maybe Text
appSKey :: Maybe Text
$sel:appSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
appSKey} -> Maybe Text
appSKey) (\s :: SessionKeysAbpV1_0_x
s@SessionKeysAbpV1_0_x' {} Maybe Text
a -> SessionKeysAbpV1_0_x
s {$sel:appSKey:SessionKeysAbpV1_0_x' :: Maybe Text
appSKey = Maybe Text
a} :: SessionKeysAbpV1_0_x)

-- | The NwkSKey value.
sessionKeysAbpV1_0_x_nwkSKey :: Lens.Lens' SessionKeysAbpV1_0_x (Prelude.Maybe Prelude.Text)
sessionKeysAbpV1_0_x_nwkSKey :: Lens' SessionKeysAbpV1_0_x (Maybe Text)
sessionKeysAbpV1_0_x_nwkSKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionKeysAbpV1_0_x' {Maybe Text
nwkSKey :: Maybe Text
$sel:nwkSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
nwkSKey} -> Maybe Text
nwkSKey) (\s :: SessionKeysAbpV1_0_x
s@SessionKeysAbpV1_0_x' {} Maybe Text
a -> SessionKeysAbpV1_0_x
s {$sel:nwkSKey:SessionKeysAbpV1_0_x' :: Maybe Text
nwkSKey = Maybe Text
a} :: SessionKeysAbpV1_0_x)

instance Data.FromJSON SessionKeysAbpV1_0_x where
  parseJSON :: Value -> Parser SessionKeysAbpV1_0_x
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SessionKeysAbpV1_0_x"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> SessionKeysAbpV1_0_x
SessionKeysAbpV1_0_x'
            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
"AppSKey")
            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
"NwkSKey")
      )

instance Prelude.Hashable SessionKeysAbpV1_0_x where
  hashWithSalt :: Int -> SessionKeysAbpV1_0_x -> Int
hashWithSalt Int
_salt SessionKeysAbpV1_0_x' {Maybe Text
nwkSKey :: Maybe Text
appSKey :: Maybe Text
$sel:nwkSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
$sel:appSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appSKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nwkSKey

instance Prelude.NFData SessionKeysAbpV1_0_x where
  rnf :: SessionKeysAbpV1_0_x -> ()
rnf SessionKeysAbpV1_0_x' {Maybe Text
nwkSKey :: Maybe Text
appSKey :: Maybe Text
$sel:nwkSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
$sel:appSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appSKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nwkSKey

instance Data.ToJSON SessionKeysAbpV1_0_x where
  toJSON :: SessionKeysAbpV1_0_x -> Value
toJSON SessionKeysAbpV1_0_x' {Maybe Text
nwkSKey :: Maybe Text
appSKey :: Maybe Text
$sel:nwkSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
$sel:appSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AppSKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
appSKey,
            (Key
"NwkSKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nwkSKey
          ]
      )