{-# 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.WAF.Types.SizeConstraint
-- 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.WAF.Types.SizeConstraint where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAF.Types.ComparisonOperator
import Amazonka.WAF.Types.FieldToMatch
import Amazonka.WAF.Types.TextTransformation

-- | This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- Specifies a constraint on the size of a part of the web request. AWS WAF
-- uses the @Size@, @ComparisonOperator@, and @FieldToMatch@ to build an
-- expression in the form of \"@Size@ @ComparisonOperator@ size in bytes of
-- @FieldToMatch@\". If that expression is true, the @SizeConstraint@ is
-- considered to match.
--
-- /See:/ 'newSizeConstraint' smart constructor.
data SizeConstraint = SizeConstraint'
  { -- | Specifies where in a web request to look for the size constraint.
    SizeConstraint -> FieldToMatch
fieldToMatch :: FieldToMatch,
    -- | Text transformations eliminate some of the unusual formatting that
    -- attackers use in web requests in an effort to bypass AWS WAF. If you
    -- specify a transformation, AWS WAF performs the transformation on
    -- @FieldToMatch@ before inspecting it for a match.
    --
    -- You can only specify a single type of TextTransformation.
    --
    -- Note that if you choose @BODY@ for the value of @Type@, you must choose
    -- @NONE@ for @TextTransformation@ because CloudFront forwards only the
    -- first 8192 bytes for inspection.
    --
    -- __NONE__
    --
    -- Specify @NONE@ if you don\'t want to perform any text transformations.
    --
    -- __CMD_LINE__
    --
    -- When you\'re concerned that attackers are injecting an operating system
    -- command line command and using unusual formatting to disguise some or
    -- all of the command, use this option to perform the following
    -- transformations:
    --
    -- -   Delete the following characters: \\ \" \' ^
    --
    -- -   Delete spaces before the following characters: \/ (
    --
    -- -   Replace the following characters with a space: , ;
    --
    -- -   Replace multiple spaces with one space
    --
    -- -   Convert uppercase letters (A-Z) to lowercase (a-z)
    --
    -- __COMPRESS_WHITE_SPACE__
    --
    -- Use this option to replace the following characters with a space
    -- character (decimal 32):
    --
    -- -   \\f, formfeed, decimal 12
    --
    -- -   \\t, tab, decimal 9
    --
    -- -   \\n, newline, decimal 10
    --
    -- -   \\r, carriage return, decimal 13
    --
    -- -   \\v, vertical tab, decimal 11
    --
    -- -   non-breaking space, decimal 160
    --
    -- @COMPRESS_WHITE_SPACE@ also replaces multiple spaces with one space.
    --
    -- __HTML_ENTITY_DECODE__
    --
    -- Use this option to replace HTML-encoded characters with unencoded
    -- characters. @HTML_ENTITY_DECODE@ performs the following operations:
    --
    -- -   Replaces @(ampersand)quot;@ with @\"@
    --
    -- -   Replaces @(ampersand)nbsp;@ with a non-breaking space, decimal 160
    --
    -- -   Replaces @(ampersand)lt;@ with a \"less than\" symbol
    --
    -- -   Replaces @(ampersand)gt;@ with @>@
    --
    -- -   Replaces characters that are represented in hexadecimal format,
    --     @(ampersand)#xhhhh;@, with the corresponding characters
    --
    -- -   Replaces characters that are represented in decimal format,
    --     @(ampersand)#nnnn;@, with the corresponding characters
    --
    -- __LOWERCASE__
    --
    -- Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
    --
    -- __URL_DECODE__
    --
    -- Use this option to decode a URL-encoded value.
    SizeConstraint -> TextTransformation
textTransformation :: TextTransformation,
    -- | The type of comparison you want AWS WAF to perform. AWS WAF uses this in
    -- combination with the provided @Size@ and @FieldToMatch@ to build an
    -- expression in the form of \"@Size@ @ComparisonOperator@ size in bytes of
    -- @FieldToMatch@\". If that expression is true, the @SizeConstraint@ is
    -- considered to match.
    --
    -- __EQ__: Used to test if the @Size@ is equal to the size of the
    -- @FieldToMatch@
    --
    -- __NE__: Used to test if the @Size@ is not equal to the size of the
    -- @FieldToMatch@
    --
    -- __LE__: Used to test if the @Size@ is less than or equal to the size of
    -- the @FieldToMatch@
    --
    -- __LT__: Used to test if the @Size@ is strictly less than the size of the
    -- @FieldToMatch@
    --
    -- __GE__: Used to test if the @Size@ is greater than or equal to the size
    -- of the @FieldToMatch@
    --
    -- __GT__: Used to test if the @Size@ is strictly greater than the size of
    -- the @FieldToMatch@
    SizeConstraint -> ComparisonOperator
comparisonOperator :: ComparisonOperator,
    -- | The size in bytes that you want AWS WAF to compare against the size of
    -- the specified @FieldToMatch@. AWS WAF uses this in combination with
    -- @ComparisonOperator@ and @FieldToMatch@ to build an expression in the
    -- form of \"@Size@ @ComparisonOperator@ size in bytes of @FieldToMatch@\".
    -- If that expression is true, the @SizeConstraint@ is considered to match.
    --
    -- Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
    --
    -- If you specify @URI@ for the value of @Type@, the \/ in the URI counts
    -- as one character. For example, the URI @\/logo.jpg@ is nine characters
    -- long.
    SizeConstraint -> Natural
size :: Prelude.Natural
  }
  deriving (SizeConstraint -> SizeConstraint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SizeConstraint -> SizeConstraint -> Bool
$c/= :: SizeConstraint -> SizeConstraint -> Bool
== :: SizeConstraint -> SizeConstraint -> Bool
$c== :: SizeConstraint -> SizeConstraint -> Bool
Prelude.Eq, ReadPrec [SizeConstraint]
ReadPrec SizeConstraint
Int -> ReadS SizeConstraint
ReadS [SizeConstraint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SizeConstraint]
$creadListPrec :: ReadPrec [SizeConstraint]
readPrec :: ReadPrec SizeConstraint
$creadPrec :: ReadPrec SizeConstraint
readList :: ReadS [SizeConstraint]
$creadList :: ReadS [SizeConstraint]
readsPrec :: Int -> ReadS SizeConstraint
$creadsPrec :: Int -> ReadS SizeConstraint
Prelude.Read, Int -> SizeConstraint -> ShowS
[SizeConstraint] -> ShowS
SizeConstraint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SizeConstraint] -> ShowS
$cshowList :: [SizeConstraint] -> ShowS
show :: SizeConstraint -> String
$cshow :: SizeConstraint -> String
showsPrec :: Int -> SizeConstraint -> ShowS
$cshowsPrec :: Int -> SizeConstraint -> ShowS
Prelude.Show, forall x. Rep SizeConstraint x -> SizeConstraint
forall x. SizeConstraint -> Rep SizeConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SizeConstraint x -> SizeConstraint
$cfrom :: forall x. SizeConstraint -> Rep SizeConstraint x
Prelude.Generic)

-- |
-- Create a value of 'SizeConstraint' 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:
--
-- 'fieldToMatch', 'sizeConstraint_fieldToMatch' - Specifies where in a web request to look for the size constraint.
--
-- 'textTransformation', 'sizeConstraint_textTransformation' - Text transformations eliminate some of the unusual formatting that
-- attackers use in web requests in an effort to bypass AWS WAF. If you
-- specify a transformation, AWS WAF performs the transformation on
-- @FieldToMatch@ before inspecting it for a match.
--
-- You can only specify a single type of TextTransformation.
--
-- Note that if you choose @BODY@ for the value of @Type@, you must choose
-- @NONE@ for @TextTransformation@ because CloudFront forwards only the
-- first 8192 bytes for inspection.
--
-- __NONE__
--
-- Specify @NONE@ if you don\'t want to perform any text transformations.
--
-- __CMD_LINE__
--
-- When you\'re concerned that attackers are injecting an operating system
-- command line command and using unusual formatting to disguise some or
-- all of the command, use this option to perform the following
-- transformations:
--
-- -   Delete the following characters: \\ \" \' ^
--
-- -   Delete spaces before the following characters: \/ (
--
-- -   Replace the following characters with a space: , ;
--
-- -   Replace multiple spaces with one space
--
-- -   Convert uppercase letters (A-Z) to lowercase (a-z)
--
-- __COMPRESS_WHITE_SPACE__
--
-- Use this option to replace the following characters with a space
-- character (decimal 32):
--
-- -   \\f, formfeed, decimal 12
--
-- -   \\t, tab, decimal 9
--
-- -   \\n, newline, decimal 10
--
-- -   \\r, carriage return, decimal 13
--
-- -   \\v, vertical tab, decimal 11
--
-- -   non-breaking space, decimal 160
--
-- @COMPRESS_WHITE_SPACE@ also replaces multiple spaces with one space.
--
-- __HTML_ENTITY_DECODE__
--
-- Use this option to replace HTML-encoded characters with unencoded
-- characters. @HTML_ENTITY_DECODE@ performs the following operations:
--
-- -   Replaces @(ampersand)quot;@ with @\"@
--
-- -   Replaces @(ampersand)nbsp;@ with a non-breaking space, decimal 160
--
-- -   Replaces @(ampersand)lt;@ with a \"less than\" symbol
--
-- -   Replaces @(ampersand)gt;@ with @>@
--
-- -   Replaces characters that are represented in hexadecimal format,
--     @(ampersand)#xhhhh;@, with the corresponding characters
--
-- -   Replaces characters that are represented in decimal format,
--     @(ampersand)#nnnn;@, with the corresponding characters
--
-- __LOWERCASE__
--
-- Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
--
-- __URL_DECODE__
--
-- Use this option to decode a URL-encoded value.
--
-- 'comparisonOperator', 'sizeConstraint_comparisonOperator' - The type of comparison you want AWS WAF to perform. AWS WAF uses this in
-- combination with the provided @Size@ and @FieldToMatch@ to build an
-- expression in the form of \"@Size@ @ComparisonOperator@ size in bytes of
-- @FieldToMatch@\". If that expression is true, the @SizeConstraint@ is
-- considered to match.
--
-- __EQ__: Used to test if the @Size@ is equal to the size of the
-- @FieldToMatch@
--
-- __NE__: Used to test if the @Size@ is not equal to the size of the
-- @FieldToMatch@
--
-- __LE__: Used to test if the @Size@ is less than or equal to the size of
-- the @FieldToMatch@
--
-- __LT__: Used to test if the @Size@ is strictly less than the size of the
-- @FieldToMatch@
--
-- __GE__: Used to test if the @Size@ is greater than or equal to the size
-- of the @FieldToMatch@
--
-- __GT__: Used to test if the @Size@ is strictly greater than the size of
-- the @FieldToMatch@
--
-- 'size', 'sizeConstraint_size' - The size in bytes that you want AWS WAF to compare against the size of
-- the specified @FieldToMatch@. AWS WAF uses this in combination with
-- @ComparisonOperator@ and @FieldToMatch@ to build an expression in the
-- form of \"@Size@ @ComparisonOperator@ size in bytes of @FieldToMatch@\".
-- If that expression is true, the @SizeConstraint@ is considered to match.
--
-- Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
--
-- If you specify @URI@ for the value of @Type@, the \/ in the URI counts
-- as one character. For example, the URI @\/logo.jpg@ is nine characters
-- long.
newSizeConstraint ::
  -- | 'fieldToMatch'
  FieldToMatch ->
  -- | 'textTransformation'
  TextTransformation ->
  -- | 'comparisonOperator'
  ComparisonOperator ->
  -- | 'size'
  Prelude.Natural ->
  SizeConstraint
newSizeConstraint :: FieldToMatch
-> TextTransformation
-> ComparisonOperator
-> Natural
-> SizeConstraint
newSizeConstraint
  FieldToMatch
pFieldToMatch_
  TextTransformation
pTextTransformation_
  ComparisonOperator
pComparisonOperator_
  Natural
pSize_ =
    SizeConstraint'
      { $sel:fieldToMatch:SizeConstraint' :: FieldToMatch
fieldToMatch = FieldToMatch
pFieldToMatch_,
        $sel:textTransformation:SizeConstraint' :: TextTransformation
textTransformation = TextTransformation
pTextTransformation_,
        $sel:comparisonOperator:SizeConstraint' :: ComparisonOperator
comparisonOperator = ComparisonOperator
pComparisonOperator_,
        $sel:size:SizeConstraint' :: Natural
size = Natural
pSize_
      }

-- | Specifies where in a web request to look for the size constraint.
sizeConstraint_fieldToMatch :: Lens.Lens' SizeConstraint FieldToMatch
sizeConstraint_fieldToMatch :: Lens' SizeConstraint FieldToMatch
sizeConstraint_fieldToMatch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraint' {FieldToMatch
fieldToMatch :: FieldToMatch
$sel:fieldToMatch:SizeConstraint' :: SizeConstraint -> FieldToMatch
fieldToMatch} -> FieldToMatch
fieldToMatch) (\s :: SizeConstraint
s@SizeConstraint' {} FieldToMatch
a -> SizeConstraint
s {$sel:fieldToMatch:SizeConstraint' :: FieldToMatch
fieldToMatch = FieldToMatch
a} :: SizeConstraint)

