{-# 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.SSMIncidents.Types.AttributeValueList
-- 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.SSMIncidents.Types.AttributeValueList 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

-- | Use the AttributeValueList to filter by string or integer values.
--
-- /See:/ 'newAttributeValueList' smart constructor.
data AttributeValueList = AttributeValueList'
  { -- | The list of integer values that the filter matches.
    AttributeValueList -> Maybe [Int]
integerValues :: Prelude.Maybe [Prelude.Int],
    -- | The list of string values that the filter matches.
    AttributeValueList -> Maybe [Text]
stringValues :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AttributeValueList -> AttributeValueList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeValueList -> AttributeValueList -> Bool
$c/= :: AttributeValueList -> AttributeValueList -> Bool
== :: AttributeValueList -> AttributeValueList -> Bool
$c== :: AttributeValueList -> AttributeValueList -> Bool
Prelude.Eq, ReadPrec [AttributeValueList]
ReadPrec AttributeValueList
Int -> ReadS AttributeValueList
ReadS [AttributeValueList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeValueList]
$creadListPrec :: ReadPrec [AttributeValueList]
readPrec :: ReadPrec AttributeValueList
$creadPrec :: ReadPrec AttributeValueList
readList :: ReadS [AttributeValueList]
$creadList :: ReadS [AttributeValueList]
readsPrec :: Int -> ReadS AttributeValueList
$creadsPrec :: Int -> ReadS AttributeValueList
Prelude.Read, Int -> AttributeValueList -> ShowS
[AttributeValueList] -> ShowS
AttributeValueList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeValueList] -> ShowS
$cshowList :: [AttributeValueList] -> ShowS
show :: AttributeValueList -> String
$cshow :: AttributeValueList -> String
showsPrec :: Int -> AttributeValueList -> ShowS
$cshowsPrec :: Int -> AttributeValueList -> ShowS
Prelude.Show, forall x. Rep AttributeValueList x -> AttributeValueList
forall x. AttributeValueList -> Rep AttributeValueList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeValueList x -> AttributeValueList
$cfrom :: forall x. AttributeValueList -> Rep AttributeValueList x
Prelude.Generic)

-- |
-- Create a value of 'AttributeValueList' 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:
--
-- 'integerValues', 'attributeValueList_integerValues' - The list of integer values that the filter matches.
--
-- 'stringValues', 'attributeValueList_stringValues' - The list of string values that the filter matches.
newAttributeValueList ::
  AttributeValueList
newAttributeValueList :: AttributeValueList
newAttributeValueList =
  AttributeValueList'
    { $sel:integerValues:AttributeValueList' :: Maybe [Int]
integerValues =
        forall a. Maybe a
Prelude.Nothing,
      $sel:stringValues:AttributeValueList' :: Maybe [Text]
stringValues = forall a. Maybe a
Prelude.Nothing
    }

-- | The list of integer values that the filter matches.
attributeValueList_integerValues :: Lens.Lens' AttributeValueList (Prelude.Maybe [Prelude.Int])
attributeValueList_integerValues :: Lens' AttributeValueList (Maybe [Int])
attributeValueList_integerValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValueList' {Maybe [Int]
integerValues :: Maybe [Int]
$sel:integerValues:AttributeValueList' :: AttributeValueList -> Maybe [Int]
integerValues} -> Maybe [Int]
integerValues) (\s :: AttributeValueList
s@AttributeValueList' {} Maybe [Int]
a -> AttributeValueList
s {$sel:integerValues:AttributeValueList' :: Maybe [Int]
integerValues = Maybe [Int]
a} :: AttributeValueList) 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

-- | The list of string values that the filter matches.
attributeValueList_stringValues :: Lens.Lens' AttributeValueList (Prelude.Maybe [Prelude.Text])
attributeValueList_stringValues :: Lens' AttributeValueList (Maybe [Text])
attributeValueList_stringValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValueList' {Maybe [Text]
stringValues :: Maybe [Text]
$sel:stringValues:AttributeValueList' :: AttributeValueList -> Maybe [Text]
stringValues} -> Maybe [Text]
stringValues) (\s :: AttributeValueList
s@AttributeValueList' {} Maybe [Text]
a -> AttributeValueList
s {$sel:stringValues:AttributeValueList' :: Maybe [Text]
stringValues = Maybe [Text]
a} :: AttributeValueList) 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

instance Prelude.Hashable AttributeValueList where
  hashWithSalt :: Int -> AttributeValueList -> Int
hashWithSalt Int
_salt AttributeValueList' {Maybe [Int]
Maybe [Text]
stringValues :: Maybe [Text]
integerValues :: Maybe [Int]
$sel:stringValues:AttributeValueList' :: AttributeValueList -> Maybe [Text]
$sel:integerValues:AttributeValueList' :: AttributeValueList -> Maybe [Int]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Int]
integerValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
stringValues

instance Prelude.NFData AttributeValueList where
  rnf :: AttributeValueList -> ()
rnf AttributeValueList' {Maybe [Int]
Maybe [Text]
stringValues :: Maybe [Text]
integerValues :: Maybe [Int]
$sel:stringValues:AttributeValueList' :: AttributeValueList -> Maybe [Text]
$sel:integerValues:AttributeValueList' :: AttributeValueList -> Maybe [Int]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Int]
integerValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
stringValues

instance Data.ToJSON AttributeValueList where
  toJSON :: AttributeValueList -> Value
toJSON AttributeValueList' {Maybe [Int]
Maybe [Text]
stringValues :: Maybe [Text]
integerValues :: Maybe [Int]
$sel:stringValues:AttributeValueList' :: AttributeValueList -> Maybe [Text]
$sel:integerValues:AttributeValueList' :: AttributeValueList -> Maybe [Int]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"integerValues" 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 [Int]
integerValues,
            (Key
"stringValues" 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]
stringValues
          ]
      )