{-# 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.GuardDuty.Types.FilterCondition
-- 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.GuardDuty.Types.FilterCondition 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

-- | Contains information about the condition.
--
-- /See:/ 'newFilterCondition' smart constructor.
data FilterCondition = FilterCondition'
  { -- | Represents an /equal/ ____ condition to be applied to a single field
    -- when querying for scan entries.
    FilterCondition -> Maybe Text
equalsValue :: Prelude.Maybe Prelude.Text,
    -- | Represents a /greater than/ condition to be applied to a single field
    -- when querying for scan entries.
    FilterCondition -> Maybe Integer
greaterThan :: Prelude.Maybe Prelude.Integer,
    -- | Represents a /less than/ condition to be applied to a single field when
    -- querying for scan entries.
    FilterCondition -> Maybe Integer
lessThan :: Prelude.Maybe Prelude.Integer
  }
  deriving (FilterCondition -> FilterCondition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FilterCondition -> FilterCondition -> Bool
$c/= :: FilterCondition -> FilterCondition -> Bool
== :: FilterCondition -> FilterCondition -> Bool
$c== :: FilterCondition -> FilterCondition -> Bool
Prelude.Eq, ReadPrec [FilterCondition]
ReadPrec FilterCondition
Int -> ReadS FilterCondition
ReadS [FilterCondition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FilterCondition]
$creadListPrec :: ReadPrec [FilterCondition]
readPrec :: ReadPrec FilterCondition
$creadPrec :: ReadPrec FilterCondition
readList :: ReadS [FilterCondition]
$creadList :: ReadS [FilterCondition]
readsPrec :: Int -> ReadS FilterCondition
$creadsPrec :: Int -> ReadS FilterCondition
Prelude.Read, Int -> FilterCondition -> ShowS
[FilterCondition] -> ShowS
FilterCondition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FilterCondition] -> ShowS
$cshowList :: [FilterCondition] -> ShowS
show :: FilterCondition -> String
$cshow :: FilterCondition -> String
showsPrec :: Int -> FilterCondition -> ShowS
$cshowsPrec :: Int -> FilterCondition -> ShowS
Prelude.Show, forall x. Rep FilterCondition x -> FilterCondition
forall x. FilterCondition -> Rep FilterCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FilterCondition x -> FilterCondition
$cfrom :: forall x. FilterCondition -> Rep FilterCondition x
Prelude.Generic)

-- |
-- Create a value of 'FilterCondition' 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:
--
-- 'equalsValue', 'filterCondition_equalsValue' - Represents an /equal/ ____ condition to be applied to a single field
-- when querying for scan entries.
--
-- 'greaterThan', 'filterCondition_greaterThan' - Represents a /greater than/ condition to be applied to a single field
-- when querying for scan entries.
--
-- 'lessThan', 'filterCondition_lessThan' - Represents a /less than/ condition to be applied to a single field when
-- querying for scan entries.
newFilterCondition ::
  FilterCondition
newFilterCondition :: FilterCondition
newFilterCondition =
  FilterCondition'
    { $sel:equalsValue:FilterCondition' :: Maybe Text
equalsValue = forall a. Maybe a
Prelude.Nothing,
      $sel:greaterThan:FilterCondition' :: Maybe Integer
greaterThan = forall a. Maybe a
Prelude.Nothing,
      $sel:lessThan:FilterCondition' :: Maybe Integer
lessThan = forall a. Maybe a
Prelude.Nothing
    }

-- | Represents an /equal/ ____ condition to be applied to a single field
-- when querying for scan entries.
filterCondition_equalsValue :: Lens.Lens' FilterCondition (Prelude.Maybe Prelude.Text)
filterCondition_equalsValue :: Lens' FilterCondition (Maybe Text)
filterCondition_equalsValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterCondition' {Maybe Text
equalsValue :: Maybe Text
$sel:equalsValue:FilterCondition' :: FilterCondition -> Maybe Text
equalsValue} -> Maybe Text
equalsValue) (\s :: FilterCondition
s@FilterCondition' {} Maybe Text
a -> FilterCondition
s {$sel:equalsValue:FilterCondition' :: Maybe Text
equalsValue = Maybe Text
a} :: FilterCondition)

-- | Represents a /greater than/ condition to be applied to a single field
-- when querying for scan entries.
filterCondition_greaterThan :: Lens.Lens' FilterCondition (Prelude.Maybe Prelude.Integer)
filterCondition_greaterThan :: Lens' FilterCondition (Maybe Integer)
filterCondition_greaterThan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterCondition' {Maybe Integer
greaterThan :: Maybe Integer
$sel:greaterThan:FilterCondition' :: FilterCondition -> Maybe Integer
greaterThan} -> Maybe Integer
greaterThan) (\s :: FilterCondition
s@FilterCondition' {} Maybe Integer
a -> FilterCondition
s {$sel:greaterThan:FilterCondition' :: Maybe Integer
greaterThan = Maybe Integer
a} :: FilterCondition)

-- | Represents a /less than/ condition to be applied to a single field when
-- querying for scan entries.
filterCondition_lessThan :: Lens.Lens' FilterCondition (Prelude.Maybe Prelude.Integer)
filterCondition_lessThan :: Lens' FilterCondition (Maybe Integer)
filterCondition_lessThan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterCondition' {Maybe Integer
lessThan :: Maybe Integer
$sel:lessThan:FilterCondition' :: FilterCondition -> Maybe Integer
lessThan} -> Maybe Integer
lessThan) (\s :: FilterCondition
s@FilterCondition' {} Maybe Integer
a -> FilterCondition
s {$sel:lessThan:FilterCondition' :: Maybe Integer
lessThan = Maybe Integer
a} :: FilterCondition)

instance Prelude.Hashable FilterCondition where
  hashWithSalt :: Int -> FilterCondition -> Int
hashWithSalt Int
_salt FilterCondition' {Maybe Integer
Maybe Text
lessThan :: Maybe Integer
greaterThan :: Maybe Integer
equalsValue :: Maybe Text
$sel:lessThan:FilterCondition' :: FilterCondition -> Maybe Integer
$sel:greaterThan:FilterCondition' :: FilterCondition -> Maybe Integer
$sel:equalsValue:FilterCondition' :: FilterCondition -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
equalsValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
greaterThan
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
lessThan

instance Prelude.NFData FilterCondition where
  rnf :: FilterCondition -> ()
rnf FilterCondition' {Maybe Integer
Maybe Text
lessThan :: Maybe Integer
greaterThan :: Maybe Integer
equalsValue :: Maybe Text
$sel:lessThan:FilterCondition' :: FilterCondition -> Maybe Integer
$sel:greaterThan:FilterCondition' :: FilterCondition -> Maybe Integer
$sel:equalsValue:FilterCondition' :: FilterCondition -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
equalsValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
greaterThan
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
lessThan

instance Data.ToJSON FilterCondition where
  toJSON :: FilterCondition -> Value
toJSON FilterCondition' {Maybe Integer
Maybe Text
lessThan :: Maybe Integer
greaterThan :: Maybe Integer
equalsValue :: Maybe Text
$sel:lessThan:FilterCondition' :: FilterCondition -> Maybe Integer
$sel:greaterThan:FilterCondition' :: FilterCondition -> Maybe Integer
$sel:equalsValue:FilterCondition' :: FilterCondition -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"equalsValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
equalsValue,
            (Key
"greaterThan" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
greaterThan,
            (Key
"lessThan" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
lessThan
          ]
      )