-- | Text transformations eliminate some of the unusual formatting that
-- attackers use in web requests in an effort to bypass AWS WAF. If you
-- specify a transformation, AWS WAF performs the transformation on
-- @FieldToMatch@ before inspecting it for a match.
--
-- You can only specify a single type of TextTransformation.
--
-- Note that if you choose @BODY@ for the value of @Type@, you must choose
-- @NONE@ for @TextTransformation@ because CloudFront forwards only the
-- first 8192 bytes for inspection.
--
-- __NONE__
--
-- Specify @NONE@ if you don\'t want to perform any text transformations.
--
-- __CMD_LINE__
--
-- When you\'re concerned that attackers are injecting an operating system
-- command line command and using unusual formatting to disguise some or
-- all of the command, use this option to perform the following
-- transformations:
--
-- -   Delete the following characters: \\ \" \' ^
--
-- -   Delete spaces before the following characters: \/ (
--
-- -   Replace the following characters with a space: , ;
--
-- -   Replace multiple spaces with one space
--
-- -   Convert uppercase letters (A-Z) to lowercase (a-z)
--
-- __COMPRESS_WHITE_SPACE__
--
-- Use this option to replace the following characters with a space
-- character (decimal 32):
--
-- -   \\f, formfeed, decimal 12
--
-- -   \\t, tab, decimal 9
--
-- -   \\n, newline, decimal 10
--
-- -   \\r, carriage return, decimal 13
--
-- -   \\v, vertical tab, decimal 11
--
-- -   non-breaking space, decimal 160
--
-- @COMPRESS_WHITE_SPACE@ also replaces multiple spaces with one space.
--
-- __HTML_ENTITY_DECODE__
--
-- Use this option to replace HTML-encoded characters with unencoded
-- characters. @HTML_ENTITY_DECODE@ performs the following operations:
--
-- -   Replaces @(ampersand)quot;@ with @\"@
--
-- -   Replaces @(ampersand)nbsp;@ with a non-breaking space, decimal 160
--
-- -   Replaces @(ampersand)lt;@ with a \"less than\" symbol
--
-- -   Replaces @(ampersand)gt;@ with @>@
--
-- -   Replaces characters that are represented in hexadecimal format,
--     @(ampersand)#xhhhh;@, with the corresponding characters
--
-- -   Replaces characters that are represented in decimal format,
--     @(ampersand)#nnnn;@, with the corresponding characters
--
-- __LOWERCASE__
--
-- Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
--
-- __URL_DECODE__
--
-- Use this option to decode a URL-encoded value.
sizeConstraint_textTransformation :: Lens.Lens' SizeConstraint TextTransformation
sizeConstraint_textTransformation :: Lens' SizeConstraint TextTransformation
sizeConstraint_textTransformation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraint' {TextTransformation
textTransformation :: TextTransformation
$sel:textTransformation:SizeConstraint' :: SizeConstraint -> TextTransformation
textTransformation} -> TextTransformation
textTransformation) (\s :: SizeConstraint
s@SizeConstraint' {} TextTransformation
a -> SizeConstraint
s {$sel:textTransformation:SizeConstraint' :: TextTransformation
textTransformation = TextTransformation
a} :: SizeConstraint)

