{-# 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.HoneyCode.Types.CellInput
-- 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.HoneyCode.Types.CellInput where

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

-- | CellInput object contains the data needed to create or update cells in a
-- table.
--
-- /See:/ 'newCellInput' smart constructor.
data CellInput = CellInput'
  { -- | Fact represents the data that is entered into a cell. This data can be
    -- free text or a formula. Formulas need to start with the equals (=) sign.
    CellInput -> Maybe (Sensitive Text)
fact :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (CellInput -> CellInput -> Bool
(CellInput -> CellInput -> Bool)
-> (CellInput -> CellInput -> Bool) -> Eq CellInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CellInput -> CellInput -> Bool
$c/= :: CellInput -> CellInput -> Bool
== :: CellInput -> CellInput -> Bool
$c== :: CellInput -> CellInput -> Bool
Prelude.Eq, Int -> CellInput -> ShowS
[CellInput] -> ShowS
CellInput -> String
(Int -> CellInput -> ShowS)
-> (CellInput -> String)
-> ([CellInput] -> ShowS)
-> Show CellInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CellInput] -> ShowS
$cshowList :: [CellInput] -> ShowS
show :: CellInput -> String
$cshow :: CellInput -> String
showsPrec :: Int -> CellInput -> ShowS
$cshowsPrec :: Int -> CellInput -> ShowS
Prelude.Show, (forall x. CellInput -> Rep CellInput x)
-> (forall x. Rep CellInput x -> CellInput) -> Generic CellInput
forall x. Rep CellInput x -> CellInput
forall x. CellInput -> Rep CellInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CellInput x -> CellInput
$cfrom :: forall x. CellInput -> Rep CellInput x
Prelude.Generic)

-- |
-- Create a value of 'CellInput' 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:
--
-- 'fact', 'cellInput_fact' - Fact represents the data that is entered into a cell. This data can be
-- free text or a formula. Formulas need to start with the equals (=) sign.
newCellInput ::
  CellInput
newCellInput :: CellInput
newCellInput = CellInput' :: Maybe (Sensitive Text) -> CellInput
CellInput' {$sel:fact:CellInput' :: Maybe (Sensitive Text)
fact = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing}

-- | Fact represents the data that is entered into a cell. This data can be
-- free text or a formula. Formulas need to start with the equals (=) sign.
cellInput_fact :: Lens.Lens' CellInput (Prelude.Maybe Prelude.Text)
cellInput_fact :: (Maybe Text -> f (Maybe Text)) -> CellInput -> f CellInput
cellInput_fact = (CellInput -> Maybe (Sensitive Text))
-> (CellInput -> Maybe (Sensitive Text) -> CellInput)
-> Lens
     CellInput
     CellInput
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CellInput' {Maybe (Sensitive Text)
fact :: Maybe (Sensitive Text)
$sel:fact:CellInput' :: CellInput -> Maybe (Sensitive Text)
fact} -> Maybe (Sensitive Text)
fact) (\s :: CellInput
s@CellInput' {} Maybe (Sensitive Text)
a -> CellInput
s {$sel:fact:CellInput' :: Maybe (Sensitive Text)
fact = Maybe (Sensitive Text)
a} :: CellInput) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CellInput -> f CellInput)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CellInput
-> f CellInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Prelude.Hashable CellInput

instance Prelude.NFData CellInput

instance Core.ToJSON CellInput where
  toJSON :: CellInput -> Value
toJSON CellInput' {Maybe (Sensitive Text)
fact :: Maybe (Sensitive Text)
$sel:fact:CellInput' :: CellInput -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"fact" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
fact]
      )