{-# 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.Omics.Types.ReadOptions
-- 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.Omics.Types.ReadOptions 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

-- | Read options for an annotation import job.
--
-- /See:/ 'newReadOptions' smart constructor.
data ReadOptions = ReadOptions'
  { -- | The file\'s comment character.
    ReadOptions -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | The file\'s encoding.
    ReadOptions -> Maybe Text
encoding :: Prelude.Maybe Prelude.Text,
    -- | A character for escaping quotes in the file.
    ReadOptions -> Maybe Text
escape :: Prelude.Maybe Prelude.Text,
    -- | Whether quotes need to be escaped in the file.
    ReadOptions -> Maybe Bool
escapeQuotes :: Prelude.Maybe Prelude.Bool,
    -- | Whether the file has a header row.
    ReadOptions -> Maybe Bool
header :: Prelude.Maybe Prelude.Bool,
    -- | A line separator for the file.
    ReadOptions -> Maybe Text
lineSep :: Prelude.Maybe Prelude.Text,
    -- | The file\'s quote character.
    ReadOptions -> Maybe Text
quote :: Prelude.Maybe Prelude.Text,
    -- | Whether all values need to be quoted, or just those that contain quotes.
    ReadOptions -> Maybe Bool
quoteAll :: Prelude.Maybe Prelude.Bool,
    -- | The file\'s field separator.
    ReadOptions -> Maybe Text
sep :: Prelude.Maybe Prelude.Text
  }
  deriving (ReadOptions -> ReadOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReadOptions -> ReadOptions -> Bool
$c/= :: ReadOptions -> ReadOptions -> Bool
== :: ReadOptions -> ReadOptions -> Bool
$c== :: ReadOptions -> ReadOptions -> Bool
Prelude.Eq, ReadPrec [ReadOptions]
ReadPrec ReadOptions
Int -> ReadS ReadOptions
ReadS [ReadOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReadOptions]
$creadListPrec :: ReadPrec [ReadOptions]
readPrec :: ReadPrec ReadOptions
$creadPrec :: ReadPrec ReadOptions
readList :: ReadS [ReadOptions]
$creadList :: ReadS [ReadOptions]
readsPrec :: Int -> ReadS ReadOptions
$creadsPrec :: Int -> ReadS ReadOptions
Prelude.Read, Int -> ReadOptions -> ShowS
[ReadOptions] -> ShowS
ReadOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReadOptions] -> ShowS
$cshowList :: [ReadOptions] -> ShowS
show :: ReadOptions -> String
$cshow :: ReadOptions -> String
showsPrec :: Int -> ReadOptions -> ShowS
$cshowsPrec :: Int -> ReadOptions -> ShowS
Prelude.Show, forall x. Rep ReadOptions x -> ReadOptions
forall x. ReadOptions -> Rep ReadOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReadOptions x -> ReadOptions
$cfrom :: forall x. ReadOptions -> Rep ReadOptions x
Prelude.Generic)

-- |
-- Create a value of 'ReadOptions' 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:
--
-- 'comment', 'readOptions_comment' - The file\'s comment character.
--
-- 'encoding', 'readOptions_encoding' - The file\'s encoding.
--
-- 'escape', 'readOptions_escape' - A character for escaping quotes in the file.
--
-- 'escapeQuotes', 'readOptions_escapeQuotes' - Whether quotes need to be escaped in the file.
--
-- 'header', 'readOptions_header' - Whether the file has a header row.
--
-- 'lineSep', 'readOptions_lineSep' - A line separator for the file.
--
-- 'quote', 'readOptions_quote' - The file\'s quote character.
--
-- 'quoteAll', 'readOptions_quoteAll' - Whether all values need to be quoted, or just those that contain quotes.
--
-- 'sep', 'readOptions_sep' - The file\'s field separator.
newReadOptions ::
  ReadOptions
newReadOptions :: ReadOptions
newReadOptions =
  ReadOptions'
    { $sel:comment:ReadOptions' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
      $sel:encoding:ReadOptions' :: Maybe Text
encoding = forall a. Maybe a
Prelude.Nothing,
      $sel:escape:ReadOptions' :: Maybe Text
escape = forall a. Maybe a
Prelude.Nothing,
      $sel:escapeQuotes:ReadOptions' :: Maybe Bool
escapeQuotes = forall a. Maybe a
Prelude.Nothing,
      $sel:header:ReadOptions' :: Maybe Bool
header = forall a. Maybe a
Prelude.Nothing,
      $sel:lineSep:ReadOptions' :: Maybe Text
lineSep = forall a. Maybe a
Prelude.Nothing,
      $sel:quote:ReadOptions' :: Maybe Text
quote = forall a. Maybe a
Prelude.Nothing,
      $sel:quoteAll:ReadOptions' :: Maybe Bool
quoteAll = forall a. Maybe a
Prelude.Nothing,
      $sel:sep:ReadOptions' :: Maybe Text
sep = forall a. Maybe a
Prelude.Nothing
    }

