{-# 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.CostExplorer.Types.CostCategory
-- 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.CostExplorer.Types.CostCategory where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.CostCategoryProcessingStatus
import Amazonka.CostExplorer.Types.CostCategoryRule
import Amazonka.CostExplorer.Types.CostCategoryRuleVersion
import Amazonka.CostExplorer.Types.CostCategorySplitChargeRule
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The structure of Cost Categories. This includes detailed metadata and
-- the set of rules for the @CostCategory@ object.
--
-- /See:/ 'newCostCategory' smart constructor.
data CostCategory = CostCategory'
  { -- | The list of processing statuses for Cost Management products for a
    -- specific cost category.
    CostCategory -> Maybe [CostCategoryProcessingStatus]
processingStatus :: Prelude.Maybe [CostCategoryProcessingStatus],
    -- | The effective end data of your Cost Category.
    CostCategory -> Maybe Text
effectiveEnd :: Prelude.Maybe Prelude.Text,
    -- | The split charge rules that are used to allocate your charges between
    -- your Cost Category values.
    CostCategory -> Maybe (NonEmpty CostCategorySplitChargeRule)
splitChargeRules :: Prelude.Maybe (Prelude.NonEmpty CostCategorySplitChargeRule),
    CostCategory -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for your Cost Category.
    CostCategory -> Text
costCategoryArn :: Prelude.Text,
    -- | The effective state data of your Cost Category.
    CostCategory -> Text
effectiveStart :: Prelude.Text,
    CostCategory -> Text
name :: Prelude.Text,
    CostCategory -> CostCategoryRuleVersion
ruleVersion :: CostCategoryRuleVersion,
    -- | The rules are processed in order. If there are multiple rules that match
    -- the line item, then the first rule to match is used to determine that
    -- Cost Category value.
    CostCategory -> NonEmpty CostCategoryRule
rules :: Prelude.NonEmpty CostCategoryRule
  }
  deriving (CostCategory -> CostCategory -> Bool
(CostCategory -> CostCategory -> Bool)
-> (CostCategory -> CostCategory -> Bool) -> Eq CostCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CostCategory -> CostCategory -> Bool
$c/= :: CostCategory -> CostCategory -> Bool
== :: CostCategory -> CostCategory -> Bool
$c== :: CostCategory -> CostCategory -> Bool
Prelude.Eq, ReadPrec [CostCategory]
ReadPrec CostCategory
Int -> ReadS CostCategory
ReadS [CostCategory]
(Int -> ReadS CostCategory)
-> ReadS [CostCategory]
-> ReadPrec CostCategory
-> ReadPrec [CostCategory]
-> Read CostCategory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CostCategory]
$creadListPrec :: ReadPrec [CostCategory]
readPrec :: ReadPrec CostCategory
$creadPrec :: ReadPrec CostCategory
readList :: ReadS [CostCategory]
$creadList :: ReadS [CostCategory]
readsPrec :: Int -> ReadS CostCategory
$creadsPrec :: Int -> ReadS CostCategory
Prelude.Read, Int -> CostCategory -> ShowS
[CostCategory] -> ShowS
CostCategory -> String
(Int -> CostCategory -> ShowS)
-> (CostCategory -> String)
-> ([CostCategory] -> ShowS)
-> Show CostCategory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostCategory] -> ShowS
$cshowList :: [CostCategory] -> ShowS
show :: CostCategory -> String
$cshow :: CostCategory -> String
showsPrec :: Int -> CostCategory -> ShowS
$cshowsPrec :: Int -> CostCategory -> ShowS
Prelude.Show, (forall x. CostCategory -> Rep CostCategory x)
-> (forall x. Rep CostCategory x -> CostCategory)
-> Generic CostCategory
forall x. Rep CostCategory x -> CostCategory
forall x. CostCategory -> Rep CostCategory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CostCategory x -> CostCategory
$cfrom :: forall x. CostCategory -> Rep CostCategory x
Prelude.Generic)

