{-# 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.DataBrew.Types.ViewFrame
-- 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.DataBrew.Types.ViewFrame where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.AnalyticsMode
import qualified Amazonka.Prelude as Prelude

-- | Represents the data being transformed during an action.
--
-- /See:/ 'newViewFrame' smart constructor.
data ViewFrame = ViewFrame'
  { -- | Controls if analytics computation is enabled or disabled. Enabled by
    -- default.
    ViewFrame -> Maybe AnalyticsMode
analytics :: Prelude.Maybe AnalyticsMode,
    -- | The number of columns to include in the view frame, beginning with the
    -- @StartColumnIndex@ value and ignoring any columns in the @HiddenColumns@
    -- list.
    ViewFrame -> Maybe Natural
columnRange :: Prelude.Maybe Prelude.Natural,
    -- | A list of columns to hide in the view frame.
    ViewFrame -> Maybe [Text]
hiddenColumns :: Prelude.Maybe [Prelude.Text],
    -- | The number of rows to include in the view frame, beginning with the
    -- @StartRowIndex@ value.
    ViewFrame -> Maybe Int
rowRange :: Prelude.Maybe Prelude.Int,
    -- | The starting index for the range of rows to return in the view frame.
    ViewFrame -> Maybe Natural
startRowIndex :: Prelude.Maybe Prelude.Natural,
    -- | The starting index for the range of columns to return in the view frame.
    ViewFrame -> Natural
startColumnIndex :: Prelude.Natural
  }
  deriving (ViewFrame -> ViewFrame -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ViewFrame -> ViewFrame -> Bool
$c/= :: ViewFrame -> ViewFrame -> Bool
== :: ViewFrame -> ViewFrame -> Bool
$c== :: ViewFrame -> ViewFrame -> Bool
Prelude.Eq, ReadPrec [ViewFrame]
ReadPrec ViewFrame
Int -> ReadS ViewFrame
ReadS [ViewFrame]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ViewFrame]
$creadListPrec :: ReadPrec [ViewFrame]
readPrec :: ReadPrec ViewFrame
$creadPrec :: ReadPrec ViewFrame
readList :: ReadS [ViewFrame]
$creadList :: ReadS [ViewFrame]
readsPrec :: Int -> ReadS ViewFrame
$creadsPrec :: Int -> ReadS ViewFrame
Prelude.Read, Int -> ViewFrame -> ShowS
[ViewFrame] -> ShowS
ViewFrame -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ViewFrame] -> ShowS
$cshowList :: [ViewFrame] -> ShowS
show :: ViewFrame -> String
$cshow :: ViewFrame -> String
showsPrec :: Int -> ViewFrame -> ShowS
$cshowsPrec :: Int -> ViewFrame -> ShowS
Prelude.Show, forall x. Rep ViewFrame x -> ViewFrame
forall x. ViewFrame -> Rep ViewFrame x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ViewFrame x -> ViewFrame
$cfrom :: forall x. ViewFrame -> Rep ViewFrame x
Prelude.Generic)

-- |
-- Create a value of 'ViewFrame' 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:
--
-- 'analytics', 'viewFrame_analytics' - Controls if analytics computation is enabled or disabled. Enabled by
-- default.
--
-- 'columnRange', 'viewFrame_columnRange' - The number of columns to include in the view frame, beginning with the
-- @StartColumnIndex@ value and ignoring any columns in the @HiddenColumns@
-- list.
--
-- 'hiddenColumns', 'viewFrame_hiddenColumns' - A list of columns to hide in the view frame.
--
-- 'rowRange', 'viewFrame_rowRange' - The number of rows to include in the view frame, beginning with the
-- @StartRowIndex@ value.
--
-- 'startRowIndex', 'viewFrame_startRowIndex' - The starting index for the range of rows to return in the view frame.
--
-- 'startColumnIndex', 'viewFrame_startColumnIndex' - The starting index for the range of columns to return in the view frame.
newViewFrame ::
  -- | 'startColumnIndex'
  Prelude.Natural ->
  ViewFrame
