{-# 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.Personalize.Types.FilterSummary
-- 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.Personalize.Types.FilterSummary 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

-- | A short summary of a filter\'s attributes.
--
-- /See:/ 'newFilterSummary' smart constructor.
data FilterSummary = FilterSummary'
  { -- | The time at which the filter was created.
    FilterSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Data.POSIX,
    -- | The ARN of the dataset group to which the filter belongs.
    FilterSummary -> Maybe Text
datasetGroupArn :: Prelude.Maybe Prelude.Text,
    -- | If the filter failed, the reason for the failure.
    FilterSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the filter.
    FilterSummary -> Maybe Text
filterArn :: Prelude.Maybe Prelude.Text,
    -- | The time at which the filter was last updated.
    FilterSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the filter.
    FilterSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The status of the filter.
    FilterSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (FilterSummary -> FilterSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FilterSummary -> FilterSummary -> Bool
$c/= :: FilterSummary -> FilterSummary -> Bool
== :: FilterSummary -> FilterSummary -> Bool
$c== :: FilterSummary -> FilterSummary -> Bool
Prelude.Eq, ReadPrec [FilterSummary]
ReadPrec FilterSummary
Int -> ReadS FilterSummary
ReadS [FilterSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FilterSummary]
$creadListPrec :: ReadPrec [FilterSummary]
readPrec :: ReadPrec FilterSummary
$creadPrec :: ReadPrec FilterSummary
readList :: ReadS [FilterSummary]
$creadList :: ReadS [FilterSummary]
readsPrec :: Int -> ReadS FilterSummary
$creadsPrec :: Int -> ReadS FilterSummary
Prelude.Read, Int -> FilterSummary -> ShowS
[FilterSummary] -> ShowS
FilterSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FilterSummary] -> ShowS
$cshowList :: [FilterSummary] -> ShowS
show :: FilterSummary -> String
$cshow :: FilterSummary -> String
showsPrec :: Int -> FilterSummary -> ShowS
$cshowsPrec :: Int -> FilterSummary -> ShowS
Prelude.Show, forall x. Rep FilterSummary x -> FilterSummary
forall x. FilterSummary -> Rep FilterSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FilterSummary x -> FilterSummary
$cfrom :: forall x. FilterSummary -> Rep FilterSummary x
Prelude.Generic)

-- |
-- Create a value of 'FilterSummary' 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:
--
-- 'creationDateTime', 'filterSummary_creationDateTime' - The time at which the filter was created.
--
-- 'datasetGroupArn', 'filterSummary_datasetGroupArn' - The ARN of the dataset group to which the filter belongs.
--
-- 'failureReason', 'filterSummary_failureReason' - If the filter failed, the reason for the failure.
--
-- 'filterArn', 'filterSummary_filterArn' - The ARN of the filter.
--
-- 'lastUpdatedDateTime', 'filterSummary_lastUpdatedDateTime' - The time at which the filter was last updated.
--
-- 'name', 'filterSummary_name' - The name of the filter.
--
-- 'status', 'filterSummary_status' - The status of the filter.
newFilterSummary ::
  FilterSummary
newFilterSummary :: FilterSummary
newFilterSummary =
  FilterSummary'
    { $sel:creationDateTime:FilterSummary' :: Maybe POSIX
creationDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:datasetGroupArn:FilterSummary' :: Maybe Text
datasetGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:FilterSummary' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
      $sel:filterArn:FilterSummary' :: Maybe Text
filterArn = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:FilterSummary' :: Maybe POSIX
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:FilterSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:FilterSummary' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The time at which the filter was created.
filterSummary_creationDateTime :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.UTCTime)
filterSummary_creationDateTime :: Lens' FilterSummary (Maybe UTCTime)
filterSummary_creationDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: FilterSummary
s@FilterSummary' {} Maybe POSIX
a -> FilterSummary
s {$sel:creationDateTime:FilterSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: FilterSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ARN of the dataset group to which the filter belongs.
filterSummary_datasetGroupArn :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_datasetGroupArn :: Lens' FilterSummary (Maybe Text)
filterSummary_datasetGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
datasetGroupArn :: Maybe Text
$sel:datasetGroupArn:FilterSummary' :: FilterSummary -> Maybe Text
datasetGroupArn} -> Maybe Text
datasetGroupArn) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:datasetGroupArn:FilterSummary' :: Maybe Text
datasetGroupArn = Maybe Text
a} :: FilterSummary)

