{-# 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.IoT.Types.ThingTypeDefinition
-- 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.IoT.Types.ThingTypeDefinition where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.ThingTypeMetadata
import Amazonka.IoT.Types.ThingTypeProperties
import qualified Amazonka.Prelude as Prelude

-- | The definition of the thing type, including thing type name and
-- description.
--
-- /See:/ 'newThingTypeDefinition' smart constructor.
data ThingTypeDefinition = ThingTypeDefinition'
  { -- | The thing type ARN.
    ThingTypeDefinition -> Maybe Text
thingTypeArn :: Prelude.Maybe Prelude.Text,
    -- | The ThingTypeMetadata contains additional information about the thing
    -- type including: creation date and time, a value indicating whether the
    -- thing type is deprecated, and a date and time when it was deprecated.
    ThingTypeDefinition -> Maybe ThingTypeMetadata
thingTypeMetadata :: Prelude.Maybe ThingTypeMetadata,
    -- | The name of the thing type.
    ThingTypeDefinition -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text,
    -- | The ThingTypeProperties for the thing type.
    ThingTypeDefinition -> Maybe ThingTypeProperties
thingTypeProperties :: Prelude.Maybe ThingTypeProperties
  }
  deriving (ThingTypeDefinition -> ThingTypeDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThingTypeDefinition -> ThingTypeDefinition -> Bool
$c/= :: ThingTypeDefinition -> ThingTypeDefinition -> Bool
== :: ThingTypeDefinition -> ThingTypeDefinition -> Bool
$c== :: ThingTypeDefinition -> ThingTypeDefinition -> Bool
Prelude.Eq, ReadPrec [ThingTypeDefinition]
ReadPrec ThingTypeDefinition
Int -> ReadS ThingTypeDefinition
ReadS [ThingTypeDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThingTypeDefinition]
$creadListPrec :: ReadPrec [ThingTypeDefinition]
readPrec :: ReadPrec ThingTypeDefinition
$creadPrec :: ReadPrec ThingTypeDefinition
readList :: ReadS [ThingTypeDefinition]
$creadList :: ReadS [ThingTypeDefinition]
readsPrec :: Int -> ReadS ThingTypeDefinition
$creadsPrec :: Int -> ReadS ThingTypeDefinition
Prelude.Read, Int -> ThingTypeDefinition -> ShowS
[ThingTypeDefinition] -> ShowS
ThingTypeDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThingTypeDefinition] -> ShowS
$cshowList :: [ThingTypeDefinition] -> ShowS
show :: ThingTypeDefinition -> String
$cshow :: ThingTypeDefinition -> String
showsPrec :: Int -> ThingTypeDefinition -> ShowS
$cshowsPrec :: Int -> ThingTypeDefinition -> ShowS
Prelude.Show, forall x. Rep ThingTypeDefinition x -> ThingTypeDefinition
forall x. ThingTypeDefinition -> Rep ThingTypeDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThingTypeDefinition x -> ThingTypeDefinition
$cfrom :: forall x. ThingTypeDefinition -> Rep ThingTypeDefinition x
Prelude.Generic)

-- |
-- Create a value of 'ThingTypeDefinition' 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:
--
-- 'thingTypeArn', 'thingTypeDefinition_thingTypeArn' - The thing type ARN.
--
-- 'thingTypeMetadata', 'thingTypeDefinition_thingTypeMetadata' - The ThingTypeMetadata contains additional information about the thing
-- type including: creation date and time, a value indicating whether the
-- thing type is deprecated, and a date and time when it was deprecated.
--
-- 'thingTypeName', 'thingTypeDefinition_thingTypeName' - The name of the thing type.
--
-- 'thingTypeProperties', 'thingTypeDefinition_thingTypeProperties' - The ThingTypeProperties for the thing type.
newThingTypeDefinition ::
  ThingTypeDefinition
newThingTypeDefinition :: ThingTypeDefinition
newThingTypeDefinition =
  ThingTypeDefinition'
    { $sel:thingTypeArn:ThingTypeDefinition' :: Maybe Text
thingTypeArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:thingTypeMetadata:ThingTypeDefinition' :: Maybe ThingTypeMetadata
thingTypeMetadata = forall a. Maybe a
Prelude.Nothing,
      $sel:thingTypeName:ThingTypeDefinition' :: Maybe Text
thingTypeName = forall a. Maybe a
Prelude.Nothing,
      $sel:thingTypeProperties:ThingTypeDefinition' :: Maybe ThingTypeProperties
thingTypeProperties = forall a. Maybe a
Prelude.Nothing
    }

-- | The thing type ARN.
thingTypeDefinition_thingTypeArn :: Lens.Lens' ThingTypeDefinition (Prelude.Maybe Prelude.Text)
thingTypeDefinition_thingTypeArn :: Lens' ThingTypeDefinition (Maybe Text)
thingTypeDefinition_thingTypeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingTypeDefinition' {Maybe Text
thingTypeArn :: Maybe Text
$sel:thingTypeArn:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe Text
thingTypeArn} -> Maybe Text
thingTypeArn) (\s :: ThingTypeDefinition
s@ThingTypeDefinition' {} Maybe Text
a -> ThingTypeDefinition
s {$sel:thingTypeArn:ThingTypeDefinition' :: Maybe Text
thingTypeArn = Maybe Text
a} :: ThingTypeDefinition)