newViewFrame :: Natural -> ViewFrame
newViewFrame Natural
pStartColumnIndex_ =
  ViewFrame'
    { $sel:analytics:ViewFrame' :: Maybe AnalyticsMode
analytics = forall a. Maybe a
Prelude.Nothing,
      $sel:columnRange:ViewFrame' :: Maybe Natural
columnRange = forall a. Maybe a
Prelude.Nothing,
      $sel:hiddenColumns:ViewFrame' :: Maybe [Text]
hiddenColumns = forall a. Maybe a
Prelude.Nothing,
      $sel:rowRange:ViewFrame' :: Maybe Int
rowRange = forall a. Maybe a
Prelude.Nothing,
      $sel:startRowIndex:ViewFrame' :: Maybe Natural
startRowIndex = forall a. Maybe a
Prelude.Nothing,
      $sel:startColumnIndex:ViewFrame' :: Natural
startColumnIndex = Natural
pStartColumnIndex_
    }

-- | Controls if analytics computation is enabled or disabled. Enabled by
-- default.
viewFrame_analytics :: Lens.Lens' ViewFrame (Prelude.Maybe AnalyticsMode)
viewFrame_analytics :: Lens' ViewFrame (Maybe AnalyticsMode)
viewFrame_analytics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewFrame' {Maybe AnalyticsMode
analytics :: Maybe AnalyticsMode
$sel:analytics:ViewFrame' :: ViewFrame -> Maybe AnalyticsMode
analytics} -> Maybe AnalyticsMode
analytics) (\s :: ViewFrame
s@ViewFrame' {} Maybe AnalyticsMode
a -> ViewFrame
s {$sel:analytics:ViewFrame' :: Maybe AnalyticsMode
analytics = Maybe AnalyticsMode
a} :: ViewFrame)

-- | The number of columns to include in the view frame, beginning with the
-- @StartColumnIndex@ value and ignoring any columns in the @HiddenColumns@
-- list.
viewFrame_columnRange :: Lens.Lens' ViewFrame (Prelude.Maybe Prelude.Natural)
viewFrame_columnRange :: Lens' ViewFrame (Maybe Natural)
viewFrame_columnRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewFrame' {Maybe Natural
columnRange :: Maybe Natural
$sel:columnRange:ViewFrame' :: ViewFrame -> Maybe Natural
columnRange} -> Maybe Natural
columnRange) (\s :: ViewFrame
s@ViewFrame' {} Maybe Natural
a -> ViewFrame
s {$sel:columnRange:ViewFrame' :: Maybe Natural
columnRange = Maybe Natural
a} :: ViewFrame)

-- | A list of columns to hide in the view frame.
viewFrame_hiddenColumns :: Lens.Lens' ViewFrame (Prelude.Maybe [Prelude.Text])
viewFrame_hiddenColumns :: Lens' ViewFrame (Maybe [Text])
viewFrame_hiddenColumns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewFrame' {Maybe [Text]
hiddenColumns :: Maybe [Text]
$sel:hiddenColumns:ViewFrame' :: ViewFrame -> Maybe [Text]
hiddenColumns} -> Maybe [Text]
hiddenColumns) (\s :: ViewFrame
s@ViewFrame' {} Maybe [Text]
a -> ViewFrame
s {$sel:hiddenColumns:ViewFrame' :: Maybe [Text]
hiddenColumns = Maybe [Text]
a} :: ViewFrame) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of rows to include in the view frame, beginning with the
-- @StartRowIndex@ value.
viewFrame_rowRange :: Lens.Lens' ViewFrame (Prelude.Maybe Prelude.Int)
viewFrame_rowRange :: Lens' ViewFrame (Maybe Int)
viewFrame_rowRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewFrame' {Maybe Int
rowRange :: Maybe Int
$sel:rowRange:ViewFrame' :: ViewFrame -> Maybe Int
rowRange} -> Maybe Int
rowRange) (\s :: ViewFrame
s@ViewFrame' {} Maybe Int
a -> ViewFrame
s {$sel:rowRange:ViewFrame' :: Maybe Int
rowRange = Maybe Int
a} :: ViewFrame)

-- | The starting index for the range of rows to return in the view frame.
viewFrame_startRowIndex :: Lens.Lens' ViewFrame (Prelude.Maybe Prelude.Natural)
viewFrame_startRowIndex :: Lens' ViewFrame (Maybe Natural)
viewFrame_startRowIndex = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewFrame' {Maybe Natural
startRowIndex :: Maybe Natural
$sel:startRowIndex:ViewFrame' :: ViewFrame -> Maybe Natural
startRowIndex} -> Maybe Natural
startRowIndex) (\s :: ViewFrame
s@ViewFrame' {} Maybe Natural
a -> ViewFrame
s {$sel:startRowIndex:ViewFrame' :: Maybe Natural
startRowIndex = Maybe Natural
a} :: ViewFrame)

