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

import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.CertificateList
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Sidewalk device object.
--
-- /See:/ 'newSidewalkDevice' smart constructor.
data SidewalkDevice = SidewalkDevice'
  { -- | The Sidewalk manufacturing series number.
    SidewalkDevice -> Maybe Text
sidewalkManufacturingSn :: Prelude.Maybe Prelude.Text,
    SidewalkDevice -> Maybe Text
amazonId :: Prelude.Maybe Prelude.Text,
    -- | The sidewalk device certificates for Ed25519 and P256r1.
    SidewalkDevice -> Maybe [CertificateList]
deviceCertificates :: Prelude.Maybe [CertificateList],
    -- | The sidewalk device identification.
    SidewalkDevice -> Maybe Text
sidewalkId :: Prelude.Maybe Prelude.Text
  }
  deriving (SidewalkDevice -> SidewalkDevice -> Bool
(SidewalkDevice -> SidewalkDevice -> Bool)
-> (SidewalkDevice -> SidewalkDevice -> Bool) -> Eq SidewalkDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SidewalkDevice -> SidewalkDevice -> Bool
$c/= :: SidewalkDevice -> SidewalkDevice -> Bool
== :: SidewalkDevice -> SidewalkDevice -> Bool
$c== :: SidewalkDevice -> SidewalkDevice -> Bool
Prelude.Eq, ReadPrec [SidewalkDevice]
ReadPrec SidewalkDevice
Int -> ReadS SidewalkDevice
ReadS [SidewalkDevice]
(Int -> ReadS SidewalkDevice)
-> ReadS [SidewalkDevice]
-> ReadPrec SidewalkDevice
-> ReadPrec [SidewalkDevice]
-> Read SidewalkDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SidewalkDevice]
$creadListPrec :: ReadPrec [SidewalkDevice]
readPrec :: ReadPrec SidewalkDevice
$creadPrec :: ReadPrec SidewalkDevice
readList :: ReadS [SidewalkDevice]
$creadList :: ReadS [SidewalkDevice]
readsPrec :: Int -> ReadS SidewalkDevice
$creadsPrec :: Int -> ReadS SidewalkDevice
Prelude.Read, Int -> SidewalkDevice -> ShowS
[SidewalkDevice] -> ShowS
SidewalkDevice -> String
(Int -> SidewalkDevice -> ShowS)
-> (SidewalkDevice -> String)
-> ([SidewalkDevice] -> ShowS)
-> Show SidewalkDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SidewalkDevice] -> ShowS
$cshowList :: [SidewalkDevice] -> ShowS
show :: SidewalkDevice -> String
$cshow :: SidewalkDevice -> String
showsPrec :: Int -> SidewalkDevice -> ShowS
$cshowsPrec :: Int -> SidewalkDevice -> ShowS
Prelude.Show, (forall x. SidewalkDevice -> Rep SidewalkDevice x)
-> (forall x. Rep SidewalkDevice x -> SidewalkDevice)
-> Generic SidewalkDevice
forall x. Rep SidewalkDevice x -> SidewalkDevice
forall x. SidewalkDevice -> Rep SidewalkDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SidewalkDevice x -> SidewalkDevice
$cfrom :: forall x. SidewalkDevice -> Rep SidewalkDevice x
Prelude.Generic)

-- |
-- Create a value of 'SidewalkDevice' 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:
--
-- 'sidewalkManufacturingSn', 'sidewalkDevice_sidewalkManufacturingSn' - The Sidewalk manufacturing series number.
--
-- 'amazonId', 'sidewalkDevice_amazonId' - Undocumented member.
--
-- 'deviceCertificates', 'sidewalkDevice_deviceCertificates' - The sidewalk device certificates for Ed25519 and P256r1.
--
-- 'sidewalkId', 'sidewalkDevice_sidewalkId' - The sidewalk device identification.
newSidewalkDevice ::
  SidewalkDevice
newSidewalkDevice :: SidewalkDevice
newSidewalkDevice =
  SidewalkDevice' :: Maybe Text
-> Maybe Text
-> Maybe [CertificateList]
-> Maybe Text
-> SidewalkDevice
SidewalkDevice'
    { $sel:sidewalkManufacturingSn:SidewalkDevice' :: Maybe Text
sidewalkManufacturingSn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amazonId:SidewalkDevice' :: Maybe Text
amazonId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceCertificates:SidewalkDevice' :: Maybe [CertificateList]
deviceCertificates = Maybe [CertificateList]
forall a. Maybe a
Prelude.Nothing,
      $sel:sidewalkId:SidewalkDevice' :: Maybe Text
sidewalkId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Sidewalk manufacturing series number.
sidewalkDevice_sidewalkManufacturingSn :: Lens.Lens' SidewalkDevice (Prelude.Maybe Prelude.Text)
sidewalkDevice_sidewalkManufacturingSn :: (Maybe Text -> f (Maybe Text))
-> SidewalkDevice -> f SidewalkDevice
sidewalkDevice_sidewalkManufacturingSn = (SidewalkDevice -> Maybe Text)
-> (SidewalkDevice -> Maybe Text -> SidewalkDevice)
-> Lens SidewalkDevice SidewalkDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkDevice' {Maybe Text
sidewalkManufacturingSn :: Maybe Text
$sel:sidewalkManufacturingSn:SidewalkDevice' :: SidewalkDevice -> Maybe Text
sidewalkManufacturingSn} -> Maybe Text
sidewalkManufacturingSn) (\s :: SidewalkDevice
s@SidewalkDevice' {} Maybe Text
a -> SidewalkDevice
s {$sel:sidewalkManufacturingSn:SidewalkDevice' :: Maybe Text
sidewalkManufacturingSn = Maybe Text
a} :: SidewalkDevice)