-- | The ThingTypeMetadata contains additional information about the thing
-- type including: creation date and time, a value indicating whether the
-- thing type is deprecated, and a date and time when it was deprecated.
thingTypeDefinition_thingTypeMetadata :: Lens.Lens' ThingTypeDefinition (Prelude.Maybe ThingTypeMetadata)
thingTypeDefinition_thingTypeMetadata :: Lens' ThingTypeDefinition (Maybe ThingTypeMetadata)
thingTypeDefinition_thingTypeMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingTypeDefinition' {Maybe ThingTypeMetadata
thingTypeMetadata :: Maybe ThingTypeMetadata
$sel:thingTypeMetadata:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe ThingTypeMetadata
thingTypeMetadata} -> Maybe ThingTypeMetadata
thingTypeMetadata) (\s :: ThingTypeDefinition
s@ThingTypeDefinition' {} Maybe ThingTypeMetadata
a -> ThingTypeDefinition
s {$sel:thingTypeMetadata:ThingTypeDefinition' :: Maybe ThingTypeMetadata
thingTypeMetadata = Maybe ThingTypeMetadata
a} :: ThingTypeDefinition)

-- | The name of the thing type.
thingTypeDefinition_thingTypeName :: Lens.Lens' ThingTypeDefinition (Prelude.Maybe Prelude.Text)
thingTypeDefinition_thingTypeName :: Lens' ThingTypeDefinition (Maybe Text)
thingTypeDefinition_thingTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingTypeDefinition' {Maybe Text
thingTypeName :: Maybe Text
$sel:thingTypeName:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe Text
thingTypeName} -> Maybe Text
thingTypeName) (\s :: ThingTypeDefinition
s@ThingTypeDefinition' {} Maybe Text
a -> ThingTypeDefinition
s {$sel:thingTypeName:ThingTypeDefinition' :: Maybe Text
thingTypeName = Maybe Text
a} :: ThingTypeDefinition)

-- | The ThingTypeProperties for the thing type.
thingTypeDefinition_thingTypeProperties :: Lens.Lens' ThingTypeDefinition (Prelude.Maybe ThingTypeProperties)
thingTypeDefinition_thingTypeProperties :: Lens' ThingTypeDefinition (Maybe ThingTypeProperties)
thingTypeDefinition_thingTypeProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingTypeDefinition' {Maybe ThingTypeProperties
thingTypeProperties :: Maybe ThingTypeProperties
$sel:thingTypeProperties:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe ThingTypeProperties
thingTypeProperties} -> Maybe ThingTypeProperties
thingTypeProperties) (\s :: ThingTypeDefinition
s@ThingTypeDefinition' {} Maybe ThingTypeProperties
a -> ThingTypeDefinition
s {$sel:thingTypeProperties:ThingTypeDefinition' :: Maybe ThingTypeProperties
thingTypeProperties = Maybe ThingTypeProperties
a} :: ThingTypeDefinition)

instance Data.FromJSON ThingTypeDefinition where
  parseJSON :: Value -> Parser ThingTypeDefinition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ThingTypeDefinition"
      ( \Object
x ->
          Maybe Text
-> Maybe ThingTypeMetadata
-> Maybe Text
-> Maybe ThingTypeProperties
-> ThingTypeDefinition
ThingTypeDefinition'
            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
"thingTypeArn")
            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
"thingTypeMetadata")
            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
"thingTypeName")
            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
"thingTypeProperties")
      )

instance Prelude.Hashable ThingTypeDefinition where
  hashWithSalt :: Int -> ThingTypeDefinition -> Int
hashWithSalt Int
_salt ThingTypeDefinition' {Maybe Text
Maybe ThingTypeMetadata
Maybe ThingTypeProperties
thingTypeProperties :: Maybe ThingTypeProperties
thingTypeName :: Maybe Text
thingTypeMetadata :: Maybe ThingTypeMetadata
thingTypeArn :: Maybe Text
$sel:thingTypeProperties:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe ThingTypeProperties
$sel:thingTypeName:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe Text
$sel:thingTypeMetadata:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe ThingTypeMetadata
$sel:thingTypeArn:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingTypeArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThingTypeMetadata
thingTypeMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThingTypeProperties
thingTypeProperties

instance Prelude.NFData ThingTypeDefinition where
  rnf :: ThingTypeDefinition -> ()
rnf ThingTypeDefinition' {Maybe Text
Maybe ThingTypeMetadata
Maybe ThingTypeProperties
thingTypeProperties :: Maybe ThingTypeProperties
thingTypeName :: Maybe Text
thingTypeMetadata :: Maybe ThingTypeMetadata
thingTypeArn :: Maybe Text
$sel:thingTypeProperties:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe ThingTypeProperties
$sel:thingTypeName:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe Text
$sel:thingTypeMetadata:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe ThingTypeMetadata
$sel:thingTypeArn:ThingTypeDefinition' :: ThingTypeDefinition -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingTypeArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThingTypeMetadata
thingTypeMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThingTypeProperties
thingTypeProperties