{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DataBrew.Types.ViewFrame where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the data being transformed during an action.
--
-- /See:/ 'newViewFrame' smart constructor.
data ViewFrame = ViewFrame'
  { -- | A list of columns to hide in the view frame.
    ViewFrame -> Maybe [Text]
hiddenColumns :: Prelude.Maybe [Prelude.Text],
    -- | 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,
    -- | The starting index for the range of columns to return in the view frame.
    ViewFrame -> Natural
startColumnIndex :: Prelude.Natural
  }
  deriving (ViewFrame -> ViewFrame -> Bool
(ViewFrame -> ViewFrame -> Bool)
-> (ViewFrame -> ViewFrame -> Bool) -> Eq ViewFrame
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]
(Int -> ReadS ViewFrame)
-> ReadS [ViewFrame]
-> ReadPrec ViewFrame
-> ReadPrec [ViewFrame]
-> Read 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
(Int -> ViewFrame -> ShowS)
-> (ViewFrame -> String)
-> ([ViewFrame] -> ShowS)
-> Show ViewFrame
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. ViewFrame -> Rep ViewFrame x)
-> (forall x. Rep ViewFrame x -> ViewFrame) -> Generic ViewFrame
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:
--
-- 'hiddenColumns', 'viewFrame_hiddenColumns' - A list of columns to hide in the view frame.
--
-- '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.
--
-- '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' :: Maybe [Text] -> Maybe Natural -> Natural -> ViewFrame
ViewFrame'
    { $sel:hiddenColumns:ViewFrame' :: Maybe [Text]
hiddenColumns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:columnRange:ViewFrame' :: Maybe Natural
columnRange = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:startColumnIndex:ViewFrame' :: Natural
startColumnIndex = Natural
pStartColumnIndex_
    }

-- | A list of columns to hide in the view frame.
viewFrame_hiddenColumns :: Lens.Lens' ViewFrame (Prelude.Maybe [Prelude.Text])
viewFrame_hiddenColumns :: (Maybe [Text] -> f (Maybe [Text])) -> ViewFrame -> f ViewFrame
viewFrame_hiddenColumns = (ViewFrame -> Maybe [Text])
-> (ViewFrame -> Maybe [Text] -> ViewFrame)
-> Lens ViewFrame ViewFrame (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text])) -> ViewFrame -> f ViewFrame)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ViewFrame
-> f ViewFrame
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Natural -> f (Maybe Natural)) -> ViewFrame -> f ViewFrame
viewFrame_columnRange = (ViewFrame -> Maybe Natural)
-> (ViewFrame -> Maybe Natural -> ViewFrame)
-> Lens ViewFrame ViewFrame (Maybe Natural) (Maybe Natural)
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)

-- | The starting index for the range of columns to return in the view frame.
viewFrame_startColumnIndex :: Lens.Lens' ViewFrame Prelude.Natural
viewFrame_startColumnIndex :: (Natural -> f Natural) -> ViewFrame -> f ViewFrame
viewFrame_startColumnIndex = (ViewFrame -> Natural)
-> (ViewFrame -> Natural -> ViewFrame)
-> Lens ViewFrame ViewFrame Natural Natural
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

instance Prelude.NFData ViewFrame

instance Core.ToJSON ViewFrame where
  toJSON :: ViewFrame -> Value
toJSON ViewFrame' {Natural
Maybe Natural
Maybe [Text]
startColumnIndex :: Natural
columnRange :: Maybe Natural
hiddenColumns :: Maybe [Text]
$sel:startColumnIndex:ViewFrame' :: ViewFrame -> Natural
$sel:columnRange:ViewFrame' :: ViewFrame -> Maybe Natural
$sel:hiddenColumns:ViewFrame' :: ViewFrame -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HiddenColumns" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
hiddenColumns,
            (Text
"ColumnRange" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
columnRange,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"StartColumnIndex" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
startColumnIndex)
          ]
      )