{-# 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.IotTwinMaker.Types.PropertyGroupResponse
-- 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.IotTwinMaker.Types.PropertyGroupResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.GroupType
import qualified Amazonka.Prelude as Prelude

-- | The property group response
--
-- /See:/ 'newPropertyGroupResponse' smart constructor.
data PropertyGroupResponse = PropertyGroupResponse'
  { -- | The group types.
    PropertyGroupResponse -> GroupType
groupType :: GroupType,
    -- | The names of properties.
    PropertyGroupResponse -> [Text]
propertyNames :: [Prelude.Text],
    -- | A Boolean value that specifies whether the property group is inherited
    -- from a parent entity
    PropertyGroupResponse -> Bool
isInherited :: Prelude.Bool
  }
  deriving (PropertyGroupResponse -> PropertyGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PropertyGroupResponse -> PropertyGroupResponse -> Bool
$c/= :: PropertyGroupResponse -> PropertyGroupResponse -> Bool
== :: PropertyGroupResponse -> PropertyGroupResponse -> Bool
$c== :: PropertyGroupResponse -> PropertyGroupResponse -> Bool
Prelude.Eq, ReadPrec [PropertyGroupResponse]
ReadPrec PropertyGroupResponse
Int -> ReadS PropertyGroupResponse
ReadS [PropertyGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PropertyGroupResponse]
$creadListPrec :: ReadPrec [PropertyGroupResponse]
readPrec :: ReadPrec PropertyGroupResponse
$creadPrec :: ReadPrec PropertyGroupResponse
readList :: ReadS [PropertyGroupResponse]
$creadList :: ReadS [PropertyGroupResponse]
readsPrec :: Int -> ReadS PropertyGroupResponse
$creadsPrec :: Int -> ReadS PropertyGroupResponse
Prelude.Read, Int -> PropertyGroupResponse -> ShowS
[PropertyGroupResponse] -> ShowS
PropertyGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PropertyGroupResponse] -> ShowS
$cshowList :: [PropertyGroupResponse] -> ShowS
show :: PropertyGroupResponse -> String
$cshow :: PropertyGroupResponse -> String
showsPrec :: Int -> PropertyGroupResponse -> ShowS
$cshowsPrec :: Int -> PropertyGroupResponse -> ShowS
Prelude.Show, forall x. Rep PropertyGroupResponse x -> PropertyGroupResponse
forall x. PropertyGroupResponse -> Rep PropertyGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PropertyGroupResponse x -> PropertyGroupResponse
$cfrom :: forall x. PropertyGroupResponse -> Rep PropertyGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'PropertyGroupResponse' 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:
--
-- 'groupType', 'propertyGroupResponse_groupType' - The group types.
--
-- 'propertyNames', 'propertyGroupResponse_propertyNames' - The names of properties.
--
-- 'isInherited', 'propertyGroupResponse_isInherited' - A Boolean value that specifies whether the property group is inherited
-- from a parent entity
newPropertyGroupResponse ::
  -- | 'groupType'
  GroupType ->
  -- | 'isInherited'
  Prelude.Bool ->
  PropertyGroupResponse
newPropertyGroupResponse :: GroupType -> Bool -> PropertyGroupResponse
newPropertyGroupResponse GroupType
pGroupType_ Bool
pIsInherited_ =
  PropertyGroupResponse'
    { $sel:groupType:PropertyGroupResponse' :: GroupType
groupType = GroupType
pGroupType_,
      $sel:propertyNames:PropertyGroupResponse' :: [Text]
propertyNames = forall a. Monoid a => a
Prelude.mempty,
      $sel:isInherited:PropertyGroupResponse' :: Bool
isInherited = Bool
pIsInherited_
    }

-- | The group types.
propertyGroupResponse_groupType :: Lens.Lens' PropertyGroupResponse GroupType
propertyGroupResponse_groupType :: Lens' PropertyGroupResponse GroupType
propertyGroupResponse_groupType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyGroupResponse' {GroupType
groupType :: GroupType
$sel:groupType:PropertyGroupResponse' :: PropertyGroupResponse -> GroupType
groupType} -> GroupType
groupType) (\s :: PropertyGroupResponse
s@PropertyGroupResponse' {} GroupType
a -> PropertyGroupResponse
s {$sel:groupType:PropertyGroupResponse' :: GroupType
groupType = GroupType
a} :: PropertyGroupResponse)

-- | The names of properties.
propertyGroupResponse_propertyNames :: Lens.Lens' PropertyGroupResponse [Prelude.Text]
propertyGroupResponse_propertyNames :: Lens' PropertyGroupResponse [Text]
propertyGroupResponse_propertyNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyGroupResponse' {[Text]
propertyNames :: [Text]
$sel:propertyNames:PropertyGroupResponse' :: PropertyGroupResponse -> [Text]
propertyNames} -> [Text]
propertyNames) (\s :: PropertyGroupResponse
s@PropertyGroupResponse' {} [Text]
a -> PropertyGroupResponse
s {$sel:propertyNames:PropertyGroupResponse' :: [Text]
propertyNames = [Text]
a} :: PropertyGroupResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A Boolean value that specifies whether the property group is inherited
-- from a parent entity
propertyGroupResponse_isInherited :: Lens.Lens' PropertyGroupResponse Prelude.Bool
propertyGroupResponse_isInherited :: Lens' PropertyGroupResponse Bool
propertyGroupResponse_isInherited = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyGroupResponse' {Bool
isInherited :: Bool
$sel:isInherited:PropertyGroupResponse' :: PropertyGroupResponse -> Bool
isInherited} -> Bool
isInherited) (\s :: PropertyGroupResponse
s@PropertyGroupResponse' {} Bool
a -> PropertyGroupResponse
s {$sel:isInherited:PropertyGroupResponse' :: Bool
isInherited = Bool
a} :: PropertyGroupResponse)

instance Data.FromJSON PropertyGroupResponse where
  parseJSON :: Value -> Parser PropertyGroupResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PropertyGroupResponse"
      ( \Object
x ->
          GroupType -> [Text] -> Bool -> PropertyGroupResponse
PropertyGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"groupType")
            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
"propertyNames" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"isInherited")
      )

instance Prelude.Hashable PropertyGroupResponse where
  hashWithSalt :: Int -> PropertyGroupResponse -> Int
hashWithSalt Int
_salt PropertyGroupResponse' {Bool
[Text]
GroupType
isInherited :: Bool
propertyNames :: [Text]
groupType :: GroupType
$sel:isInherited:PropertyGroupResponse' :: PropertyGroupResponse -> Bool
$sel:propertyNames:PropertyGroupResponse' :: PropertyGroupResponse -> [Text]
$sel:groupType:PropertyGroupResponse' :: PropertyGroupResponse -> GroupType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GroupType
groupType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
propertyNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
isInherited

instance Prelude.NFData PropertyGroupResponse where
  rnf :: PropertyGroupResponse -> ()
rnf PropertyGroupResponse' {Bool
[Text]
GroupType
isInherited :: Bool
propertyNames :: [Text]
groupType :: GroupType
$sel:isInherited:PropertyGroupResponse' :: PropertyGroupResponse -> Bool
$sel:propertyNames:PropertyGroupResponse' :: PropertyGroupResponse -> [Text]
$sel:groupType:PropertyGroupResponse' :: PropertyGroupResponse -> GroupType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf GroupType
groupType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
propertyNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
isInherited