-- | The type of comparison you want AWS WAF to perform. AWS WAF uses this in
-- combination with the provided @Size@ and @FieldToMatch@ to build an
-- expression in the form of \"@Size@ @ComparisonOperator@ size in bytes of
-- @FieldToMatch@\". If that expression is true, the @SizeConstraint@ is
-- considered to match.
--
-- __EQ__: Used to test if the @Size@ is equal to the size of the
-- @FieldToMatch@
--
-- __NE__: Used to test if the @Size@ is not equal to the size of the
-- @FieldToMatch@
--
-- __LE__: Used to test if the @Size@ is less than or equal to the size of
-- the @FieldToMatch@
--
-- __LT__: Used to test if the @Size@ is strictly less than the size of the
-- @FieldToMatch@
--
-- __GE__: Used to test if the @Size@ is greater than or equal to the size
-- of the @FieldToMatch@
--
-- __GT__: Used to test if the @Size@ is strictly greater than the size of
-- the @FieldToMatch@
sizeConstraint_comparisonOperator :: Lens.Lens' SizeConstraint ComparisonOperator
sizeConstraint_comparisonOperator :: Lens' SizeConstraint ComparisonOperator
sizeConstraint_comparisonOperator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraint' {ComparisonOperator
comparisonOperator :: ComparisonOperator
$sel:comparisonOperator:SizeConstraint' :: SizeConstraint -> ComparisonOperator
comparisonOperator} -> ComparisonOperator
comparisonOperator) (\s :: SizeConstraint
s@SizeConstraint' {} ComparisonOperator
a -> SizeConstraint
s {$sel:comparisonOperator:SizeConstraint' :: ComparisonOperator
comparisonOperator = ComparisonOperator
a} :: SizeConstraint)