-- | The file\'s comment character.
readOptions_comment :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Text)
readOptions_comment :: Lens' ReadOptions (Maybe Text)
readOptions_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Text
comment :: Maybe Text
$sel:comment:ReadOptions' :: ReadOptions -> Maybe Text
comment} -> Maybe Text
comment) (\s :: ReadOptions
s@ReadOptions' {} Maybe Text
a -> ReadOptions
s {$sel:comment:ReadOptions' :: Maybe Text
comment = Maybe Text
a} :: ReadOptions)

-- | The file\'s encoding.
readOptions_encoding :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Text)
readOptions_encoding :: Lens' ReadOptions (Maybe Text)
readOptions_encoding = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Text
encoding :: Maybe Text
$sel:encoding:ReadOptions' :: ReadOptions -> Maybe Text
encoding} -> Maybe Text
encoding) (\s :: ReadOptions
s@ReadOptions' {} Maybe Text
a -> ReadOptions
s {$sel:encoding:ReadOptions' :: Maybe Text
encoding = Maybe Text
a} :: ReadOptions)

-- | A character for escaping quotes in the file.
readOptions_escape :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Text)
readOptions_escape :: Lens' ReadOptions (Maybe Text)
readOptions_escape = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Text
escape :: Maybe Text
$sel:escape:ReadOptions' :: ReadOptions -> Maybe Text
escape} -> Maybe Text
escape) (\s :: ReadOptions
s@ReadOptions' {} Maybe Text
a -> ReadOptions
s {$sel:escape:ReadOptions' :: Maybe Text
escape = Maybe Text
a} :: ReadOptions)

-- | Whether quotes need to be escaped in the file.
readOptions_escapeQuotes :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Bool)
readOptions_escapeQuotes :: Lens' ReadOptions (Maybe Bool)
readOptions_escapeQuotes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Bool
escapeQuotes :: Maybe Bool
$sel:escapeQuotes:ReadOptions' :: ReadOptions -> Maybe Bool
escapeQuotes} -> Maybe Bool
escapeQuotes) (\s :: ReadOptions
s@ReadOptions' {} Maybe Bool
a -> ReadOptions
s {$sel:escapeQuotes:ReadOptions' :: Maybe Bool
escapeQuotes = Maybe Bool
a} :: ReadOptions)

-- | Whether the file has a header row.
readOptions_header :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Bool)
readOptions_header :: Lens' ReadOptions (Maybe Bool)
readOptions_header = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Bool
header :: Maybe Bool
$sel:header:ReadOptions' :: ReadOptions -> Maybe Bool
header} -> Maybe Bool
header) (\s :: ReadOptions
s@ReadOptions' {} Maybe Bool
a -> ReadOptions
s {$sel:header:ReadOptions' :: Maybe Bool
header = Maybe Bool
a} :: ReadOptions)

-- | A line separator for the file.
readOptions_lineSep :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Text)
readOptions_lineSep :: Lens' ReadOptions (Maybe Text)
readOptions_lineSep = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Text
lineSep :: Maybe Text
$sel:lineSep:ReadOptions' :: ReadOptions -> Maybe Text
lineSep} -> Maybe Text
lineSep) (\s :: ReadOptions
s@ReadOptions' {} Maybe Text
a -> ReadOptions
s {$sel:lineSep:ReadOptions' :: Maybe Text
lineSep = Maybe Text
a} :: ReadOptions)

-- | The file\'s quote character.
readOptions_quote :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Text)
readOptions_quote :: Lens' ReadOptions (Maybe Text)
readOptions_quote = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Text
quote :: Maybe Text
$sel:quote:ReadOptions' :: ReadOptions -> Maybe Text
quote} -> Maybe Text
quote) (\s :: ReadOptions
s@ReadOptions' {} Maybe Text
a -> ReadOptions
s {$sel:quote:ReadOptions' :: Maybe Text
quote = Maybe Text
a} :: ReadOptions)

-- | Whether all values need to be quoted, or just those that contain quotes.
readOptions_quoteAll :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Bool)
readOptions_quoteAll :: Lens' ReadOptions (Maybe Bool)
readOptions_quoteAll = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Bool
quoteAll :: Maybe Bool
$sel:quoteAll:ReadOptions' :: ReadOptions -> Maybe Bool
quoteAll} -> Maybe Bool
quoteAll) (\s :: ReadOptions
s@ReadOptions' {} Maybe Bool
a -> ReadOptions
s {$sel:quoteAll:ReadOptions' :: Maybe Bool
quoteAll = Maybe Bool
a} :: ReadOptions)

