{-# 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.IoTSiteWise.Types.JobConfiguration
-- 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.IoTSiteWise.Types.JobConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.FileFormat
import qualified Amazonka.Prelude as Prelude

-- | Contains the configuration information of a job, such as the file format
-- used to save data in Amazon S3.
--
-- /See:/ 'newJobConfiguration' smart constructor.
data JobConfiguration = JobConfiguration'
  { -- | The file format of the data in Amazon S3.
    JobConfiguration -> FileFormat
fileFormat :: FileFormat
  }
  deriving (JobConfiguration -> JobConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobConfiguration -> JobConfiguration -> Bool
$c/= :: JobConfiguration -> JobConfiguration -> Bool
== :: JobConfiguration -> JobConfiguration -> Bool
$c== :: JobConfiguration -> JobConfiguration -> Bool
Prelude.Eq, ReadPrec [JobConfiguration]
ReadPrec JobConfiguration
Int -> ReadS JobConfiguration
ReadS [JobConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobConfiguration]
$creadListPrec :: ReadPrec [JobConfiguration]
readPrec :: ReadPrec JobConfiguration
$creadPrec :: ReadPrec JobConfiguration
readList :: ReadS [JobConfiguration]
$creadList :: ReadS [JobConfiguration]
readsPrec :: Int -> ReadS JobConfiguration
$creadsPrec :: Int -> ReadS JobConfiguration
Prelude.Read, Int -> JobConfiguration -> ShowS
[JobConfiguration] -> ShowS
JobConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobConfiguration] -> ShowS
$cshowList :: [JobConfiguration] -> ShowS
show :: JobConfiguration -> String
$cshow :: JobConfiguration -> String
showsPrec :: Int -> JobConfiguration -> ShowS
$cshowsPrec :: Int -> JobConfiguration -> ShowS
Prelude.Show, forall x. Rep JobConfiguration x -> JobConfiguration
forall x. JobConfiguration -> Rep JobConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobConfiguration x -> JobConfiguration
$cfrom :: forall x. JobConfiguration -> Rep JobConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'JobConfiguration' 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:
--
-- 'fileFormat', 'jobConfiguration_fileFormat' - The file format of the data in Amazon S3.
newJobConfiguration ::
  -- | 'fileFormat'
  FileFormat ->
  JobConfiguration
newJobConfiguration :: FileFormat -> JobConfiguration
newJobConfiguration FileFormat
pFileFormat_ =
  JobConfiguration' {$sel:fileFormat:JobConfiguration' :: FileFormat
fileFormat = FileFormat
pFileFormat_}

-- | The file format of the data in Amazon S3.
jobConfiguration_fileFormat :: Lens.Lens' JobConfiguration FileFormat
jobConfiguration_fileFormat :: Lens' JobConfiguration FileFormat
jobConfiguration_fileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobConfiguration' {FileFormat
fileFormat :: FileFormat
$sel:fileFormat:JobConfiguration' :: JobConfiguration -> FileFormat
fileFormat} -> FileFormat
fileFormat) (\s :: JobConfiguration
s@JobConfiguration' {} FileFormat
a -> JobConfiguration
s {$sel:fileFormat:JobConfiguration' :: FileFormat
fileFormat = FileFormat
a} :: JobConfiguration)

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

instance Prelude.Hashable JobConfiguration where
  hashWithSalt :: Int -> JobConfiguration -> Int
hashWithSalt Int
_salt JobConfiguration' {FileFormat
fileFormat :: FileFormat
$sel:fileFormat:JobConfiguration' :: JobConfiguration -> FileFormat
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FileFormat
fileFormat

instance Prelude.NFData JobConfiguration where
  rnf :: JobConfiguration -> ()
rnf JobConfiguration' {FileFormat
fileFormat :: FileFormat
$sel:fileFormat:JobConfiguration' :: JobConfiguration -> FileFormat
..} = forall a. NFData a => a -> ()
Prelude.rnf FileFormat
fileFormat

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