-- | Undocumented member.
sidewalkDevice_amazonId :: Lens.Lens' SidewalkDevice (Prelude.Maybe Prelude.Text)
sidewalkDevice_amazonId :: (Maybe Text -> f (Maybe Text))
-> SidewalkDevice -> f SidewalkDevice
sidewalkDevice_amazonId = (SidewalkDevice -> Maybe Text)
-> (SidewalkDevice -> Maybe Text -> SidewalkDevice)
-> Lens SidewalkDevice SidewalkDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkDevice' {Maybe Text
amazonId :: Maybe Text
$sel:amazonId:SidewalkDevice' :: SidewalkDevice -> Maybe Text
amazonId} -> Maybe Text
amazonId) (\s :: SidewalkDevice
s@SidewalkDevice' {} Maybe Text
a -> SidewalkDevice
s {$sel:amazonId:SidewalkDevice' :: Maybe Text
amazonId = Maybe Text
a} :: SidewalkDevice)

-- | The sidewalk device certificates for Ed25519 and P256r1.
sidewalkDevice_deviceCertificates :: Lens.Lens' SidewalkDevice (Prelude.Maybe [CertificateList])
sidewalkDevice_deviceCertificates :: (Maybe [CertificateList] -> f (Maybe [CertificateList]))
-> SidewalkDevice -> f SidewalkDevice
sidewalkDevice_deviceCertificates = (SidewalkDevice -> Maybe [CertificateList])
-> (SidewalkDevice -> Maybe [CertificateList] -> SidewalkDevice)
-> Lens
     SidewalkDevice
     SidewalkDevice
     (Maybe [CertificateList])
     (Maybe [CertificateList])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkDevice' {Maybe [CertificateList]
deviceCertificates :: Maybe [CertificateList]
$sel:deviceCertificates:SidewalkDevice' :: SidewalkDevice -> Maybe [CertificateList]
deviceCertificates} -> Maybe [CertificateList]
deviceCertificates) (\s :: SidewalkDevice
s@SidewalkDevice' {} Maybe [CertificateList]
a -> SidewalkDevice
s {$sel:deviceCertificates:SidewalkDevice' :: Maybe [CertificateList]
deviceCertificates = Maybe [CertificateList]
a} :: SidewalkDevice) ((Maybe [CertificateList] -> f (Maybe [CertificateList]))
 -> SidewalkDevice -> f SidewalkDevice)
-> ((Maybe [CertificateList] -> f (Maybe [CertificateList]))
    -> Maybe [CertificateList] -> f (Maybe [CertificateList]))
-> (Maybe [CertificateList] -> f (Maybe [CertificateList]))
-> SidewalkDevice
-> f SidewalkDevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CertificateList]
  [CertificateList]
  [CertificateList]
  [CertificateList]
-> Iso
     (Maybe [CertificateList])
     (Maybe [CertificateList])
     (Maybe [CertificateList])
     (Maybe [CertificateList])
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 AnIso
  [CertificateList]
  [CertificateList]
  [CertificateList]
  [CertificateList]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The sidewalk device identification.
sidewalkDevice_sidewalkId :: Lens.Lens' SidewalkDevice (Prelude.Maybe Prelude.Text)
sidewalkDevice_sidewalkId :: (Maybe Text -> f (Maybe Text))
-> SidewalkDevice -> f SidewalkDevice
sidewalkDevice_sidewalkId = (SidewalkDevice -> Maybe Text)
-> (SidewalkDevice -> Maybe Text -> SidewalkDevice)
-> Lens SidewalkDevice SidewalkDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkDevice' {Maybe Text
sidewalkId :: Maybe Text
$sel:sidewalkId:SidewalkDevice' :: SidewalkDevice -> Maybe Text
sidewalkId} -> Maybe Text
sidewalkId) (\s :: SidewalkDevice
s@SidewalkDevice' {} Maybe Text
a -> SidewalkDevice
s {$sel:sidewalkId:SidewalkDevice' :: Maybe Text
sidewalkId = Maybe Text
a} :: SidewalkDevice)

instance Core.FromJSON SidewalkDevice where
  parseJSON :: Value -> Parser SidewalkDevice
parseJSON =
    String
-> (Object -> Parser SidewalkDevice)
-> Value
-> Parser SidewalkDevice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SidewalkDevice"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [CertificateList]
-> Maybe Text
-> SidewalkDevice
SidewalkDevice'
            (Maybe Text
 -> Maybe Text
 -> Maybe [CertificateList]
 -> Maybe Text
 -> SidewalkDevice)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [CertificateList] -> Maybe Text -> SidewalkDevice)
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
"SidewalkManufacturingSn")
            Parser
  (Maybe Text
   -> Maybe [CertificateList] -> Maybe Text -> SidewalkDevice)
-> Parser (Maybe Text)
-> Parser (Maybe [CertificateList] -> Maybe Text -> SidewalkDevice)
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
"AmazonId")
            Parser (Maybe [CertificateList] -> Maybe Text -> SidewalkDevice)
-> Parser (Maybe [CertificateList])
-> Parser (Maybe Text -> SidewalkDevice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [CertificateList]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeviceCertificates"
                            Parser (Maybe (Maybe [CertificateList]))
-> Maybe [CertificateList] -> Parser (Maybe [CertificateList])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CertificateList]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> SidewalkDevice)
-> Parser (Maybe Text) -> Parser SidewalkDevice
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
"SidewalkId")
      )

instance Prelude.Hashable SidewalkDevice

instance Prelude.NFData SidewalkDevice