-- | The file\'s field separator.
readOptions_sep :: Lens.Lens' ReadOptions (Prelude.Maybe Prelude.Text)
readOptions_sep :: Lens' ReadOptions (Maybe Text)
readOptions_sep = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadOptions' {Maybe Text
sep :: Maybe Text
$sel:sep:ReadOptions' :: ReadOptions -> Maybe Text
sep} -> Maybe Text
sep) (\s :: ReadOptions
s@ReadOptions' {} Maybe Text
a -> ReadOptions
s {$sel:sep:ReadOptions' :: Maybe Text
sep = Maybe Text
a} :: ReadOptions)

instance Data.FromJSON ReadOptions where
  parseJSON :: Value -> Parser ReadOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReadOptions"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ReadOptions
ReadOptions'
            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
"comment")
            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
"encoding")
            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
"escape")
            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
"escapeQuotes")
            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
"header")
            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
"lineSep")
            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
"quote")
            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
"quoteAll")
            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
"sep")
      )

instance Prelude.Hashable ReadOptions where
  hashWithSalt :: Int -> ReadOptions -> Int
hashWithSalt Int
_salt ReadOptions' {Maybe Bool
Maybe Text
sep :: Maybe Text
quoteAll :: Maybe Bool
quote :: Maybe Text
lineSep :: Maybe Text
header :: Maybe Bool
escapeQuotes :: Maybe Bool
escape :: Maybe Text
encoding :: Maybe Text
comment :: Maybe Text
$sel:sep:ReadOptions' :: ReadOptions -> Maybe Text
$sel:quoteAll:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:quote:ReadOptions' :: ReadOptions -> Maybe Text
$sel:lineSep:ReadOptions' :: ReadOptions -> Maybe Text
$sel:header:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:escapeQuotes:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:escape:ReadOptions' :: ReadOptions -> Maybe Text
$sel:encoding:ReadOptions' :: ReadOptions -> Maybe Text
$sel:comment:ReadOptions' :: ReadOptions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
encoding
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
escape
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
escapeQuotes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
header
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lineSep
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
quote
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
quoteAll
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sep

instance Prelude.NFData ReadOptions where
  rnf :: ReadOptions -> ()
rnf ReadOptions' {Maybe Bool
Maybe Text
sep :: Maybe Text
quoteAll :: Maybe Bool
quote :: Maybe Text
lineSep :: Maybe Text
header :: Maybe Bool
escapeQuotes :: Maybe Bool
escape :: Maybe Text
encoding :: Maybe Text
comment :: Maybe Text
$sel:sep:ReadOptions' :: ReadOptions -> Maybe Text
$sel:quoteAll:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:quote:ReadOptions' :: ReadOptions -> Maybe Text
$sel:lineSep:ReadOptions' :: ReadOptions -> Maybe Text
$sel:header:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:escapeQuotes:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:escape:ReadOptions' :: ReadOptions -> Maybe Text
$sel:encoding:ReadOptions' :: ReadOptions -> Maybe Text
$sel:comment:ReadOptions' :: ReadOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
encoding
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
escape
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
escapeQuotes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
header
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lineSep
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
quote
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
quoteAll
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sep

instance Data.ToJSON ReadOptions where
  toJSON :: ReadOptions -> Value
toJSON ReadOptions' {Maybe Bool
Maybe Text
sep :: Maybe Text
quoteAll :: Maybe Bool
quote :: Maybe Text
lineSep :: Maybe Text
header :: Maybe Bool
escapeQuotes :: Maybe Bool
escape :: Maybe Text
encoding :: Maybe Text
comment :: Maybe Text
$sel:sep:ReadOptions' :: ReadOptions -> Maybe Text
$sel:quoteAll:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:quote:ReadOptions' :: ReadOptions -> Maybe Text
$sel:lineSep:ReadOptions' :: ReadOptions -> Maybe Text
$sel:header:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:escapeQuotes:ReadOptions' :: ReadOptions -> Maybe Bool
$sel:escape:ReadOptions' :: ReadOptions -> Maybe Text
$sel:encoding:ReadOptions' :: ReadOptions -> Maybe Text
$sel:comment:ReadOptions' :: ReadOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"comment" 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
comment,
            (Key
"encoding" 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
encoding,
            (Key
"escape" 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
escape,
            (Key
"escapeQuotes" 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 Bool
escapeQuotes,
            (Key
"header" 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 Bool
header,
            (Key
"lineSep" 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
lineSep,
            (Key
"quote" 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
quote,
            (Key
"quoteAll" 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 Bool
quoteAll,
            (Key
"sep" 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
sep
          ]
      )