-- | The size in bytes that you want AWS WAF to compare against the size of
-- the specified @FieldToMatch@. AWS WAF uses this in combination with
-- @ComparisonOperator@ and @FieldToMatch@ to build an expression in the
-- form of \"@Size@ @ComparisonOperator@ size in bytes of @FieldToMatch@\".
-- If that expression is true, the @SizeConstraint@ is considered to match.
--
-- Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).
--
-- If you specify @URI@ for the value of @Type@, the \/ in the URI counts
-- as one character. For example, the URI @\/logo.jpg@ is nine characters
-- long.
sizeConstraint_size :: Lens.Lens' SizeConstraint Prelude.Natural
sizeConstraint_size :: Lens' SizeConstraint Natural
sizeConstraint_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraint' {Natural
size :: Natural
$sel:size:SizeConstraint' :: SizeConstraint -> Natural
size} -> Natural
size) (\s :: SizeConstraint
s@SizeConstraint' {} Natural
a -> SizeConstraint
s {$sel:size:SizeConstraint' :: Natural
size = Natural
a} :: SizeConstraint)

instance Data.FromJSON SizeConstraint where
  parseJSON :: Value -> Parser SizeConstraint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SizeConstraint"
      ( \Object
x ->
          FieldToMatch
-> TextTransformation
-> ComparisonOperator
-> Natural
-> SizeConstraint
SizeConstraint'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FieldToMatch")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TextTransformation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ComparisonOperator")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Size")
      )