-- |
-- Create a value of 'CostCategory' 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:
--
-- 'processingStatus', 'costCategory_processingStatus' - The list of processing statuses for Cost Management products for a
-- specific cost category.
--
-- 'effectiveEnd', 'costCategory_effectiveEnd' - The effective end data of your Cost Category.
--
-- 'splitChargeRules', 'costCategory_splitChargeRules' - The split charge rules that are used to allocate your charges between
-- your Cost Category values.
--
-- 'defaultValue', 'costCategory_defaultValue' - Undocumented member.
--
-- 'costCategoryArn', 'costCategory_costCategoryArn' - The unique identifier for your Cost Category.
--
-- 'effectiveStart', 'costCategory_effectiveStart' - The effective state data of your Cost Category.
--
-- 'name', 'costCategory_name' - Undocumented member.
--
-- 'ruleVersion', 'costCategory_ruleVersion' - Undocumented member.
--
-- 'rules', 'costCategory_rules' - The rules are processed in order. If there are multiple rules that match
-- the line item, then the first rule to match is used to determine that
-- Cost Category value.
newCostCategory ::
  -- | 'costCategoryArn'
  Prelude.Text ->
  -- | 'effectiveStart'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'ruleVersion'
  CostCategoryRuleVersion ->
  -- | 'rules'
  Prelude.NonEmpty CostCategoryRule ->
  CostCategory
newCostCategory :: Text
-> Text
-> Text
-> CostCategoryRuleVersion
-> NonEmpty CostCategoryRule
-> CostCategory
newCostCategory
  Text
pCostCategoryArn_
  Text
pEffectiveStart_
  Text
pName_
  CostCategoryRuleVersion
pRuleVersion_
  NonEmpty CostCategoryRule
pRules_ =
    CostCategory' :: Maybe [CostCategoryProcessingStatus]
-> Maybe Text
-> Maybe (NonEmpty CostCategorySplitChargeRule)
-> Maybe Text
-> Text
-> Text
-> Text
-> CostCategoryRuleVersion
-> NonEmpty CostCategoryRule
-> CostCategory
CostCategory'
      { $sel:processingStatus:CostCategory' :: Maybe [CostCategoryProcessingStatus]
processingStatus = Maybe [CostCategoryProcessingStatus]
forall a. Maybe a
Prelude.Nothing,
        $sel:effectiveEnd:CostCategory' :: Maybe Text
effectiveEnd = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:splitChargeRules:CostCategory' :: Maybe (NonEmpty CostCategorySplitChargeRule)
splitChargeRules = Maybe (NonEmpty CostCategorySplitChargeRule)
forall a. Maybe a
Prelude.Nothing,
        $sel:defaultValue:CostCategory' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:costCategoryArn:CostCategory' :: Text
costCategoryArn = Text
pCostCategoryArn_,
        $sel:effectiveStart:CostCategory' :: Text
effectiveStart = Text
pEffectiveStart_,
        $sel:name:CostCategory' :: Text
name = Text
pName_,
        $sel:ruleVersion:CostCategory' :: CostCategoryRuleVersion
ruleVersion = CostCategoryRuleVersion
pRuleVersion_,
        $sel:rules:CostCategory' :: NonEmpty CostCategoryRule
rules = Tagged
  (NonEmpty CostCategoryRule) (Identity (NonEmpty CostCategoryRule))
-> Tagged
     (NonEmpty CostCategoryRule) (Identity (NonEmpty CostCategoryRule))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty CostCategoryRule) (Identity (NonEmpty CostCategoryRule))
 -> Tagged
      (NonEmpty CostCategoryRule) (Identity (NonEmpty CostCategoryRule)))
-> NonEmpty CostCategoryRule -> NonEmpty CostCategoryRule
forall t b. AReview t b -> b -> t
Lens.# NonEmpty CostCategoryRule
pRules_
      }

-- | The list of processing statuses for Cost Management products for a
-- specific cost category.
costCategory_processingStatus :: Lens.Lens' CostCategory (Prelude.Maybe [CostCategoryProcessingStatus])
costCategory_processingStatus :: (Maybe [CostCategoryProcessingStatus]
 -> f (Maybe [CostCategoryProcessingStatus]))
-> CostCategory -> f CostCategory
costCategory_processingStatus = (CostCategory -> Maybe [CostCategoryProcessingStatus])
-> (CostCategory
    -> Maybe [CostCategoryProcessingStatus] -> CostCategory)
-> Lens
     CostCategory
     CostCategory
     (Maybe [CostCategoryProcessingStatus])
     (Maybe [CostCategoryProcessingStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Maybe [CostCategoryProcessingStatus]
processingStatus :: Maybe [CostCategoryProcessingStatus]
$sel:processingStatus:CostCategory' :: CostCategory -> Maybe [CostCategoryProcessingStatus]
processingStatus} -> Maybe [CostCategoryProcessingStatus]
processingStatus) (\s :: CostCategory
s@CostCategory' {} Maybe [CostCategoryProcessingStatus]
a -> CostCategory
s {$sel:processingStatus:CostCategory' :: Maybe [CostCategoryProcessingStatus]
processingStatus = Maybe [CostCategoryProcessingStatus]
a} :: CostCategory) ((Maybe [CostCategoryProcessingStatus]
  -> f (Maybe [CostCategoryProcessingStatus]))
 -> CostCategory -> f CostCategory)
