{-# 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.InputFileConfig
-- 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.InputFileConfig where

import Amazonka.Braket.Types.DataSource
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

-- | A list of parameters that specify the input channels, type of input
-- data, and where it is located.
--
-- /See:/ 'newInputFileConfig' smart constructor.
data InputFileConfig = InputFileConfig'
  { -- | The MIME type of the data.
    InputFileConfig -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
    -- | A named input source that an Amazon Braket job can consume.
    InputFileConfig -> Text
channelName :: Prelude.Text,
    -- | The location of the channel data.
    InputFileConfig -> DataSource
dataSource :: DataSource
  }
  deriving (InputFileConfig -> InputFileConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputFileConfig -> InputFileConfig -> Bool
$c/= :: InputFileConfig -> InputFileConfig -> Bool
== :: InputFileConfig -> InputFileConfig -> Bool
$c== :: InputFileConfig -> InputFileConfig -> Bool
Prelude.Eq, ReadPrec [InputFileConfig]
ReadPrec InputFileConfig
Int -> ReadS InputFileConfig
ReadS [InputFileConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputFileConfig]
$creadListPrec :: ReadPrec [InputFileConfig]
readPrec :: ReadPrec InputFileConfig
$creadPrec :: ReadPrec InputFileConfig
readList :: ReadS [InputFileConfig]
$creadList :: ReadS [InputFileConfig]
readsPrec :: Int -> ReadS InputFileConfig
$creadsPrec :: Int -> ReadS InputFileConfig
Prelude.Read, Int -> InputFileConfig -> ShowS
[InputFileConfig] -> ShowS
InputFileConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputFileConfig] -> ShowS
$cshowList :: [InputFileConfig] -> ShowS
show :: InputFileConfig -> String
$cshow :: InputFileConfig -> String
showsPrec :: Int -> InputFileConfig -> ShowS
$cshowsPrec :: Int -> InputFileConfig -> ShowS
Prelude.Show, forall x. Rep InputFileConfig x -> InputFileConfig
forall x. InputFileConfig -> Rep InputFileConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputFileConfig x -> InputFileConfig
$cfrom :: forall x. InputFileConfig -> Rep InputFileConfig x
Prelude.Generic)

-- |
-- Create a value of 'InputFileConfig' 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:
--
-- 'contentType', 'inputFileConfig_contentType' - The MIME type of the data.
--
-- 'channelName', 'inputFileConfig_channelName' - A named input source that an Amazon Braket job can consume.
--
-- 'dataSource', 'inputFileConfig_dataSource' - The location of the channel data.
newInputFileConfig ::
  -- | 'channelName'
  Prelude.Text ->
  -- | 'dataSource'
  DataSource ->
  InputFileConfig
newInputFileConfig :: Text -> DataSource -> InputFileConfig
newInputFileConfig Text
pChannelName_ DataSource
pDataSource_ =
  InputFileConfig'
    { $sel:contentType:InputFileConfig' :: Maybe Text
contentType = forall a. Maybe a
Prelude.Nothing,
      $sel:channelName:InputFileConfig' :: Text
channelName = Text
pChannelName_,
      $sel:dataSource:InputFileConfig' :: DataSource
dataSource = DataSource
pDataSource_
    }

-- | The MIME type of the data.
inputFileConfig_contentType :: Lens.Lens' InputFileConfig (Prelude.Maybe Prelude.Text)
inputFileConfig_contentType :: Lens' InputFileConfig (Maybe Text)
inputFileConfig_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputFileConfig' {Maybe Text
contentType :: Maybe Text
$sel:contentType:InputFileConfig' :: InputFileConfig -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: InputFileConfig
s@InputFileConfig' {} Maybe Text
a -> InputFileConfig
s {$sel:contentType:InputFileConfig' :: Maybe Text
contentType = Maybe Text
a} :: InputFileConfig)

-- | A named input source that an Amazon Braket job can consume.
inputFileConfig_channelName :: Lens.Lens' InputFileConfig Prelude.Text
inputFileConfig_channelName :: Lens' InputFileConfig Text
inputFileConfig_channelName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputFileConfig' {Text
channelName :: Text
$sel:channelName:InputFileConfig' :: InputFileConfig -> Text
channelName} -> Text
channelName) (\s :: InputFileConfig
s@InputFileConfig' {} Text
a -> InputFileConfig
s {$sel:channelName:InputFileConfig' :: Text
channelName = Text
a} :: InputFileConfig)

-- | The location of the channel data.
inputFileConfig_dataSource :: Lens.Lens' InputFileConfig DataSource
inputFileConfig_dataSource :: Lens' InputFileConfig DataSource
inputFileConfig_dataSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputFileConfig' {DataSource
dataSource :: DataSource
$sel:dataSource:InputFileConfig' :: InputFileConfig -> DataSource
dataSource} -> DataSource
dataSource) (\s :: InputFileConfig
s@InputFileConfig' {} DataSource
a -> InputFileConfig
s {$sel:dataSource:InputFileConfig' :: DataSource
dataSource = DataSource
a} :: InputFileConfig)

instance Data.FromJSON InputFileConfig where
  parseJSON :: Value -> Parser InputFileConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputFileConfig"
      ( \Object
x ->
          Maybe Text -> Text -> DataSource -> InputFileConfig
InputFileConfig'
            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
"contentType")
            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
"channelName")
            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
"dataSource")
      )

instance Prelude.Hashable InputFileConfig where
  hashWithSalt :: Int -> InputFileConfig -> Int
hashWithSalt Int
_salt InputFileConfig' {Maybe Text
Text
DataSource
dataSource :: DataSource
channelName :: Text
contentType :: Maybe Text
$sel:dataSource:InputFileConfig' :: InputFileConfig -> DataSource
$sel:channelName:InputFileConfig' :: InputFileConfig -> Text
$sel:contentType:InputFileConfig' :: InputFileConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataSource
dataSource

instance Prelude.NFData InputFileConfig where
  rnf :: InputFileConfig -> ()
rnf InputFileConfig' {Maybe Text
Text
DataSource
dataSource :: DataSource
channelName :: Text
contentType :: Maybe Text
$sel:dataSource:InputFileConfig' :: InputFileConfig -> DataSource
$sel:channelName:InputFileConfig' :: InputFileConfig -> Text
$sel:contentType:InputFileConfig' :: InputFileConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
channelName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataSource
dataSource

instance Data.ToJSON InputFileConfig where
  toJSON :: InputFileConfig -> Value
toJSON InputFileConfig' {Maybe Text
Text
DataSource
dataSource :: DataSource
channelName :: Text
contentType :: Maybe Text
$sel:dataSource:InputFileConfig' :: InputFileConfig -> DataSource
$sel:channelName:InputFileConfig' :: InputFileConfig -> Text
$sel:contentType:InputFileConfig' :: InputFileConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"contentType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
contentType,
            forall a. a -> Maybe a
Prelude.Just (Key
"channelName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
channelName),
            forall a. a -> Maybe a
Prelude.Just (Key
"dataSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataSource
dataSource)
          ]
      )