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

-- |
-- Create a value of 'SidewalkListDevice' 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', 'sidewalkListDevice_sidewalkManufacturingSn' - The Sidewalk manufacturing series number.
--
-- 'amazonId', 'sidewalkListDevice_amazonId' - The Sidewalk Amazon ID.
--
-- 'deviceCertificates', 'sidewalkListDevice_deviceCertificates' - The sidewalk device certificates for Ed25519 and P256r1.
--
-- 'sidewalkId', 'sidewalkListDevice_sidewalkId' - The sidewalk device identification.
newSidewalkListDevice ::
  SidewalkListDevice
newSidewalkListDevice :: SidewalkListDevice
newSidewalkListDevice =
  SidewalkListDevice' :: Maybe Text
-> Maybe Text
-> Maybe [CertificateList]
-> Maybe Text
-> SidewalkListDevice
SidewalkListDevice'
    { $sel:sidewalkManufacturingSn:SidewalkListDevice' :: Maybe Text
sidewalkManufacturingSn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amazonId:SidewalkListDevice' :: Maybe Text
amazonId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceCertificates:SidewalkListDevice' :: Maybe [CertificateList]
deviceCertificates = Maybe [CertificateList]
forall a. Maybe a
Prelude.Nothing,
      $sel:sidewalkId:SidewalkListDevice' :: Maybe Text
sidewalkId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The Sidewalk Amazon ID.
sidewalkListDevice_amazonId :: Lens.Lens' SidewalkListDevice (Prelude.Maybe Prelude.Text)
sidewalkListDevice_amazonId :: (Maybe Text -> f (Maybe Text))
-> SidewalkListDevice -> f SidewalkListDevice
sidewalkListDevice_amazonId = (SidewalkListDevice -> Maybe Text)
-> (SidewalkListDevice -> Maybe Text -> SidewalkListDevice)
-> Lens
     SidewalkListDevice SidewalkListDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkListDevice' {Maybe Text
amazonId :: Maybe Text
$sel:amazonId:SidewalkListDevice' :: SidewalkListDevice -> Maybe Text
amazonId} -> Maybe Text
amazonId) (\s :: SidewalkListDevice
s@SidewalkListDevice' {} Maybe Text
a -> SidewalkListDevice
s {$sel:amazonId:SidewalkListDevice' :: Maybe Text
amazonId = Maybe Text
a} :: SidewalkListDevice)

-- | The sidewalk device certificates for Ed25519 and P256r1.
sidewalkListDevice_deviceCertificates :: Lens.Lens' SidewalkListDevice (Prelude.Maybe [CertificateList])
sidewalkListDevice_deviceCertificates :: (Maybe [CertificateList] -> f (Maybe [CertificateList]))
-> SidewalkListDevice -> f SidewalkListDevice
sidewalkListDevice_deviceCertificates = (SidewalkListDevice -> Maybe [CertificateList])
-> (SidewalkListDevice
    -> Maybe [CertificateList] -> SidewalkListDevice)
-> Lens
     SidewalkListDevice
     SidewalkListDevice
     (Maybe [CertificateList])
     (Maybe [CertificateList])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkListDevice' {Maybe [CertificateList]
deviceCertificates :: Maybe [CertificateList]
$sel:deviceCertificates:SidewalkListDevice' :: SidewalkListDevice -> Maybe [CertificateList]
deviceCertificates} -> Maybe [CertificateList]
deviceCertificates) (\s :: SidewalkListDevice
s@SidewalkListDevice' {} Maybe [CertificateList]
a -> SidewalkListDevice
s {$sel:deviceCertificates:SidewalkListDevice' :: Maybe [CertificateList]
deviceCertificates = Maybe [CertificateList]
a} :: SidewalkListDevice) ((Maybe [CertificateList] -> f (Maybe [CertificateList]))
 -> SidewalkListDevice -> f SidewalkListDevice)
-> ((Maybe [CertificateList] -> f (Maybe [CertificateList]))
    -> Maybe [CertificateList] -> f (Maybe [CertificateList]))
-> (Maybe [CertificateList] -> f (Maybe [CertificateList]))
-> SidewalkListDevice
-> f SidewalkListDevice
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.
sidewalkListDevice_sidewalkId :: Lens.Lens' SidewalkListDevice (Prelude.Maybe Prelude.Text)
sidewalkListDevice_sidewalkId :: (Maybe Text -> f (Maybe Text))
-> SidewalkListDevice -> f SidewalkListDevice
sidewalkListDevice_sidewalkId = (SidewalkListDevice -> Maybe Text)
-> (SidewalkListDevice -> Maybe Text -> SidewalkListDevice)
-> Lens
     SidewalkListDevice SidewalkListDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkListDevice' {Maybe Text
sidewalkId :: Maybe Text
$sel:sidewalkId:SidewalkListDevice' :: SidewalkListDevice -> Maybe Text
sidewalkId} -> Maybe Text
sidewalkId) (\s :: SidewalkListDevice
s@SidewalkListDevice' {} Maybe Text
a -> SidewalkListDevice
s {$sel:sidewalkId:SidewalkListDevice' :: Maybe Text
sidewalkId = Maybe Text
a} :: SidewalkListDevice)

instance Core.FromJSON SidewalkListDevice where
  parseJSON :: Value -> Parser SidewalkListDevice
parseJSON =
    String
-> (Object -> Parser SidewalkListDevice)
-> Value
-> Parser SidewalkListDevice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SidewalkListDevice"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [CertificateList]
-> Maybe Text
-> SidewalkListDevice
SidewalkListDevice'
            (Maybe Text
 -> Maybe Text
 -> Maybe [CertificateList]
 -> Maybe Text
 -> SidewalkListDevice)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [CertificateList] -> Maybe Text -> SidewalkListDevice)
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 -> SidewalkListDevice)
-> Parser (Maybe Text)
-> Parser
     (Maybe [CertificateList] -> Maybe Text -> SidewalkListDevice)
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 -> SidewalkListDevice)
-> Parser (Maybe [CertificateList])
-> Parser (Maybe Text -> SidewalkListDevice)
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 -> SidewalkListDevice)
-> Parser (Maybe Text) -> Parser SidewalkListDevice
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 SidewalkListDevice

instance Prelude.NFData SidewalkListDevice