-- | The starting index for the range of columns to return in the view frame.
viewFrame_startColumnIndex :: Lens.Lens' ViewFrame Prelude.Natural
viewFrame_startColumnIndex :: Lens' ViewFrame Natural
viewFrame_startColumnIndex = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewFrame' {Natural
startColumnIndex :: Natural
$sel:startColumnIndex:ViewFrame' :: ViewFrame -> Natural
startColumnIndex} -> Natural
startColumnIndex) (\s :: ViewFrame
s@ViewFrame' {} Natural
a -> ViewFrame
s {$sel:startColumnIndex:ViewFrame' :: Natural
startColumnIndex = Natural
a} :: ViewFrame)

instance Prelude.Hashable ViewFrame where
  hashWithSalt :: Int -> ViewFrame -> Int
hashWithSalt Int
_salt ViewFrame' {Natural
Maybe Int
Maybe Natural
Maybe [Text]
Maybe AnalyticsMode
startColumnIndex :: Natural
startRowIndex :: Maybe Natural
rowRange :: Maybe Int
hiddenColumns :: Maybe [Text]
columnRange :: Maybe Natural
analytics :: Maybe AnalyticsMode
$sel:startColumnIndex:ViewFrame' :: ViewFrame -> Natural
$sel:startRowIndex:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:rowRange:ViewFrame' :: ViewFrame -> Maybe Int
$sel:hiddenColumns:ViewFrame' :: ViewFrame -> Maybe [Text]
$sel:columnRange:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:analytics:ViewFrame' :: ViewFrame -> Maybe AnalyticsMode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnalyticsMode
analytics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
columnRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
hiddenColumns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
rowRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
startRowIndex
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
startColumnIndex

instance Prelude.NFData ViewFrame where
  rnf :: ViewFrame -> ()
rnf ViewFrame' {Natural
Maybe Int
Maybe Natural
Maybe [Text]
Maybe AnalyticsMode
startColumnIndex :: Natural
startRowIndex :: Maybe Natural
rowRange :: Maybe Int
hiddenColumns :: Maybe [Text]
columnRange :: Maybe Natural
analytics :: Maybe AnalyticsMode
$sel:startColumnIndex:ViewFrame' :: ViewFrame -> Natural
$sel:startRowIndex:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:rowRange:ViewFrame' :: ViewFrame -> Maybe Int
$sel:hiddenColumns:ViewFrame' :: ViewFrame -> Maybe [Text]
$sel:columnRange:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:analytics:ViewFrame' :: ViewFrame -> Maybe AnalyticsMode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AnalyticsMode
analytics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
columnRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
hiddenColumns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
rowRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
startRowIndex
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
startColumnIndex

instance Data.ToJSON ViewFrame where
  toJSON :: ViewFrame -> Value
toJSON ViewFrame' {Natural
Maybe Int
Maybe Natural
Maybe [Text]
Maybe AnalyticsMode
startColumnIndex :: Natural
startRowIndex :: Maybe Natural
rowRange :: Maybe Int
hiddenColumns :: Maybe [Text]
columnRange :: Maybe Natural
analytics :: Maybe AnalyticsMode
$sel:startColumnIndex:ViewFrame' :: ViewFrame -> Natural
$sel:startRowIndex:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:rowRange:ViewFrame' :: ViewFrame -> Maybe Int
$sel:hiddenColumns:ViewFrame' :: ViewFrame -> Maybe [Text]
$sel:columnRange:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:analytics:ViewFrame' :: ViewFrame -> Maybe AnalyticsMode
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Analytics" 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 AnalyticsMode
analytics,
            (Key
"ColumnRange" 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 Natural
columnRange,
            (Key
"HiddenColumns" 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]
hiddenColumns,
            (Key
"RowRange" 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 Int
rowRange,
            (Key
"StartRowIndex" 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 Natural
startRowIndex,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"StartColumnIndex" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
startColumnIndex)
          ]
      )