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

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

-- | Contains information about the condition.
--
-- /See:/ 'newCondition' smart constructor.
data Condition = Condition'
  { -- | Represents the /equal/ condition to be applied to a single field when
    -- querying for findings.
    Condition -> Maybe [Text]
eq :: Prelude.Maybe [Prelude.Text],
    -- | Represents a /less than/ condition to be applied to a single field when
    -- querying for findings.
    Condition -> Maybe Integer
lessThan :: Prelude.Maybe Prelude.Integer,
    -- | Represents a /less than or equal/ condition to be applied to a single
    -- field when querying for findings.
    Condition -> Maybe Int
lte :: Prelude.Maybe Prelude.Int,
    -- | Represents a /greater than or equal/ condition to be applied to a single
    -- field when querying for findings.
    Condition -> Maybe Integer
greaterThanOrEqual :: Prelude.Maybe Prelude.Integer,
    -- | Represents a /less than or equal/ condition to be applied to a single
    -- field when querying for findings.
    Condition -> Maybe Integer
lessThanOrEqual :: Prelude.Maybe Prelude.Integer,
    -- | Represents a /greater than/ condition to be applied to a single field
    -- when querying for findings.
    Condition -> Maybe Int
gt :: Prelude.Maybe Prelude.Int,
    -- | Represents an /equal/ ____ condition to be applied to a single field
    -- when querying for findings.
    Condition -> Maybe [Text]
equals :: Prelude.Maybe [Prelude.Text],
    -- | Represents the /not equal/ condition to be applied to a single field
    -- when querying for findings.
    Condition -> Maybe [Text]
neq :: Prelude.Maybe [Prelude.Text],
    -- | Represents a /not equal/ ____ condition to be applied to a single field
    -- when querying for findings.
    Condition -> Maybe [Text]
notEquals :: Prelude.Maybe [Prelude.Text],
    -- | Represents a /less than/ condition to be applied to a single field when
    -- querying for findings.
    Condition -> Maybe Int
lt :: Prelude.Maybe Prelude.Int,
    -- | Represents a /greater than or equal/ condition to be applied to a single
    -- field when querying for findings.
    Condition -> Maybe Int
gte :: Prelude.Maybe Prelude.Int,
    -- | Represents a /greater than/ condition to be applied to a single field
    -- when querying for findings.
    Condition -> Maybe Integer
greaterThan :: Prelude.Maybe Prelude.Integer
  }
  deriving (Condition -> Condition -> Bool
(Condition -> Condition -> Bool)
-> (Condition -> Condition -> Bool) -> Eq Condition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Condition -> Condition -> Bool
$c/= :: Condition -> Condition -> Bool
== :: Condition -> Condition -> Bool
$c== :: Condition -> Condition -> Bool
Prelude.Eq, ReadPrec [Condition]
ReadPrec Condition
Int -> ReadS Condition
ReadS [Condition]
(Int -> ReadS Condition)
-> ReadS [Condition]
-> ReadPrec Condition
-> ReadPrec [Condition]
-> Read Condition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Condition]
$creadListPrec :: ReadPrec [Condition]
readPrec :: ReadPrec Condition
$creadPrec :: ReadPrec Condition
readList :: ReadS [Condition]
$creadList :: ReadS [Condition]
readsPrec :: Int -> ReadS Condition
$creadsPrec :: Int -> ReadS Condition
Prelude.Read, Int -> Condition -> ShowS
[Condition] -> ShowS
Condition -> String
(Int -> Condition -> ShowS)
-> (Condition -> String)
-> ([Condition] -> ShowS)
-> Show Condition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Condition] -> ShowS
$cshowList :: [Condition] -> ShowS
show :: Condition -> String
$cshow :: Condition -> String
showsPrec :: Int -> Condition -> ShowS
$cshowsPrec :: Int -> Condition -> ShowS
Prelude.Show, (forall x. Condition -> Rep Condition x)
-> (forall x. Rep Condition x -> Condition) -> Generic Condition
forall x. Rep Condition x -> Condition
forall x. Condition -> Rep Condition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Condition x -> Condition
$cfrom :: forall x. Condition -> Rep Condition x
Prelude.Generic)

