{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.DunningCycle where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified RecurlyClient.Common
import RecurlyClient.TypeAlias
import {-# SOURCE #-} RecurlyClient.Types.DunningInterval
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data DunningCycle = DunningCycle
{ DunningCycle -> Maybe Bool
dunningCycleApplies_to_manual_trial :: (GHC.Maybe.Maybe GHC.Types.Bool)
, DunningCycle -> Maybe JsonDateTime
dunningCycleCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, DunningCycle -> Maybe Bool
dunningCycleExpire_subscription :: (GHC.Maybe.Maybe GHC.Types.Bool)
, DunningCycle -> Maybe Bool
dunningCycleFail_invoice :: (GHC.Maybe.Maybe GHC.Types.Bool)
, DunningCycle -> Maybe Int
dunningCycleFirst_communication_interval :: (GHC.Maybe.Maybe GHC.Types.Int)
, DunningCycle -> Maybe [DunningInterval]
dunningCycleIntervals :: (GHC.Maybe.Maybe [DunningInterval])
, DunningCycle -> Maybe Bool
dunningCycleSend_immediately_on_hard_decline :: (GHC.Maybe.Maybe GHC.Types.Bool)
, DunningCycle -> Maybe Int
dunningCycleTotal_dunning_days :: (GHC.Maybe.Maybe GHC.Types.Int)
, DunningCycle -> Maybe Int
dunningCycleTotal_recycling_days :: (GHC.Maybe.Maybe GHC.Types.Int)
, DunningCycle -> Maybe DunningCycleType
dunningCycleType :: (GHC.Maybe.Maybe DunningCycleType)
, DunningCycle -> Maybe JsonDateTime
dunningCycleUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, DunningCycle -> Maybe Int
dunningCycleVersion :: (GHC.Maybe.Maybe GHC.Types.Int)
}
deriving
( Int -> DunningCycle -> ShowS
[DunningCycle] -> ShowS
DunningCycle -> String
(Int -> DunningCycle -> ShowS)
-> (DunningCycle -> String)
-> ([DunningCycle] -> ShowS)
-> Show DunningCycle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DunningCycle -> ShowS
showsPrec :: Int -> DunningCycle -> ShowS
$cshow :: DunningCycle -> String
show :: DunningCycle -> String
$cshowList :: [DunningCycle] -> ShowS
showList :: [DunningCycle] -> ShowS
GHC.Show.Show
, DunningCycle -> DunningCycle -> Bool
(DunningCycle -> DunningCycle -> Bool)
-> (DunningCycle -> DunningCycle -> Bool) -> Eq DunningCycle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DunningCycle -> DunningCycle -> Bool
== :: DunningCycle -> DunningCycle -> Bool
$c/= :: DunningCycle -> DunningCycle -> Bool
/= :: DunningCycle -> DunningCycle -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON DunningCycle where
toJSON :: DunningCycle -> Value
toJSON DunningCycle
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_manual_trial" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleApplies_to_manual_trial DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe JsonDateTime
dunningCycleCreated_at DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expire_subscription" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleExpire_subscription DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"fail_invoice" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleFail_invoice DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"first_communication_interval" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleFirst_communication_interval DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> ([DunningInterval] -> [Pair])
-> Maybe [DunningInterval]
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> ([DunningInterval] -> Pair) -> [DunningInterval] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"intervals" Key -> [DunningInterval] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe [DunningInterval]
dunningCycleIntervals DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"send_immediately_on_hard_decline" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleSend_immediately_on_hard_decline DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"total_dunning_days" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleTotal_dunning_days DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"total_recycling_days" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleTotal_recycling_days DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (DunningCycleType -> [Pair]) -> Maybe DunningCycleType -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (DunningCycleType -> Pair) -> DunningCycleType -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"type" Key -> DunningCycleType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe DunningCycleType
dunningCycleType DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe JsonDateTime
dunningCycleUpdated_at DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"version" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleVersion DunningCycle
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: DunningCycle -> Encoding
toEncoding DunningCycle
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"applies_to_manual_trial" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleApplies_to_manual_trial DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe JsonDateTime
dunningCycleCreated_at DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expire_subscription" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleExpire_subscription DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"fail_invoice" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleFail_invoice DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"first_communication_interval" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleFirst_communication_interval DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([DunningInterval] -> [Series])
-> Maybe [DunningInterval]
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> ([DunningInterval] -> Series) -> [DunningInterval] -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"intervals" Key -> [DunningInterval] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe [DunningInterval]
dunningCycleIntervals DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"send_immediately_on_hard_decline" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Bool
dunningCycleSend_immediately_on_hard_decline DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"total_dunning_days" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleTotal_dunning_days DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"total_recycling_days" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleTotal_recycling_days DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (DunningCycleType -> [Series])
-> Maybe DunningCycleType
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (DunningCycleType -> Series) -> DunningCycleType -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"type" Key -> DunningCycleType -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe DunningCycleType
dunningCycleType DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe JsonDateTime
dunningCycleUpdated_at DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"version" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (DunningCycle -> Maybe Int
dunningCycleVersion DunningCycle
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON DunningCycle where
parseJSON :: Value -> Parser DunningCycle
parseJSON = String
-> (Object -> Parser DunningCycle) -> Value -> Parser DunningCycle
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"DunningCycle" (\Object
obj -> ((((((((((((Maybe Bool
-> Maybe JsonDateTime
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser
(Maybe Bool
-> Maybe JsonDateTime
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe JsonDateTime
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle
DunningCycle Parser
(Maybe Bool
-> Maybe JsonDateTime
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Bool)
-> Parser
(Maybe JsonDateTime
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"applies_to_manual_trial")) Parser
(Maybe JsonDateTime
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Bool)
-> Parser
(Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"expire_subscription")) Parser
(Maybe Bool
-> Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Bool)
-> Parser
(Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"fail_invoice")) Parser
(Maybe Int
-> Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Int)
-> Parser
(Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"first_communication_interval")) Parser
(Maybe [DunningInterval]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe [DunningInterval])
-> Parser
(Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe [DunningInterval])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"intervals")) Parser
(Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Bool)
-> Parser
(Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"send_immediately_on_hard_decline")) Parser
(Maybe Int
-> Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"total_dunning_days")) Parser
(Maybe Int
-> Maybe DunningCycleType
-> Maybe JsonDateTime
-> Maybe Int
-> DunningCycle)
-> Parser (Maybe Int)
-> Parser
(Maybe DunningCycleType
-> Maybe JsonDateTime -> Maybe Int -> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"total_recycling_days")) Parser
(Maybe DunningCycleType
-> Maybe JsonDateTime -> Maybe Int -> DunningCycle)
-> Parser (Maybe DunningCycleType)
-> Parser (Maybe JsonDateTime -> Maybe Int -> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe DunningCycleType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"type")) Parser (Maybe JsonDateTime -> Maybe Int -> DunningCycle)
-> Parser (Maybe JsonDateTime)
-> Parser (Maybe Int -> DunningCycle)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at")) Parser (Maybe Int -> DunningCycle)
-> Parser (Maybe Int) -> Parser DunningCycle
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"version"))
mkDunningCycle :: DunningCycle
mkDunningCycle :: DunningCycle
mkDunningCycle =
DunningCycle
{ dunningCycleApplies_to_manual_trial :: Maybe Bool
dunningCycleApplies_to_manual_trial = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleCreated_at :: Maybe JsonDateTime
dunningCycleCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleExpire_subscription :: Maybe Bool
dunningCycleExpire_subscription = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleFail_invoice :: Maybe Bool
dunningCycleFail_invoice = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleFirst_communication_interval :: Maybe Int
dunningCycleFirst_communication_interval = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleIntervals :: Maybe [DunningInterval]
dunningCycleIntervals = Maybe [DunningInterval]
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleSend_immediately_on_hard_decline :: Maybe Bool
dunningCycleSend_immediately_on_hard_decline = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleTotal_dunning_days :: Maybe Int
dunningCycleTotal_dunning_days = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleTotal_recycling_days :: Maybe Int
dunningCycleTotal_recycling_days = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleType :: Maybe DunningCycleType
dunningCycleType = Maybe DunningCycleType
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleUpdated_at :: Maybe JsonDateTime
dunningCycleUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, dunningCycleVersion :: Maybe Int
dunningCycleVersion = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
}
data DunningCycleType
=
DunningCycleTypeOther Data.Aeson.Types.Internal.Value
|
DunningCycleTypeTyped Data.Text.Internal.Text
|
DunningCycleTypeEnumAutomatic
|
DunningCycleTypeEnumManual
|
DunningCycleTypeEnumTrial
deriving (Int -> DunningCycleType -> ShowS
[DunningCycleType] -> ShowS
DunningCycleType -> String
(Int -> DunningCycleType -> ShowS)
-> (DunningCycleType -> String)
-> ([DunningCycleType] -> ShowS)
-> Show DunningCycleType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DunningCycleType -> ShowS
showsPrec :: Int -> DunningCycleType -> ShowS
$cshow :: DunningCycleType -> String
show :: DunningCycleType -> String
$cshowList :: [DunningCycleType] -> ShowS
showList :: [DunningCycleType] -> ShowS
GHC.Show.Show, DunningCycleType -> DunningCycleType -> Bool
(DunningCycleType -> DunningCycleType -> Bool)
-> (DunningCycleType -> DunningCycleType -> Bool)
-> Eq DunningCycleType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DunningCycleType -> DunningCycleType -> Bool
== :: DunningCycleType -> DunningCycleType -> Bool
$c/= :: DunningCycleType -> DunningCycleType -> Bool
/= :: DunningCycleType -> DunningCycleType -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON DunningCycleType where
toJSON :: DunningCycleType -> Value
toJSON (DunningCycleTypeOther Value
val) = Value
val
toJSON (DunningCycleTypeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (DunningCycleType
DunningCycleTypeEnumAutomatic) = Value
"automatic"
toJSON (DunningCycleType
DunningCycleTypeEnumManual) = Value
"manual"
toJSON (DunningCycleType
DunningCycleTypeEnumTrial) = Value
"trial"
instance Data.Aeson.Types.FromJSON.FromJSON DunningCycleType where
parseJSON :: Value -> Parser DunningCycleType
parseJSON Value
val =
DunningCycleType -> Parser DunningCycleType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"automatic" -> DunningCycleType
DunningCycleTypeEnumAutomatic
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"manual" -> DunningCycleType
DunningCycleTypeEnumManual
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"trial" -> DunningCycleType
DunningCycleTypeEnumTrial
| Bool
GHC.Base.otherwise -> Value -> DunningCycleType
DunningCycleTypeOther Value
val
)