instance Prelude.Hashable SizeConstraint where
  hashWithSalt :: Int -> SizeConstraint -> Int
hashWithSalt Int
_salt SizeConstraint' {Natural
ComparisonOperator
FieldToMatch
TextTransformation
size :: Natural
comparisonOperator :: ComparisonOperator
textTransformation :: TextTransformation
fieldToMatch :: FieldToMatch
$sel:size:SizeConstraint' :: SizeConstraint -> Natural
$sel:comparisonOperator:SizeConstraint' :: SizeConstraint -> ComparisonOperator
$sel:textTransformation:SizeConstraint' :: SizeConstraint -> TextTransformation
$sel:fieldToMatch:SizeConstraint' :: SizeConstraint -> FieldToMatch
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FieldToMatch
fieldToMatch
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TextTransformation
textTransformation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComparisonOperator
comparisonOperator
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
size

instance Prelude.NFData SizeConstraint where
  rnf :: SizeConstraint -> ()
rnf SizeConstraint' {Natural
ComparisonOperator
FieldToMatch
TextTransformation
size :: Natural
comparisonOperator :: ComparisonOperator
textTransformation :: TextTransformation
fieldToMatch :: FieldToMatch
$sel:size:SizeConstraint' :: SizeConstraint -> Natural
$sel:comparisonOperator:SizeConstraint' :: SizeConstraint -> ComparisonOperator
$sel:textTransformation:SizeConstraint' :: SizeConstraint -> TextTransformation
$sel:fieldToMatch:SizeConstraint' :: SizeConstraint -> FieldToMatch
..} =
    forall a. NFData a => a -> ()
Prelude.rnf FieldToMatch
fieldToMatch
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TextTransformation
textTransformation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComparisonOperator
comparisonOperator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
size

instance Data.ToJSON SizeConstraint where
  toJSON :: SizeConstraint -> Value
toJSON SizeConstraint' {Natural
ComparisonOperator
FieldToMatch
TextTransformation
size :: Natural
comparisonOperator :: ComparisonOperator
textTransformation :: TextTransformation
fieldToMatch :: FieldToMatch
$sel:size:SizeConstraint' :: SizeConstraint -> Natural
$sel:comparisonOperator:SizeConstraint' :: SizeConstraint -> ComparisonOperator
$sel:textTransformation:SizeConstraint' :: SizeConstraint -> TextTransformation
$sel:fieldToMatch:SizeConstraint' :: SizeConstraint -> FieldToMatch
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"FieldToMatch" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FieldToMatch
fieldToMatch),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TextTransformation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TextTransformation
textTransformation),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ComparisonOperator" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ComparisonOperator
comparisonOperator),
            forall a. a -> Maybe a
Prelude.Just (Key
"Size" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
size)
          ]
      )