-> ((Maybe [CostCategoryProcessingStatus]
     -> f (Maybe [CostCategoryProcessingStatus]))
    -> Maybe [CostCategoryProcessingStatus]
    -> f (Maybe [CostCategoryProcessingStatus]))
-> (Maybe [CostCategoryProcessingStatus]
    -> f (Maybe [CostCategoryProcessingStatus]))
-> CostCategory
-> f CostCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CostCategoryProcessingStatus]
  [CostCategoryProcessingStatus]
  [CostCategoryProcessingStatus]
  [CostCategoryProcessingStatus]
-> Iso
     (Maybe [CostCategoryProcessingStatus])
     (Maybe [CostCategoryProcessingStatus])
     (Maybe [CostCategoryProcessingStatus])
     (Maybe [CostCategoryProcessingStatus])
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
  [CostCategoryProcessingStatus]
  [CostCategoryProcessingStatus]
  [CostCategoryProcessingStatus]
  [CostCategoryProcessingStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The effective end data of your Cost Category.
costCategory_effectiveEnd :: Lens.Lens' CostCategory (Prelude.Maybe Prelude.Text)
costCategory_effectiveEnd :: (Maybe Text -> f (Maybe Text)) -> CostCategory -> f CostCategory
costCategory_effectiveEnd = (CostCategory -> Maybe Text)
-> (CostCategory -> Maybe Text -> CostCategory)
-> Lens CostCategory CostCategory (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Maybe Text
effectiveEnd :: Maybe Text
$sel:effectiveEnd:CostCategory' :: CostCategory -> Maybe Text
effectiveEnd} -> Maybe Text
effectiveEnd) (\s :: CostCategory
s@CostCategory' {} Maybe Text
a -> CostCategory
s {$sel:effectiveEnd:CostCategory' :: Maybe Text
effectiveEnd = Maybe Text
a} :: CostCategory)

-- | The split charge rules that are used to allocate your charges between
-- your Cost Category values.
costCategory_splitChargeRules :: Lens.Lens' CostCategory (Prelude.Maybe (Prelude.NonEmpty CostCategorySplitChargeRule))
costCategory_splitChargeRules :: (Maybe (NonEmpty CostCategorySplitChargeRule)
 -> f (Maybe (NonEmpty CostCategorySplitChargeRule)))
-> CostCategory -> f CostCategory
costCategory_splitChargeRules = (CostCategory -> Maybe (NonEmpty CostCategorySplitChargeRule))
-> (CostCategory
    -> Maybe (NonEmpty CostCategorySplitChargeRule) -> CostCategory)
-> Lens
     CostCategory
     CostCategory
     (Maybe (NonEmpty CostCategorySplitChargeRule))
     (Maybe (NonEmpty CostCategorySplitChargeRule))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Maybe (NonEmpty CostCategorySplitChargeRule)
splitChargeRules :: Maybe (NonEmpty CostCategorySplitChargeRule)
$sel:splitChargeRules:CostCategory' :: CostCategory -> Maybe (NonEmpty CostCategorySplitChargeRule)
splitChargeRules} -> Maybe (NonEmpty CostCategorySplitChargeRule)
splitChargeRules) (\s :: CostCategory
s@CostCategory' {} Maybe (NonEmpty CostCategorySplitChargeRule)
a -> CostCategory
s {$sel:splitChargeRules:CostCategory' :: Maybe (NonEmpty CostCategorySplitChargeRule)
splitChargeRules = Maybe (NonEmpty CostCategorySplitChargeRule)
a} :: CostCategory) ((Maybe (NonEmpty CostCategorySplitChargeRule)
  -> f (Maybe (NonEmpty CostCategorySplitChargeRule)))
 -> CostCategory -> f CostCategory)
-> ((Maybe (NonEmpty CostCategorySplitChargeRule)
     -> f (Maybe (NonEmpty CostCategorySplitChargeRule)))
    -> Maybe (NonEmpty CostCategorySplitChargeRule)
    -> f (Maybe (NonEmpty CostCategorySplitChargeRule)))
-> (Maybe (NonEmpty CostCategorySplitChargeRule)
    -> f (Maybe (NonEmpty CostCategorySplitChargeRule)))
-> CostCategory
-> f CostCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty CostCategorySplitChargeRule)
  (NonEmpty CostCategorySplitChargeRule)
  (NonEmpty CostCategorySplitChargeRule)
  (NonEmpty CostCategorySplitChargeRule)
