{-# 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.Connect.Types.SecurityProfileSearchCriteria
-- 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.Connect.Types.SecurityProfileSearchCriteria where

import Amazonka.Connect.Types.StringCondition
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

-- | The search criteria to be used to return security profiles.
--
-- The @name@ field support \"contains\" queries with a minimum of 2
-- characters and maximum of 25 characters. Any queries with character
-- lengths outside of this range will throw invalid results.
--
-- /See:/ 'newSecurityProfileSearchCriteria' smart constructor.
data SecurityProfileSearchCriteria = SecurityProfileSearchCriteria'
  { -- | A list of conditions which would be applied together with an AND
    -- condition.
    SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
andConditions :: Prelude.Maybe [SecurityProfileSearchCriteria],
    -- | A list of conditions which would be applied together with an OR
    -- condition.
    SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
orConditions :: Prelude.Maybe [SecurityProfileSearchCriteria],
    SecurityProfileSearchCriteria -> Maybe StringCondition
stringCondition :: Prelude.Maybe StringCondition
  }
  deriving (SecurityProfileSearchCriteria
-> SecurityProfileSearchCriteria -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityProfileSearchCriteria
-> SecurityProfileSearchCriteria -> Bool
$c/= :: SecurityProfileSearchCriteria
-> SecurityProfileSearchCriteria -> Bool
== :: SecurityProfileSearchCriteria
-> SecurityProfileSearchCriteria -> Bool
$c== :: SecurityProfileSearchCriteria
-> SecurityProfileSearchCriteria -> Bool
Prelude.Eq, ReadPrec [SecurityProfileSearchCriteria]
ReadPrec SecurityProfileSearchCriteria
Int -> ReadS SecurityProfileSearchCriteria
ReadS [SecurityProfileSearchCriteria]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityProfileSearchCriteria]
$creadListPrec :: ReadPrec [SecurityProfileSearchCriteria]
readPrec :: ReadPrec SecurityProfileSearchCriteria
$creadPrec :: ReadPrec SecurityProfileSearchCriteria
readList :: ReadS [SecurityProfileSearchCriteria]
$creadList :: ReadS [SecurityProfileSearchCriteria]
readsPrec :: Int -> ReadS SecurityProfileSearchCriteria
$creadsPrec :: Int -> ReadS SecurityProfileSearchCriteria
Prelude.Read, Int -> SecurityProfileSearchCriteria -> ShowS
[SecurityProfileSearchCriteria] -> ShowS
SecurityProfileSearchCriteria -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityProfileSearchCriteria] -> ShowS
$cshowList :: [SecurityProfileSearchCriteria] -> ShowS
show :: SecurityProfileSearchCriteria -> String
$cshow :: SecurityProfileSearchCriteria -> String
showsPrec :: Int -> SecurityProfileSearchCriteria -> ShowS
$cshowsPrec :: Int -> SecurityProfileSearchCriteria -> ShowS
Prelude.Show, forall x.
Rep SecurityProfileSearchCriteria x
-> SecurityProfileSearchCriteria
forall x.
SecurityProfileSearchCriteria
-> Rep SecurityProfileSearchCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SecurityProfileSearchCriteria x
-> SecurityProfileSearchCriteria
$cfrom :: forall x.
SecurityProfileSearchCriteria
-> Rep SecurityProfileSearchCriteria x
Prelude.Generic)

-- |
-- Create a value of 'SecurityProfileSearchCriteria' 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:
--
-- 'andConditions', 'securityProfileSearchCriteria_andConditions' - A list of conditions which would be applied together with an AND
-- condition.
--
-- 'orConditions', 'securityProfileSearchCriteria_orConditions' - A list of conditions which would be applied together with an OR
-- condition.
--
-- 'stringCondition', 'securityProfileSearchCriteria_stringCondition' - Undocumented member.
newSecurityProfileSearchCriteria ::
  SecurityProfileSearchCriteria
newSecurityProfileSearchCriteria :: SecurityProfileSearchCriteria
newSecurityProfileSearchCriteria =
  SecurityProfileSearchCriteria'
    { $sel:andConditions:SecurityProfileSearchCriteria' :: Maybe [SecurityProfileSearchCriteria]
andConditions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:orConditions:SecurityProfileSearchCriteria' :: Maybe [SecurityProfileSearchCriteria]
orConditions = forall a. Maybe a
Prelude.Nothing,
      $sel:stringCondition:SecurityProfileSearchCriteria' :: Maybe StringCondition
stringCondition = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of conditions which would be applied together with an AND
-- condition.
securityProfileSearchCriteria_andConditions :: Lens.Lens' SecurityProfileSearchCriteria (Prelude.Maybe [SecurityProfileSearchCriteria])
securityProfileSearchCriteria_andConditions :: Lens'
  SecurityProfileSearchCriteria
  (Maybe [SecurityProfileSearchCriteria])
securityProfileSearchCriteria_andConditions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityProfileSearchCriteria' {Maybe [SecurityProfileSearchCriteria]
andConditions :: Maybe [SecurityProfileSearchCriteria]
$sel:andConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
andConditions} -> Maybe [SecurityProfileSearchCriteria]
andConditions) (\s :: SecurityProfileSearchCriteria
s@SecurityProfileSearchCriteria' {} Maybe [SecurityProfileSearchCriteria]
a -> SecurityProfileSearchCriteria
s {$sel:andConditions:SecurityProfileSearchCriteria' :: Maybe [SecurityProfileSearchCriteria]
andConditions = Maybe [SecurityProfileSearchCriteria]
a} :: SecurityProfileSearchCriteria) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of conditions which would be applied together with an OR
-- condition.
securityProfileSearchCriteria_orConditions :: Lens.Lens' SecurityProfileSearchCriteria (Prelude.Maybe [SecurityProfileSearchCriteria])
securityProfileSearchCriteria_orConditions :: Lens'
  SecurityProfileSearchCriteria
  (Maybe [SecurityProfileSearchCriteria])