-- |
-- Create a value of 'Condition' 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:
--
-- 'eq', 'condition_eq' - Represents the /equal/ condition to be applied to a single field when
-- querying for findings.
--
-- 'lessThan', 'condition_lessThan' - Represents a /less than/ condition to be applied to a single field when
-- querying for findings.
--
-- 'lte', 'condition_lte' - Represents a /less than or equal/ condition to be applied to a single
-- field when querying for findings.
--
-- 'greaterThanOrEqual', 'condition_greaterThanOrEqual' - Represents a /greater than or equal/ condition to be applied to a single
-- field when querying for findings.
--
-- 'lessThanOrEqual', 'condition_lessThanOrEqual' - Represents a /less than or equal/ condition to be applied to a single
-- field when querying for findings.
--
-- 'gt', 'condition_gt' - Represents a /greater than/ condition to be applied to a single field
-- when querying for findings.
--
-- 'equals', 'condition_equals' - Represents an /equal/ ____ condition to be applied to a single field
-- when querying for findings.
--
-- 'neq', 'condition_neq' - Represents the /not equal/ condition to be applied to a single field
-- when querying for findings.
--
-- 'notEquals', 'condition_notEquals' - Represents a /not equal/ ____ condition to be applied to a single field
-- when querying for findings.
--
-- 'lt', 'condition_lt' - Represents a /less than/ condition to be applied to a single field when
-- querying for findings.
--
-- 'gte', 'condition_gte' - Represents a /greater than or equal/ condition to be applied to a single
-- field when querying for findings.
--
-- 'greaterThan', 'condition_greaterThan' - Represents a /greater than/ condition to be applied to a single field
-- when querying for findings.
newCondition ::
  Condition
newCondition :: Condition
newCondition =
  Condition' :: Maybe [Text]
-> Maybe Integer
-> Maybe Int
-> Maybe Integer
-> Maybe Integer
-> Maybe Int
-> Maybe [Text]
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> Maybe Int
-> Maybe Integer
-> Condition
Condition'
    { $sel:eq:Condition' :: Maybe [Text]
eq = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:lessThan:Condition' :: Maybe Integer
lessThan = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:lte:Condition' :: Maybe Int
lte = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:greaterThanOrEqual:Condition' :: Maybe Integer
greaterThanOrEqual = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:lessThanOrEqual:Condition' :: Maybe Integer
lessThanOrEqual = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:gt:Condition' :: Maybe Int
gt = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:equals:Condition' :: Maybe [Text]
equals = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:neq:Condition' :: Maybe [Text]
neq = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:notEquals:Condition' :: Maybe [Text]
notEquals = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:lt:Condition' :: Maybe Int
lt = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:gte:Condition' :: Maybe Int
gte = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:greaterThan:Condition' :: Maybe Integer
greaterThan = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | Represents the /equal/ condition to be applied to a single field when
-- querying for findings.
condition_eq :: Lens.Lens' Condition (Prelude.Maybe [Prelude.Text])
condition_eq :: (Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition
condition_eq = (Condition -> Maybe [Text])
-> (Condition -> Maybe [Text] -> Condition)
-> Lens Condition Condition (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe [Text]
eq :: Maybe [Text]
$sel:eq:Condition' :: Condition -> Maybe [Text]
eq} -> Maybe [Text]
eq) (\s :: Condition
s@Condition' {} Maybe [Text]
a -> Condition
s {$sel:eq:Condition' :: Maybe [Text]
eq = Maybe [Text]
a} :: Condition) ((Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Condition
-> f Condition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | Represents a /less than or equal/ condition to be applied to a single
-- field when querying for findings.
condition_lte :: Lens.Lens' Condition (Prelude.Maybe Prelude.Int)
condition_lte :: (Maybe Int -> f (Maybe Int)) -> Condition -> f Condition
condition_lte = (Condition -> Maybe Int)
-> (Condition -> Maybe Int -> Condition)
-> Lens Condition Condition (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Int
lte :: Maybe Int
$sel:lte:Condition' :: Condition -> Maybe Int
lte} -> Maybe Int
lte) (\s :: Condition
s@Condition' {} Maybe Int
a -> Condition
s {$sel:lte:Condition' :: Maybe Int
lte = Maybe Int
a} :: Condition)

-- | Represents a /greater than or equal/ condition to be applied to a single
-- field when querying for findings.
condition_greaterThanOrEqual :: Lens.Lens' Condition (Prelude.Maybe Prelude.Integer)
condition_greaterThanOrEqual :: (Maybe Integer -> f (Maybe Integer)) -> Condition -> f Condition
condition_greaterThanOrEqual = (Condition -> Maybe Integer)
-> (Condition -> Maybe Integer -> Condition)
-> Lens Condition Condition (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Integer
greaterThanOrEqual :: Maybe Integer
$sel:greaterThanOrEqual:Condition' :: Condition -> Maybe Integer
greaterThanOrEqual} -> Maybe Integer
greaterThanOrEqual) (\s :: Condition
s@Condition' {} Maybe Integer
a -> Condition
s {$sel:greaterThanOrEqual:Condition' :: Maybe Integer
greaterThanOrEqual = Maybe Integer
a} :: Condition)

-- | Represents a /less than or equal/ condition to be applied to a single
-- field when querying for findings.
condition_lessThanOrEqual :: Lens.Lens' Condition (Prelude.Maybe Prelude.Integer)
condition_lessThanOrEqual :: (Maybe Integer -> f (Maybe Integer)) -> Condition -> f Condition
condition_lessThanOrEqual = (Condition -> Maybe Integer)
-> (Condition -> Maybe Integer -> Condition)
-> Lens Condition Condition (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Integer
lessThanOrEqual :: Maybe Integer
$sel:lessThanOrEqual:Condition' :: Condition -> Maybe Integer
lessThanOrEqual} -> Maybe Integer
lessThanOrEqual) (\s :: Condition
s@Condition' {} Maybe Integer
a -> Condition
s {$sel:lessThanOrEqual:Condition' :: Maybe Integer
lessThanOrEqual = Maybe Integer
a} :: Condition)