-> Iso
     (Maybe (NonEmpty CostCategorySplitChargeRule))
     (Maybe (NonEmpty CostCategorySplitChargeRule))
     (Maybe (NonEmpty CostCategorySplitChargeRule))
     (Maybe (NonEmpty CostCategorySplitChargeRule))
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 CostCategorySplitChargeRule)
  (NonEmpty CostCategorySplitChargeRule)
  (NonEmpty CostCategorySplitChargeRule)
  (NonEmpty CostCategorySplitChargeRule)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
costCategory_defaultValue :: Lens.Lens' CostCategory (Prelude.Maybe Prelude.Text)
costCategory_defaultValue :: (Maybe Text -> f (Maybe Text)) -> CostCategory -> f CostCategory
costCategory_defaultValue = (CostCategory -> Maybe Text)
-> (CostCategory -> Maybe Text -> CostCategory)
-> Lens CostCategory CostCategory (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:CostCategory' :: CostCategory -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: CostCategory
s@CostCategory' {} Maybe Text
a -> CostCategory
s {$sel:defaultValue:CostCategory' :: Maybe Text
defaultValue = Maybe Text
a} :: CostCategory)

-- | The unique identifier for your Cost Category.
costCategory_costCategoryArn :: Lens.Lens' CostCategory Prelude.Text
costCategory_costCategoryArn :: (Text -> f Text) -> CostCategory -> f CostCategory
costCategory_costCategoryArn = (CostCategory -> Text)
-> (CostCategory -> Text -> CostCategory)
-> Lens CostCategory CostCategory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Text
costCategoryArn :: Text
$sel:costCategoryArn:CostCategory' :: CostCategory -> Text
costCategoryArn} -> Text
costCategoryArn) (\s :: CostCategory
s@CostCategory' {} Text
a -> CostCategory
s {$sel:costCategoryArn:CostCategory' :: Text
costCategoryArn = Text
a} :: CostCategory)

-- | The effective state data of your Cost Category.
costCategory_effectiveStart :: Lens.Lens' CostCategory Prelude.Text
costCategory_effectiveStart :: (Text -> f Text) -> CostCategory -> f CostCategory
costCategory_effectiveStart = (CostCategory -> Text)
-> (CostCategory -> Text -> CostCategory)
-> Lens CostCategory CostCategory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Text
effectiveStart :: Text
$sel:effectiveStart:CostCategory' :: CostCategory -> Text
effectiveStart} -> Text
effectiveStart) (\s :: CostCategory
s@CostCategory' {} Text
a -> CostCategory
s {$sel:effectiveStart:CostCategory' :: Text
effectiveStart = Text
a} :: CostCategory)

-- | Undocumented member.
costCategory_name :: Lens.Lens' CostCategory Prelude.Text
costCategory_name :: (Text -> f Text) -> CostCategory -> f CostCategory
costCategory_name = (CostCategory -> Text)
-> (CostCategory -> Text -> CostCategory)
-> Lens CostCategory CostCategory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {Text
name :: Text
$sel:name:CostCategory' :: CostCategory -> Text
name} -> Text
name) (\s :: CostCategory
s@CostCategory' {} Text
a -> CostCategory
s {$sel:name:CostCategory' :: Text
name = Text
a} :: CostCategory)

-- | Undocumented member.
costCategory_ruleVersion :: Lens.Lens' CostCategory CostCategoryRuleVersion
costCategory_ruleVersion :: (CostCategoryRuleVersion -> f CostCategoryRuleVersion)
-> CostCategory -> f CostCategory
costCategory_ruleVersion = (CostCategory -> CostCategoryRuleVersion)
-> (CostCategory -> CostCategoryRuleVersion -> CostCategory)
-> Lens
     CostCategory
     CostCategory
     CostCategoryRuleVersion
     CostCategoryRuleVersion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {CostCategoryRuleVersion
ruleVersion :: CostCategoryRuleVersion
$sel:ruleVersion:CostCategory' :: CostCategory -> CostCategoryRuleVersion
ruleVersion} -> CostCategoryRuleVersion
ruleVersion) (\s :: CostCategory
s@CostCategory' {} CostCategoryRuleVersion
a -> CostCategory
s {$sel:ruleVersion:CostCategory' :: CostCategoryRuleVersion
ruleVersion = CostCategoryRuleVersion
a} :: CostCategory)