securityProfileSearchCriteria_orConditions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityProfileSearchCriteria' {Maybe [SecurityProfileSearchCriteria]
orConditions :: Maybe [SecurityProfileSearchCriteria]
$sel:orConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
orConditions} -> Maybe [SecurityProfileSearchCriteria]
orConditions) (\s :: SecurityProfileSearchCriteria
s@SecurityProfileSearchCriteria' {} Maybe [SecurityProfileSearchCriteria]
a -> SecurityProfileSearchCriteria
s {$sel:orConditions:SecurityProfileSearchCriteria' :: Maybe [SecurityProfileSearchCriteria]
orConditions = Maybe [SecurityProfileSearchCriteria]
a} :: SecurityProfileSearchCriteria) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
securityProfileSearchCriteria_stringCondition :: Lens.Lens' SecurityProfileSearchCriteria (Prelude.Maybe StringCondition)
securityProfileSearchCriteria_stringCondition :: Lens' SecurityProfileSearchCriteria (Maybe StringCondition)
securityProfileSearchCriteria_stringCondition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityProfileSearchCriteria' {Maybe StringCondition
stringCondition :: Maybe StringCondition
$sel:stringCondition:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria -> Maybe StringCondition
stringCondition} -> Maybe StringCondition
stringCondition) (\s :: SecurityProfileSearchCriteria
s@SecurityProfileSearchCriteria' {} Maybe StringCondition
a -> SecurityProfileSearchCriteria
s {$sel:stringCondition:SecurityProfileSearchCriteria' :: Maybe StringCondition
stringCondition = Maybe StringCondition
a} :: SecurityProfileSearchCriteria)

instance
  Prelude.Hashable
    SecurityProfileSearchCriteria
  where
  hashWithSalt :: Int -> SecurityProfileSearchCriteria -> Int
hashWithSalt Int
_salt SecurityProfileSearchCriteria' {Maybe [SecurityProfileSearchCriteria]
Maybe StringCondition
stringCondition :: Maybe StringCondition
orConditions :: Maybe [SecurityProfileSearchCriteria]
andConditions :: Maybe [SecurityProfileSearchCriteria]
$sel:stringCondition:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria -> Maybe StringCondition
$sel:orConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
$sel:andConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SecurityProfileSearchCriteria]
andConditions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SecurityProfileSearchCriteria]
orConditions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StringCondition
stringCondition

instance Prelude.NFData SecurityProfileSearchCriteria where
  rnf :: SecurityProfileSearchCriteria -> ()
rnf SecurityProfileSearchCriteria' {Maybe [SecurityProfileSearchCriteria]
Maybe StringCondition
stringCondition :: Maybe StringCondition
orConditions :: Maybe [SecurityProfileSearchCriteria]
andConditions :: Maybe [SecurityProfileSearchCriteria]
$sel:stringCondition:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria -> Maybe StringCondition
$sel:orConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
$sel:andConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SecurityProfileSearchCriteria]
andConditions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SecurityProfileSearchCriteria]
orConditions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StringCondition
stringCondition

instance Data.ToJSON SecurityProfileSearchCriteria where
  toJSON :: SecurityProfileSearchCriteria -> Value
toJSON SecurityProfileSearchCriteria' {Maybe [SecurityProfileSearchCriteria]
Maybe StringCondition
stringCondition :: Maybe StringCondition
orConditions :: Maybe [SecurityProfileSearchCriteria]
andConditions :: Maybe [SecurityProfileSearchCriteria]
$sel:stringCondition:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria -> Maybe StringCondition
$sel:orConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
$sel:andConditions:SecurityProfileSearchCriteria' :: SecurityProfileSearchCriteria
-> Maybe [SecurityProfileSearchCriteria]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AndConditions" 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 [SecurityProfileSearchCriteria]
andConditions,
            (Key
"OrConditions" 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 [SecurityProfileSearchCriteria]
orConditions,
            (Key
"StringCondition" 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 StringCondition
stringCondition
          ]
      )