{-# 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.Transcribe.Types.CategoryProperties
-- 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.Transcribe.Types.CategoryProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transcribe.Types.Rule

-- | An object that contains the rules and additional information about a
-- call analytics category.
--
-- /See:/ 'newCategoryProperties' smart constructor.
data CategoryProperties = CategoryProperties'
  { -- | The rules used to create a call analytics category.
    CategoryProperties -> Maybe (NonEmpty Rule)
rules :: Prelude.Maybe (Prelude.NonEmpty Rule),
    -- | The name of the call analytics category.
    CategoryProperties -> Maybe Text
categoryName :: Prelude.Maybe Prelude.Text,
    -- | A timestamp that shows when the call analytics category was most
    -- recently updated.
    CategoryProperties -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Core.POSIX,
    -- | A timestamp that shows when the call analytics category was created.
    CategoryProperties -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX
  }
  deriving (CategoryProperties -> CategoryProperties -> Bool
(CategoryProperties -> CategoryProperties -> Bool)
-> (CategoryProperties -> CategoryProperties -> Bool)
-> Eq CategoryProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CategoryProperties -> CategoryProperties -> Bool
$c/= :: CategoryProperties -> CategoryProperties -> Bool
== :: CategoryProperties -> CategoryProperties -> Bool
$c== :: CategoryProperties -> CategoryProperties -> Bool
Prelude.Eq, ReadPrec [CategoryProperties]
ReadPrec CategoryProperties
Int -> ReadS CategoryProperties
ReadS [CategoryProperties]
(Int -> ReadS CategoryProperties)
-> ReadS [CategoryProperties]
-> ReadPrec CategoryProperties
-> ReadPrec [CategoryProperties]
-> Read CategoryProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CategoryProperties]
$creadListPrec :: ReadPrec [CategoryProperties]
readPrec :: ReadPrec CategoryProperties
$creadPrec :: ReadPrec CategoryProperties
readList :: ReadS [CategoryProperties]
$creadList :: ReadS [CategoryProperties]
readsPrec :: Int -> ReadS CategoryProperties
$creadsPrec :: Int -> ReadS CategoryProperties
Prelude.Read, Int -> CategoryProperties -> ShowS
[CategoryProperties] -> ShowS
CategoryProperties -> String
(Int -> CategoryProperties -> ShowS)
-> (CategoryProperties -> String)
-> ([CategoryProperties] -> ShowS)
-> Show CategoryProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CategoryProperties] -> ShowS
$cshowList :: [CategoryProperties] -> ShowS
show :: CategoryProperties -> String
$cshow :: CategoryProperties -> String
showsPrec :: Int -> CategoryProperties -> ShowS
$cshowsPrec :: Int -> CategoryProperties -> ShowS
Prelude.Show, (forall x. CategoryProperties -> Rep CategoryProperties x)
-> (forall x. Rep CategoryProperties x -> CategoryProperties)
-> Generic CategoryProperties
forall x. Rep CategoryProperties x -> CategoryProperties
forall x. CategoryProperties -> Rep CategoryProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CategoryProperties x -> CategoryProperties
$cfrom :: forall x. CategoryProperties -> Rep CategoryProperties x
Prelude.Generic)

-- |
-- Create a value of 'CategoryProperties' 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:
--
-- 'rules', 'categoryProperties_rules' - The rules used to create a call analytics category.
--
-- 'categoryName', 'categoryProperties_categoryName' - The name of the call analytics category.
--
-- 'lastUpdateTime', 'categoryProperties_lastUpdateTime' - A timestamp that shows when the call analytics category was most
-- recently updated.
--
-- 'createTime', 'categoryProperties_createTime' - A timestamp that shows when the call analytics category was created.
newCategoryProperties ::
  CategoryProperties
newCategoryProperties :: CategoryProperties
newCategoryProperties =
  CategoryProperties' :: Maybe (NonEmpty Rule)
-> Maybe Text -> Maybe POSIX -> Maybe POSIX -> CategoryProperties
CategoryProperties'
    { $sel:rules:CategoryProperties' :: Maybe (NonEmpty Rule)
rules = Maybe (NonEmpty Rule)
forall a. Maybe a
Prelude.Nothing,
      $sel:categoryName:CategoryProperties' :: Maybe Text
categoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:CategoryProperties' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:CategoryProperties' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The rules used to create a call analytics category.
categoryProperties_rules :: Lens.Lens' CategoryProperties (Prelude.Maybe (Prelude.NonEmpty Rule))
categoryProperties_rules :: (Maybe (NonEmpty Rule) -> f (Maybe (NonEmpty Rule)))
-> CategoryProperties -> f CategoryProperties
categoryProperties_rules = (CategoryProperties -> Maybe (NonEmpty Rule))
-> (CategoryProperties
    -> Maybe (NonEmpty Rule) -> CategoryProperties)
-> Lens
     CategoryProperties
     CategoryProperties
     (Maybe (NonEmpty Rule))
     (Maybe (NonEmpty Rule))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoryProperties' {Maybe (NonEmpty Rule)
rules :: Maybe (NonEmpty Rule)
$sel:rules:CategoryProperties' :: CategoryProperties -> Maybe (NonEmpty Rule)
rules} -> Maybe (NonEmpty Rule)
rules) (\s :: CategoryProperties
s@CategoryProperties' {} Maybe (NonEmpty Rule)
a -> CategoryProperties
s {$sel:rules:CategoryProperties' :: Maybe (NonEmpty Rule)
rules = Maybe (NonEmpty Rule)
a} :: CategoryProperties) ((Maybe (NonEmpty Rule) -> f (Maybe (NonEmpty Rule)))
 -> CategoryProperties -> f CategoryProperties)