-- | The rules are processed in order. If there are multiple rules that match
-- the line item, then the first rule to match is used to determine that
-- Cost Category value.
costCategory_rules :: Lens.Lens' CostCategory (Prelude.NonEmpty CostCategoryRule)
costCategory_rules :: (NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule))
-> CostCategory -> f CostCategory
costCategory_rules = (CostCategory -> NonEmpty CostCategoryRule)
-> (CostCategory -> NonEmpty CostCategoryRule -> CostCategory)
-> Lens
     CostCategory
     CostCategory
     (NonEmpty CostCategoryRule)
     (NonEmpty CostCategoryRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategory' {NonEmpty CostCategoryRule
rules :: NonEmpty CostCategoryRule
$sel:rules:CostCategory' :: CostCategory -> NonEmpty CostCategoryRule
rules} -> NonEmpty CostCategoryRule
rules) (\s :: CostCategory
s@CostCategory' {} NonEmpty CostCategoryRule
a -> CostCategory
s {$sel:rules:CostCategory' :: NonEmpty CostCategoryRule
rules = NonEmpty CostCategoryRule
a} :: CostCategory) ((NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule))
 -> CostCategory -> f CostCategory)
-> ((NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule))
    -> NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule))
-> (NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule))
-> CostCategory
-> f CostCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule))
-> NonEmpty CostCategoryRule -> f (NonEmpty CostCategoryRule)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CostCategory where
  parseJSON :: Value -> Parser CostCategory
parseJSON =
    String
-> (Object -> Parser CostCategory) -> Value -> Parser CostCategory
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CostCategory"
      ( \Object
x ->
          Maybe [CostCategoryProcessingStatus]
-> Maybe Text
-> Maybe (NonEmpty CostCategorySplitChargeRule)
-> Maybe Text
-> Text
-> Text
-> Text
-> CostCategoryRuleVersion
-> NonEmpty CostCategoryRule
-> CostCategory
CostCategory'
            (Maybe [CostCategoryProcessingStatus]
 -> Maybe Text
 -> Maybe (NonEmpty CostCategorySplitChargeRule)
 -> Maybe Text
 -> Text
 -> Text
 -> Text
 -> CostCategoryRuleVersion
 -> NonEmpty CostCategoryRule
 -> CostCategory)
-> Parser (Maybe [CostCategoryProcessingStatus])
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty CostCategorySplitChargeRule)
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule
      -> CostCategory)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [CostCategoryProcessingStatus]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProcessingStatus"
                            Parser (Maybe (Maybe [CostCategoryProcessingStatus]))
-> Maybe [CostCategoryProcessingStatus]
-> Parser (Maybe [CostCategoryProcessingStatus])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CostCategoryProcessingStatus]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe (NonEmpty CostCategorySplitChargeRule)
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule
   -> CostCategory)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty CostCategorySplitChargeRule)
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule
      -> CostCategory)
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
"EffectiveEnd")
            Parser
  (Maybe (NonEmpty CostCategorySplitChargeRule)
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule
   -> CostCategory)
-> Parser (Maybe (NonEmpty CostCategorySplitChargeRule))
-> Parser
     (Maybe Text
      -> Text
      -> Text
      -> Text
      -> CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule
      -> CostCategory)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty CostCategorySplitChargeRule))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SplitChargeRules")
            Parser
  (Maybe Text
   -> Text
   -> Text
   -> Text
   -> CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule
   -> CostCategory)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Text
      -> Text
      -> CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule
      -> CostCategory)
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
"DefaultValue")
            Parser
  (Text
   -> Text
   -> Text
   -> CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule
   -> CostCategory)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule
      -> CostCategory)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CostCategoryArn")
            Parser
  (Text
   -> Text
   -> CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule
   -> CostCategory)
-> Parser Text
-> Parser
     (Text
      -> CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule
      -> CostCategory)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EffectiveStart")
            Parser
  (Text
   -> CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule
   -> CostCategory)
-> Parser Text
-> Parser
     (CostCategoryRuleVersion
      -> NonEmpty CostCategoryRule -> CostCategory)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
            Parser
  (CostCategoryRuleVersion
   -> NonEmpty CostCategoryRule -> CostCategory)
-> Parser CostCategoryRuleVersion
-> Parser (NonEmpty CostCategoryRule -> CostCategory)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser CostCategoryRuleVersion
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleVersion")
            Parser (NonEmpty CostCategoryRule -> CostCategory)
-> Parser (NonEmpty CostCategoryRule) -> Parser CostCategory
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty CostCategoryRule)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Rules")
      )

instance Prelude.Hashable CostCategory

instance Prelude.NFData CostCategory