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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Omics.Types.ReadOptions
import qualified Amazonka.Prelude as Prelude

-- | Formatting options for a TSV file.
--
-- /See:/ 'newTsvOptions' smart constructor.
data TsvOptions = TsvOptions'
  { -- | The file\'s read options.
    TsvOptions -> Maybe ReadOptions
readOptions :: Prelude.Maybe ReadOptions
  }
  deriving (TsvOptions -> TsvOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TsvOptions -> TsvOptions -> Bool
$c/= :: TsvOptions -> TsvOptions -> Bool
== :: TsvOptions -> TsvOptions -> Bool
$c== :: TsvOptions -> TsvOptions -> Bool
Prelude.Eq, ReadPrec [TsvOptions]
ReadPrec TsvOptions
Int -> ReadS TsvOptions
ReadS [TsvOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TsvOptions]
$creadListPrec :: ReadPrec [TsvOptions]
readPrec :: ReadPrec TsvOptions
$creadPrec :: ReadPrec TsvOptions
readList :: ReadS [TsvOptions]
$creadList :: ReadS [TsvOptions]
readsPrec :: Int -> ReadS TsvOptions
$creadsPrec :: Int -> ReadS TsvOptions
Prelude.Read, Int -> TsvOptions -> ShowS
[TsvOptions] -> ShowS
TsvOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TsvOptions] -> ShowS
$cshowList :: [TsvOptions] -> ShowS
show :: TsvOptions -> String
$cshow :: TsvOptions -> String
showsPrec :: Int -> TsvOptions -> ShowS
$cshowsPrec :: Int -> TsvOptions -> ShowS
Prelude.Show, forall x. Rep TsvOptions x -> TsvOptions
forall x. TsvOptions -> Rep TsvOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TsvOptions x -> TsvOptions
$cfrom :: forall x. TsvOptions -> Rep TsvOptions x
Prelude.Generic)

-- |
-- Create a value of 'TsvOptions' 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:
--
-- 'readOptions', 'tsvOptions_readOptions' - The file\'s read options.
newTsvOptions ::
  TsvOptions
newTsvOptions :: TsvOptions
newTsvOptions =
  TsvOptions' {$sel:readOptions:TsvOptions' :: Maybe ReadOptions
readOptions = forall a. Maybe a
Prelude.Nothing}

-- | The file\'s read options.
tsvOptions_readOptions :: Lens.Lens' TsvOptions (Prelude.Maybe ReadOptions)
tsvOptions_readOptions :: Lens' TsvOptions (Maybe ReadOptions)
tsvOptions_readOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TsvOptions' {Maybe ReadOptions
readOptions :: Maybe ReadOptions
$sel:readOptions:TsvOptions' :: TsvOptions -> Maybe ReadOptions
readOptions} -> Maybe ReadOptions
readOptions) (\s :: TsvOptions
s@TsvOptions' {} Maybe ReadOptions
a -> TsvOptions
s {$sel:readOptions:TsvOptions' :: Maybe ReadOptions
readOptions = Maybe ReadOptions
a} :: TsvOptions)

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

instance Prelude.Hashable TsvOptions where
  hashWithSalt :: Int -> TsvOptions -> Int
hashWithSalt Int
_salt TsvOptions' {Maybe ReadOptions
readOptions :: Maybe ReadOptions
$sel:readOptions:TsvOptions' :: TsvOptions -> Maybe ReadOptions
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReadOptions
readOptions

instance Prelude.NFData TsvOptions where
  rnf :: TsvOptions -> ()
rnf TsvOptions' {Maybe ReadOptions
readOptions :: Maybe ReadOptions
$sel:readOptions:TsvOptions' :: TsvOptions -> Maybe ReadOptions
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe ReadOptions
readOptions

instance Data.ToJSON TsvOptions where
  toJSON :: TsvOptions -> Value
toJSON TsvOptions' {Maybe ReadOptions
readOptions :: Maybe ReadOptions
$sel:readOptions:TsvOptions' :: TsvOptions -> Maybe ReadOptions
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"readOptions" 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 ReadOptions
readOptions]
      )