-> ((Maybe (NonEmpty Rule) -> f (Maybe (NonEmpty Rule)))
    -> Maybe (NonEmpty Rule) -> f (Maybe (NonEmpty Rule)))
-> (Maybe (NonEmpty Rule) -> f (Maybe (NonEmpty Rule)))
-> CategoryProperties
-> f CategoryProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Rule) (NonEmpty Rule) (NonEmpty Rule) (NonEmpty Rule)
-> Iso
     (Maybe (NonEmpty Rule))
     (Maybe (NonEmpty Rule))
     (Maybe (NonEmpty Rule))
     (Maybe (NonEmpty Rule))
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
  (NonEmpty Rule) (NonEmpty Rule) (NonEmpty Rule) (NonEmpty Rule)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the call analytics category.
categoryProperties_categoryName :: Lens.Lens' CategoryProperties (Prelude.Maybe Prelude.Text)
categoryProperties_categoryName :: (Maybe Text -> f (Maybe Text))
-> CategoryProperties -> f CategoryProperties
categoryProperties_categoryName = (CategoryProperties -> Maybe Text)
-> (CategoryProperties -> Maybe Text -> CategoryProperties)
-> Lens
     CategoryProperties CategoryProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoryProperties' {Maybe Text
categoryName :: Maybe Text
$sel:categoryName:CategoryProperties' :: CategoryProperties -> Maybe Text
categoryName} -> Maybe Text
categoryName) (\s :: CategoryProperties
s@CategoryProperties' {} Maybe Text
a -> CategoryProperties
s {$sel:categoryName:CategoryProperties' :: Maybe Text
categoryName = Maybe Text
a} :: CategoryProperties)

-- | A timestamp that shows when the call analytics category was most
-- recently updated.
categoryProperties_lastUpdateTime :: Lens.Lens' CategoryProperties (Prelude.Maybe Prelude.UTCTime)
categoryProperties_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CategoryProperties -> f CategoryProperties
categoryProperties_lastUpdateTime = (CategoryProperties -> Maybe POSIX)
-> (CategoryProperties -> Maybe POSIX -> CategoryProperties)
-> Lens
     CategoryProperties CategoryProperties (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoryProperties' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:CategoryProperties' :: CategoryProperties -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: CategoryProperties
s@CategoryProperties' {} Maybe POSIX
a -> CategoryProperties
s {$sel:lastUpdateTime:CategoryProperties' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: CategoryProperties) ((Maybe POSIX -> f (Maybe POSIX))
 -> CategoryProperties -> f CategoryProperties)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CategoryProperties
-> f CategoryProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A timestamp that shows when the call analytics category was created.
categoryProperties_createTime :: Lens.Lens' CategoryProperties (Prelude.Maybe Prelude.UTCTime)
categoryProperties_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CategoryProperties -> f CategoryProperties
categoryProperties_createTime = (CategoryProperties -> Maybe POSIX)
-> (CategoryProperties -> Maybe POSIX -> CategoryProperties)
-> Lens
     CategoryProperties CategoryProperties (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoryProperties' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:CategoryProperties' :: CategoryProperties -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: CategoryProperties
s@CategoryProperties' {} Maybe POSIX
a -> CategoryProperties
s {$sel:createTime:CategoryProperties' :: Maybe POSIX
createTime = Maybe POSIX
a} :: CategoryProperties) ((Maybe POSIX -> f (Maybe POSIX))
 -> CategoryProperties -> f CategoryProperties)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CategoryProperties
-> f CategoryProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON CategoryProperties where
  parseJSON :: Value -> Parser CategoryProperties
parseJSON =
    String
-> (Object -> Parser CategoryProperties)
-> Value
-> Parser CategoryProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CategoryProperties"
      ( \Object
x ->
          Maybe (NonEmpty Rule)
-> Maybe Text -> Maybe POSIX -> Maybe POSIX -> CategoryProperties
CategoryProperties'
            (Maybe (NonEmpty Rule)
 -> Maybe Text -> Maybe POSIX -> Maybe POSIX -> CategoryProperties)
-> Parser (Maybe (NonEmpty Rule))
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe POSIX -> CategoryProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Rule))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rules")
            Parser
  (Maybe Text -> Maybe POSIX -> Maybe POSIX -> CategoryProperties)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe POSIX -> CategoryProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CategoryName")
            Parser (Maybe POSIX -> Maybe POSIX -> CategoryProperties)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> CategoryProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdateTime")
            Parser (Maybe POSIX -> CategoryProperties)
-> Parser (Maybe POSIX) -> Parser CategoryProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateTime")
      )

instance Prelude.Hashable CategoryProperties

instance Prelude.NFData CategoryProperties