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

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

-- | Specifies the location of an occurrence of sensitive data in a Microsoft
-- Excel workbook, CSV file, or TSV file.
--
-- /See:/ 'newCell' smart constructor.
data Cell = Cell'
  { -- | The row number of the row that contains the sensitive data.
    Cell -> Maybe Integer
row :: Prelude.Maybe Prelude.Integer,
    -- | The location of the cell, as an absolute cell reference, that contains
    -- the sensitive data, for example Sheet2!C5 for cell C5 on Sheet2 in a
    -- Microsoft Excel workbook. This value is null for CSV and TSV files.
    Cell -> Maybe Text
cellReference :: Prelude.Maybe Prelude.Text,
    -- | The column number of the column that contains the sensitive data. For a
    -- Microsoft Excel workbook, this value correlates to the alphabetical
    -- character(s) for a column identifier, for example: 1 for column A, 2 for
    -- column B, and so on.
    Cell -> Maybe Integer
column :: Prelude.Maybe Prelude.Integer,
    -- | The name of the column that contains the sensitive data, if available.
    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 sensitive data.
--
-- 'cellReference', 'cell_cellReference' - The location of the cell, as an absolute cell reference, that contains
-- the sensitive data, for example Sheet2!C5 for cell C5 on Sheet2 in a
-- Microsoft Excel workbook. This value is null for CSV and TSV files.
--
-- 'column', 'cell_column' - The column number of the column that contains the sensitive data. For a
-- Microsoft Excel workbook, this value correlates to the alphabetical
-- character(s) for a column identifier, for example: 1 for column A, 2 for
-- column B, and so on.
--
-- 'columnName', 'cell_columnName' - The name of the column that contains the sensitive data, if available.
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 sensitive 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)

-- | The location of the cell, as an absolute cell reference, that contains
-- the sensitive data, for example Sheet2!C5 for cell C5 on Sheet2 in a
-- Microsoft Excel workbook. This value is null for CSV and TSV files.
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 sensitive data. For a
-- Microsoft Excel workbook, this value correlates to the alphabetical
-- character(s) for a column identifier, for example: 1 for column A, 2 for
-- column B, and so on.
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 sensitive data, if available.
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