{-# 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.SecurityHub.Types.Cell
-- 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.SecurityHub.Types.Cell where

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

-- | An occurrence of sensitive data detected in a Microsoft Excel workbook,
-- comma-separated value (CSV) file, or tab-separated value (TSV) file.
--
-- /See:/ 'newCell' smart constructor.
data Cell = Cell'
  { -- | The row number of the row that contains the data.
    Cell -> Maybe Integer
row :: Prelude.Maybe Prelude.Integer,
    -- | For a Microsoft Excel workbook, provides the location of the cell, as an
    -- absolute cell reference, that contains the data. For example, Sheet2!C5
    -- for cell C5 on Sheet2.
    Cell -> Maybe Text
cellReference :: Prelude.Maybe Prelude.Text,
    -- | The column number of the column that contains the data. For a Microsoft
    -- Excel workbook, the column number corresponds to the alphabetical column
    -- identifiers. For example, a value of 1 for Column corresponds to the A
    -- column in the workbook.
    Cell -> Maybe Integer
column :: Prelude.Maybe Prelude.Integer,
    -- | The name of the column that contains the data.
    Cell -> Maybe Text
columnName :: Prelude.Maybe Prelude.Text
  }
  deriving (Cell -> Cell -> Bool
(Cell -> Cell -> Bool) -> (Cell -> Cell -> Bool) -> Eq Cell
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cell -> Cell -> Bool
$c/= :: Cell -> Cell -> Bool
== :: Cell -> Cell -> Bool
$c== :: Cell -> Cell -> Bool
Prelude.Eq, ReadPrec [Cell]
ReadPrec Cell
Int -> ReadS Cell
ReadS [Cell]
(Int -> ReadS Cell)
-> ReadS [Cell] -> ReadPrec Cell -> ReadPrec [Cell] -> Read Cell
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Cell]
$creadListPrec :: ReadPrec [Cell]
readPrec :: ReadPrec Cell
$creadPrec :: ReadPrec Cell
readList :: ReadS [Cell]
$creadList :: ReadS [Cell]
readsPrec :: Int -> ReadS Cell
$creadsPrec :: Int -> ReadS Cell
Prelude.Read, Int -> Cell -> ShowS
[Cell] -> ShowS
Cell -> String
(Int -> Cell -> ShowS)
-> (Cell -> String) -> ([Cell] -> ShowS) -> Show Cell
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cell] -> ShowS
$cshowList :: [Cell] -> ShowS
show :: Cell -> String
$cshow :: Cell -> String
showsPrec :: Int -> Cell -> ShowS
$cshowsPrec :: Int -> Cell -> ShowS
Prelude.Show, (forall x. Cell -> Rep Cell x)
-> (forall x. Rep Cell x -> Cell) -> Generic Cell
forall x. Rep Cell x -> Cell
forall x. Cell -> Rep Cell x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cell x -> Cell
$cfrom :: forall x. Cell -> Rep Cell x
Prelude.Generic)

-- |
-- Create a value of 'Cell' 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:
--
-- 'row', 'cell_row' - The row number of the row that contains the data.
--
-- 'cellReference', 'cell_cellReference' - For a Microsoft Excel workbook, provides the location of the cell, as an
-- absolute cell reference, that contains the data. For example, Sheet2!C5
-- for cell C5 on Sheet2.
--
-- 'column', 'cell_column' - The column number of the column that contains the data. For a Microsoft
-- Excel workbook, the column number corresponds to the alphabetical column
-- identifiers. For example, a value of 1 for Column corresponds to the A
-- column in the workbook.
--
-- 'columnName', 'cell_columnName' - The name of the column that contains the data.
newCell ::
  Cell
newCell :: Cell
newCell =
  Cell' :: Maybe Integer -> Maybe Text -> Maybe Integer -> Maybe Text -> Cell
Cell'
    { $sel:row:Cell' :: Maybe Integer
row = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:cellReference:Cell' :: Maybe Text
cellReference = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:column:Cell' :: Maybe Integer
column = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:columnName:Cell' :: Maybe Text
columnName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The row number of the row that contains the data.
cell_row :: Lens.Lens' Cell (Prelude.Maybe Prelude.Integer)
cell_row :: (Maybe Integer -> f (Maybe Integer)) -> Cell -> f Cell
cell_row = (Cell -> Maybe Integer)
-> (Cell -> Maybe Integer -> Cell)
-> Lens Cell Cell (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Cell' {Maybe Integer
row :: Maybe Integer
$sel:row:Cell' :: Cell -> Maybe Integer
row} -> Maybe Integer
row) (\s :: Cell
s@Cell' {} Maybe Integer
a -> Cell
s {$sel:row:Cell' :: Maybe Integer
row = Maybe Integer
a} :: Cell)