-- | If the filter failed, the reason for the failure.
filterSummary_failureReason :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_failureReason :: Lens' FilterSummary (Maybe Text)
filterSummary_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:FilterSummary' :: FilterSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:failureReason:FilterSummary' :: Maybe Text
failureReason = Maybe Text
a} :: FilterSummary)

-- | The ARN of the filter.
filterSummary_filterArn :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_filterArn :: Lens' FilterSummary (Maybe Text)
filterSummary_filterArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
filterArn :: Maybe Text
$sel:filterArn:FilterSummary' :: FilterSummary -> Maybe Text
filterArn} -> Maybe Text
filterArn) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:filterArn:FilterSummary' :: Maybe Text
filterArn = Maybe Text
a} :: FilterSummary)

-- | The time at which the filter was last updated.
filterSummary_lastUpdatedDateTime :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.UTCTime)
filterSummary_lastUpdatedDateTime :: Lens' FilterSummary (Maybe UTCTime)
filterSummary_lastUpdatedDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: FilterSummary
s@FilterSummary' {} Maybe POSIX
a -> FilterSummary
s {$sel:lastUpdatedDateTime:FilterSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: FilterSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the filter.
filterSummary_name :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_name :: Lens' FilterSummary (Maybe Text)
filterSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
name :: Maybe Text
$sel:name:FilterSummary' :: FilterSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:name:FilterSummary' :: Maybe Text
name = Maybe Text
a} :: FilterSummary)

-- | The status of the filter.
filterSummary_status :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_status :: Lens' FilterSummary (Maybe Text)
filterSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
status :: Maybe Text
$sel:status:FilterSummary' :: FilterSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:status:FilterSummary' :: Maybe Text
status = Maybe Text
a} :: FilterSummary)

instance Data.FromJSON FilterSummary where
  parseJSON :: Value -> Parser FilterSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FilterSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> FilterSummary
FilterSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"creationDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"datasetGroupArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"failureReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"filterArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastUpdatedDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
      )

instance Prelude.Hashable FilterSummary where
  hashWithSalt :: Int -> FilterSummary -> Int
hashWithSalt Int
_salt FilterSummary' {Maybe Text
Maybe POSIX
status :: Maybe Text
name :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
filterArn :: Maybe Text
failureReason :: Maybe Text
datasetGroupArn :: Maybe Text
creationDateTime :: Maybe POSIX
$sel:status:FilterSummary' :: FilterSummary -> Maybe Text
$sel:name:FilterSummary' :: FilterSummary -> Maybe Text
$sel:lastUpdatedDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
$sel:filterArn:FilterSummary' :: FilterSummary -> Maybe Text
$sel:failureReason:FilterSummary' :: FilterSummary -> Maybe Text
$sel:datasetGroupArn:FilterSummary' :: FilterSummary -> Maybe Text
$sel:creationDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
datasetGroupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
filterArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData FilterSummary where
  rnf :: FilterSummary -> ()
rnf FilterSummary' {Maybe Text
Maybe POSIX
status :: Maybe Text
name :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
filterArn :: Maybe Text
failureReason :: Maybe Text
datasetGroupArn :: Maybe Text
creationDateTime :: Maybe POSIX
$sel:status:FilterSummary' :: FilterSummary -> Maybe Text
$sel:name:FilterSummary' :: FilterSummary -> Maybe Text
$sel:lastUpdatedDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
$sel:filterArn:FilterSummary' :: FilterSummary -> Maybe Text
$sel:failureReason:FilterSummary' :: FilterSummary -> Maybe Text
$sel:datasetGroupArn:FilterSummary' :: FilterSummary -> Maybe Text
$sel:creationDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
datasetGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
filterArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status