{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Transcribe.Types.CategoryProperties 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
import Amazonka.Transcribe.Types.InputType
import Amazonka.Transcribe.Types.Rule

-- | Provides you with the properties of the Call Analytics category you
-- specified in your request. This includes the list of rules that define
-- the specified category.
--
-- /See:/ 'newCategoryProperties' smart constructor.
data CategoryProperties = CategoryProperties'
  { -- | The name of the Call Analytics category. Category names are case
    -- sensitive and must be unique within an Amazon Web Services account.
    CategoryProperties -> Maybe Text
categoryName :: Prelude.Maybe Prelude.Text,
    -- | The date and time the specified Call Analytics category was created.
    --
    -- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
    -- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
    -- May 4, 2022.
    CategoryProperties -> Maybe POSIX
createTime :: Prelude.Maybe Data.POSIX,
    -- | The input type associated with the specified category. @POST_CALL@
    -- refers to a category that is applied to batch transcriptions;
    -- @REAL_TIME@ refers to a category that is applied to streaming
    -- transcriptions.
    CategoryProperties -> Maybe InputType
inputType :: Prelude.Maybe InputType,
    -- | The date and time the specified Call Analytics category was last
    -- updated.
    --
    -- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
    -- example, @2022-05-05T12:45:32.691000-07:00@ represents 12:45 PM UTC-7 on
    -- May 5, 2022.
    CategoryProperties -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Data.POSIX,
    -- | The rules used to define a Call Analytics category. Each category can
    -- have between 1 and 20 rules.
    CategoryProperties -> Maybe (NonEmpty Rule)
rules :: Prelude.Maybe (Prelude.NonEmpty Rule)
  }
  deriving (CategoryProperties -> CategoryProperties -> Bool
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]
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
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. 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:
--
-- 'categoryName', 'categoryProperties_categoryName' - The name of the Call Analytics category. Category names are case
-- sensitive and must be unique within an Amazon Web Services account.
--
-- 'createTime', 'categoryProperties_createTime' - The date and time the specified Call Analytics category was created.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
-- May 4, 2022.
--
-- 'inputType', 'categoryProperties_inputType' - The input type associated with the specified category. @POST_CALL@
-- refers to a category that is applied to batch transcriptions;
-- @REAL_TIME@ refers to a category that is applied to streaming
-- transcriptions.
--
-- 'lastUpdateTime', 'categoryProperties_lastUpdateTime' - The date and time the specified Call Analytics category was last
-- updated.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-05T12:45:32.691000-07:00@ represents 12:45 PM UTC-7 on
-- May 5, 2022.
--
-- 'rules', 'categoryProperties_rules' - The rules used to define a Call Analytics category. Each category can
-- have between 1 and 20 rules.
newCategoryProperties ::
  CategoryProperties
newCategoryProperties :: CategoryProperties
newCategoryProperties =
  CategoryProperties'
    { $sel:categoryName:CategoryProperties' :: Maybe Text
categoryName = forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:CategoryProperties' :: Maybe POSIX
createTime = forall a. Maybe a
Prelude.Nothing,
      $sel:inputType:CategoryProperties' :: Maybe InputType
inputType = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:CategoryProperties' :: Maybe POSIX
lastUpdateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:rules:CategoryProperties' :: Maybe (NonEmpty Rule)
rules = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Call Analytics category. Category names are case
-- sensitive and must be unique within an Amazon Web Services account.
categoryProperties_categoryName :: Lens.Lens' CategoryProperties (Prelude.Maybe Prelude.Text)
categoryProperties_categoryName :: Lens' CategoryProperties (Maybe Text)
categoryProperties_categoryName = 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)

-- | The date and time the specified Call Analytics category was created.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
-- May 4, 2022.
categoryProperties_createTime :: Lens.Lens' CategoryProperties (Prelude.Maybe Prelude.UTCTime)
categoryProperties_createTime :: Lens' CategoryProperties (Maybe UTCTime)
categoryProperties_createTime = 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) 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 input type associated with the specified category. @POST_CALL@
-- refers to a category that is applied to batch transcriptions;
-- @REAL_TIME@ refers to a category that is applied to streaming
-- transcriptions.
categoryProperties_inputType :: Lens.Lens' CategoryProperties (Prelude.Maybe InputType)
categoryProperties_inputType :: Lens' CategoryProperties (Maybe InputType)
categoryProperties_inputType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoryProperties' {Maybe InputType
inputType :: Maybe InputType
$sel:inputType:CategoryProperties' :: CategoryProperties -> Maybe InputType
inputType} -> Maybe InputType
inputType) (\s :: CategoryProperties
s@CategoryProperties' {} Maybe InputType
a -> CategoryProperties
s {$sel:inputType:CategoryProperties' :: Maybe InputType
inputType = Maybe InputType
a} :: CategoryProperties)

