{-# 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.Braket.Types.DeviceConfig
-- 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.Braket.Types.DeviceConfig 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

-- | Configures the quantum processing units (QPUs) or simulator used to
-- create and run an Amazon Braket job.
--
-- /See:/ 'newDeviceConfig' smart constructor.
data DeviceConfig = DeviceConfig'
  { -- | The primary quantum processing unit (QPU) or simulator used to create
    -- and run an Amazon Braket job.
    DeviceConfig -> Text
device :: Prelude.Text
  }
  deriving (DeviceConfig -> DeviceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceConfig -> DeviceConfig -> Bool
$c/= :: DeviceConfig -> DeviceConfig -> Bool
== :: DeviceConfig -> DeviceConfig -> Bool
$c== :: DeviceConfig -> DeviceConfig -> Bool
Prelude.Eq, ReadPrec [DeviceConfig]
ReadPrec DeviceConfig
Int -> ReadS DeviceConfig
ReadS [DeviceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceConfig]
$creadListPrec :: ReadPrec [DeviceConfig]
readPrec :: ReadPrec DeviceConfig
$creadPrec :: ReadPrec DeviceConfig
readList :: ReadS [DeviceConfig]
$creadList :: ReadS [DeviceConfig]
readsPrec :: Int -> ReadS DeviceConfig
$creadsPrec :: Int -> ReadS DeviceConfig
Prelude.Read, Int -> DeviceConfig -> ShowS
[DeviceConfig] -> ShowS
DeviceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceConfig] -> ShowS
$cshowList :: [DeviceConfig] -> ShowS
show :: DeviceConfig -> String
$cshow :: DeviceConfig -> String
showsPrec :: Int -> DeviceConfig -> ShowS
$cshowsPrec :: Int -> DeviceConfig -> ShowS
Prelude.Show, forall x. Rep DeviceConfig x -> DeviceConfig
forall x. DeviceConfig -> Rep DeviceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceConfig x -> DeviceConfig
$cfrom :: forall x. DeviceConfig -> Rep DeviceConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeviceConfig' 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:
--
-- 'device', 'deviceConfig_device' - The primary quantum processing unit (QPU) or simulator used to create
-- and run an Amazon Braket job.
newDeviceConfig ::
  -- | 'device'
  Prelude.Text ->
  DeviceConfig
newDeviceConfig :: Text -> DeviceConfig
newDeviceConfig Text
pDevice_ =
  DeviceConfig' {$sel:device:DeviceConfig' :: Text
device = Text
pDevice_}

-- | The primary quantum processing unit (QPU) or simulator used to create
-- and run an Amazon Braket job.
deviceConfig_device :: Lens.Lens' DeviceConfig Prelude.Text
deviceConfig_device :: Lens' DeviceConfig Text
deviceConfig_device = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceConfig' {Text
device :: Text
$sel:device:DeviceConfig' :: DeviceConfig -> Text
device} -> Text
device) (\s :: DeviceConfig
s@DeviceConfig' {} Text
a -> DeviceConfig
s {$sel:device:DeviceConfig' :: Text
device = Text
a} :: DeviceConfig)

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

instance Prelude.Hashable DeviceConfig where
  hashWithSalt :: Int -> DeviceConfig -> Int
hashWithSalt Int
_salt DeviceConfig' {Text
device :: Text
$sel:device:DeviceConfig' :: DeviceConfig -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
device

instance Prelude.NFData DeviceConfig where
  rnf :: DeviceConfig -> ()
rnf DeviceConfig' {Text
device :: Text
$sel:device:DeviceConfig' :: DeviceConfig -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
device

instance Data.ToJSON DeviceConfig where
  toJSON :: DeviceConfig -> Value
toJSON DeviceConfig' {Text
device :: Text
$sel:device:DeviceConfig' :: DeviceConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"device" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
device)]
      )