-- | Represents a /greater than/ condition to be applied to a single field
-- when querying for findings.
condition_gt :: Lens.Lens' Condition (Prelude.Maybe Prelude.Int)
condition_gt :: (Maybe Int -> f (Maybe Int)) -> Condition -> f Condition
condition_gt = (Condition -> Maybe Int)
-> (Condition -> Maybe Int -> Condition)
-> Lens Condition Condition (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Int
gt :: Maybe Int
$sel:gt:Condition' :: Condition -> Maybe Int
gt} -> Maybe Int
gt) (\s :: Condition
s@Condition' {} Maybe Int
a -> Condition
s {$sel:gt:Condition' :: Maybe Int
gt = Maybe Int
a} :: Condition)

-- | Represents an /equal/ ____ condition to be applied to a single field
-- when querying for findings.
condition_equals :: Lens.Lens' Condition (Prelude.Maybe [Prelude.Text])
condition_equals :: (Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition
condition_equals = (Condition -> Maybe [Text])
-> (Condition -> Maybe [Text] -> Condition)
-> Lens Condition Condition (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe [Text]
equals :: Maybe [Text]
$sel:equals:Condition' :: Condition -> Maybe [Text]
equals} -> Maybe [Text]
equals) (\s :: Condition
s@Condition' {} Maybe [Text]
a -> Condition
s {$sel:equals:Condition' :: Maybe [Text]
equals = Maybe [Text]
a} :: Condition) ((Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Condition
-> f Condition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Represents the /not equal/ condition to be applied to a single field
-- when querying for findings.
condition_neq :: Lens.Lens' Condition (Prelude.Maybe [Prelude.Text])
condition_neq :: (Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition
condition_neq = (Condition -> Maybe [Text])
-> (Condition -> Maybe [Text] -> Condition)
-> Lens Condition Condition (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe [Text]
neq :: Maybe [Text]
$sel:neq:Condition' :: Condition -> Maybe [Text]
neq} -> Maybe [Text]
neq) (\s :: Condition
s@Condition' {} Maybe [Text]
a -> Condition
s {$sel:neq:Condition' :: Maybe [Text]
neq = Maybe [Text]
a} :: Condition) ((Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Condition
-> f Condition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Represents a /not equal/ ____ condition to be applied to a single field
-- when querying for findings.
condition_notEquals :: Lens.Lens' Condition (Prelude.Maybe [Prelude.Text])
condition_notEquals :: (Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition
condition_notEquals = (Condition -> Maybe [Text])
-> (Condition -> Maybe [Text] -> Condition)
-> Lens Condition Condition (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe [Text]
notEquals :: Maybe [Text]
$sel:notEquals:Condition' :: Condition -> Maybe [Text]
notEquals} -> Maybe [Text]
notEquals) (\s :: Condition
s@Condition' {} Maybe [Text]
a -> Condition
s {$sel:notEquals:Condition' :: Maybe [Text]
notEquals = Maybe [Text]
a} :: Condition) ((Maybe [Text] -> f (Maybe [Text])) -> Condition -> f Condition)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Condition
-> f Condition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Represents a /less than/ condition to be applied to a single field when
-- querying for findings.
condition_lt :: Lens.Lens' Condition (Prelude.Maybe Prelude.Int)
condition_lt :: (Maybe Int -> f (Maybe Int)) -> Condition -> f Condition
condition_lt = (Condition -> Maybe Int)
-> (Condition -> Maybe Int -> Condition)
-> Lens Condition Condition (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Int
lt :: Maybe Int
$sel:lt:Condition' :: Condition -> Maybe Int
lt} -> Maybe Int
lt) (\s :: Condition
s@Condition' {} Maybe Int
a -> Condition
s {$sel:lt:Condition' :: Maybe Int
lt = Maybe Int
a} :: Condition)

-- | Represents a /greater than or equal/ condition to be applied to a single
-- field when querying for findings.
condition_gte :: Lens.Lens' Condition (Prelude.Maybe Prelude.Int)
condition_gte :: (Maybe Int -> f (Maybe Int)) -> Condition -> f Condition
condition_gte = (Condition -> Maybe Int)
-> (Condition -> Maybe Int -> Condition)
-> Lens Condition Condition (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Int
gte :: Maybe Int
$sel:gte:Condition' :: Condition -> Maybe Int
gte} -> Maybe Int
gte) (\s :: Condition
s@Condition' {} Maybe Int
a -> Condition
s {$sel:gte:Condition' :: Maybe Int
gte = Maybe Int
a} :: Condition)

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

instance Core.FromJSON Condition where
  parseJSON :: Value -> Parser Condition
parseJSON =
    String -> (Object -> Parser Condition) -> Value -> Parser Condition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Condition"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Integer
-> Maybe Int
-> Maybe Integer
-> Maybe Integer
-> Maybe Int
-> Maybe [Text]
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> Maybe Int
-> Maybe Integer
-> Condition
Condition'
            (Maybe [Text]
 -> Maybe Integer
 -> Maybe Int
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Int
 -> Maybe [Text]
 -> Maybe [Text]
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Int
 -> Maybe Integer
 -> Condition)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Integer
      -> Maybe Int
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eq" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Integer
   -> Maybe Int
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Int
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
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
"lessThan")
            Parser
  (Maybe Int
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe Int)
-> Parser
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lte")
            Parser
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Int
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
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
"greaterThanOrEqual")
            Parser
  (Maybe Integer
   -> Maybe Int
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Int
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
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
"lessThanOrEqual")
            Parser
  (Maybe Int
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe Int)
-> Parser
     (Maybe [Text]
      -> Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"gt")
            Parser
  (Maybe [Text]
   -> Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text]
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Integer
      -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"equals" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [Text]
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Integer
   -> Condition)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text]
      -> Maybe Int -> Maybe Int -> Maybe Integer -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"neq" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [Text]
   -> Maybe Int -> Maybe Int -> Maybe Integer -> Condition)