-- | The date and time the specified Call Analytics category was last
-- updated.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-05T12:45:32.691000-07:00@ represents 12:45 PM UTC-7 on
-- May 5, 2022.
categoryProperties_lastUpdateTime :: Lens.Lens' CategoryProperties (Prelude.Maybe Prelude.UTCTime)
categoryProperties_lastUpdateTime :: Lens' CategoryProperties (Maybe UTCTime)
categoryProperties_lastUpdateTime = 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) 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 rules used to define a Call Analytics category. Each category can
-- have between 1 and 20 rules.
categoryProperties_rules :: Lens.Lens' CategoryProperties (Prelude.Maybe (Prelude.NonEmpty Rule))
categoryProperties_rules :: Lens' CategoryProperties (Maybe (NonEmpty Rule))
categoryProperties_rules = 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) 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 Data.FromJSON CategoryProperties where
  parseJSON :: Value -> Parser CategoryProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CategoryProperties"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe InputType
-> Maybe POSIX
-> Maybe (NonEmpty Rule)
-> CategoryProperties
CategoryProperties'
            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
"CategoryName")
            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
"CreateTime")
            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
"InputType")
            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
"LastUpdateTime")
            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
"Rules")
      )

instance Prelude.Hashable CategoryProperties where
  hashWithSalt :: Int -> CategoryProperties -> Int
hashWithSalt Int
_salt CategoryProperties' {Maybe (NonEmpty Rule)
Maybe Text
Maybe POSIX
Maybe InputType
rules :: Maybe (NonEmpty Rule)
lastUpdateTime :: Maybe POSIX
inputType :: Maybe InputType
createTime :: Maybe POSIX
categoryName :: Maybe Text
$sel:rules:CategoryProperties' :: CategoryProperties -> Maybe (NonEmpty Rule)
$sel:lastUpdateTime:CategoryProperties' :: CategoryProperties -> Maybe POSIX
$sel:inputType:CategoryProperties' :: CategoryProperties -> Maybe InputType
$sel:createTime:CategoryProperties' :: CategoryProperties -> Maybe POSIX
$sel:categoryName:CategoryProperties' :: CategoryProperties -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
categoryName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputType
inputType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Rule)
rules

instance Prelude.NFData CategoryProperties where
  rnf :: CategoryProperties -> ()
rnf CategoryProperties' {Maybe (NonEmpty Rule)
Maybe Text
Maybe POSIX
Maybe InputType
rules :: Maybe (NonEmpty Rule)
lastUpdateTime :: Maybe POSIX
inputType :: Maybe InputType
createTime :: Maybe POSIX
categoryName :: Maybe Text
$sel:rules:CategoryProperties' :: CategoryProperties -> Maybe (NonEmpty Rule)
$sel:lastUpdateTime:CategoryProperties' :: CategoryProperties -> Maybe POSIX
$sel:inputType:CategoryProperties' :: CategoryProperties -> Maybe InputType
$sel:createTime:CategoryProperties' :: CategoryProperties -> Maybe POSIX
$sel:categoryName:CategoryProperties' :: CategoryProperties -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
categoryName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputType
inputType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Rule)
rules