-- | For a Microsoft Excel workbook, provides the location of the cell, as an
-- absolute cell reference, that contains the data. For example, Sheet2!C5
-- for cell C5 on Sheet2.
cell_cellReference :: Lens.Lens' Cell (Prelude.Maybe Prelude.Text)
cell_cellReference :: (Maybe Text -> f (Maybe Text)) -> Cell -> f Cell
cell_cellReference = (Cell -> Maybe Text)
-> (Cell -> Maybe Text -> Cell)
-> Lens Cell Cell (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Cell' {Maybe Text
cellReference :: Maybe Text
$sel:cellReference:Cell' :: Cell -> Maybe Text
cellReference} -> Maybe Text
cellReference) (\s :: Cell
s@Cell' {} Maybe Text
a -> Cell
s {$sel:cellReference:Cell' :: Maybe Text
cellReference = Maybe Text
a} :: Cell)

-- | The column number of the column that contains the data. For a Microsoft
-- Excel workbook, the column number corresponds to the alphabetical column
-- identifiers. For example, a value of 1 for Column corresponds to the A
-- column in the workbook.
cell_column :: Lens.Lens' Cell (Prelude.Maybe Prelude.Integer)
cell_column :: (Maybe Integer -> f (Maybe Integer)) -> Cell -> f Cell
cell_column = (Cell -> Maybe Integer)
-> (Cell -> Maybe Integer -> Cell)
-> Lens Cell Cell (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Cell' {Maybe Integer
column :: Maybe Integer
$sel:column:Cell' :: Cell -> Maybe Integer
column} -> Maybe Integer
column) (\s :: Cell
s@Cell' {} Maybe Integer
a -> Cell
s {$sel:column:Cell' :: Maybe Integer
column = Maybe Integer
a} :: Cell)

-- | The name of the column that contains the data.
cell_columnName :: Lens.Lens' Cell (Prelude.Maybe Prelude.Text)
cell_columnName :: (Maybe Text -> f (Maybe Text)) -> Cell -> f Cell
cell_columnName = (Cell -> Maybe Text)
-> (Cell -> Maybe Text -> Cell)
-> Lens Cell Cell (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Cell' {Maybe Text
columnName :: Maybe Text
$sel:columnName:Cell' :: Cell -> Maybe Text
columnName} -> Maybe Text
columnName) (\s :: Cell
s@Cell' {} Maybe Text
a -> Cell
s {$sel:columnName:Cell' :: Maybe Text
columnName = Maybe Text
a} :: Cell)

instance Core.FromJSON Cell where
  parseJSON :: Value -> Parser Cell
parseJSON =
    String -> (Object -> Parser Cell) -> Value -> Parser Cell
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Cell"
      ( \Object
x ->
          Maybe Integer -> Maybe Text -> Maybe Integer -> Maybe Text -> Cell
Cell'
            (Maybe Integer
 -> Maybe Text -> Maybe Integer -> Maybe Text -> Cell)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> Maybe Integer -> Maybe Text -> Cell)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Row")
            Parser (Maybe Text -> Maybe Integer -> Maybe Text -> Cell)
-> Parser (Maybe Text)
-> Parser (Maybe Integer -> Maybe Text -> Cell)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CellReference")
            Parser (Maybe Integer -> Maybe Text -> Cell)
-> Parser (Maybe Integer) -> Parser (Maybe Text -> Cell)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Column")
            Parser (Maybe Text -> Cell) -> Parser (Maybe Text) -> Parser Cell
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ColumnName")
      )

instance Prelude.Hashable Cell

instance Prelude.NFData Cell

instance Core.ToJSON Cell where
  toJSON :: Cell -> Value
toJSON Cell' {Maybe Integer
Maybe Text
columnName :: Maybe Text
column :: Maybe Integer
cellReference :: Maybe Text
row :: Maybe Integer
$sel:columnName:Cell' :: Cell -> Maybe Text
$sel:column:Cell' :: Cell -> Maybe Integer
$sel:cellReference:Cell' :: Cell -> Maybe Text
$sel:row:Cell' :: Cell -> Maybe Integer
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Row" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
row,
            (Text
"CellReference" 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
cellReference,
            (Text
"Column" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
column,
            (Text
"ColumnName" 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
columnName
          ]
      )