-> Parser (Maybe [Text])
-> Parser (Maybe Int -> Maybe Int -> Maybe Integer -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"notEquals" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Int -> Maybe Int -> Maybe Integer -> Condition)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Integer -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lt")
            Parser (Maybe Int -> Maybe Integer -> Condition)
-> Parser (Maybe Int) -> Parser (Maybe Integer -> Condition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"gte")
            Parser (Maybe Integer -> Condition)
-> Parser (Maybe Integer) -> Parser Condition
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
"greaterThan")
      )

instance Prelude.Hashable Condition

instance Prelude.NFData Condition

instance Core.ToJSON Condition where
  toJSON :: Condition -> Value
toJSON Condition' {Maybe Int
Maybe Integer
Maybe [Text]
greaterThan :: Maybe Integer
gte :: Maybe Int
lt :: Maybe Int
notEquals :: Maybe [Text]
neq :: Maybe [Text]
equals :: Maybe [Text]
gt :: Maybe Int
lessThanOrEqual :: Maybe Integer
greaterThanOrEqual :: Maybe Integer
lte :: Maybe Int
lessThan :: Maybe Integer
eq :: Maybe [Text]
$sel:greaterThan:Condition' :: Condition -> Maybe Integer
$sel:gte:Condition' :: Condition -> Maybe Int
$sel:lt:Condition' :: Condition -> Maybe Int
$sel:notEquals:Condition' :: Condition -> Maybe [Text]
$sel:neq:Condition' :: Condition -> Maybe [Text]
$sel:equals:Condition' :: Condition -> Maybe [Text]
$sel:gt:Condition' :: Condition -> Maybe Int
$sel:lessThanOrEqual:Condition' :: Condition -> Maybe Integer
$sel:greaterThanOrEqual:Condition' :: Condition -> Maybe Integer
$sel:lte:Condition' :: Condition -> Maybe Int
$sel:lessThan:Condition' :: Condition -> Maybe Integer
$sel:eq:Condition' :: Condition -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"eq" 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]
eq,
            (Text
"lessThan" 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
lessThan,
            (Text
"lte" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
lte,
            (Text
"greaterThanOrEqual" 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
greaterThanOrEqual,
            (Text
"lessThanOrEqual" 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
lessThanOrEqual,
            (Text
"gt" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
gt,
            (Text
"equals" 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]
equals,
            (Text
"neq" 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]
neq,
            (Text
"notEquals" 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]
notEquals,
            (Text
"lt" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
lt,
            (Text
"gte" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
gte,
            (Text
"greaterThan" 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
greaterThan
          ]
      )