{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.AccountBrandingSettings 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.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified 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 StripeAPI.Common
import StripeAPI.TypeAlias
import {-# SOURCE #-} StripeAPI.Types.File
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data AccountBrandingSettings = AccountBrandingSettings
{
AccountBrandingSettings
-> Maybe AccountBrandingSettingsIcon'Variants
accountBrandingSettingsIcon :: (GHC.Maybe.Maybe AccountBrandingSettingsIcon'Variants),
AccountBrandingSettings
-> Maybe AccountBrandingSettingsLogo'Variants
accountBrandingSettingsLogo :: (GHC.Maybe.Maybe AccountBrandingSettingsLogo'Variants),
AccountBrandingSettings -> Maybe Text
accountBrandingSettingsPrimaryColor :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
AccountBrandingSettings -> Maybe Text
accountBrandingSettingsSecondaryColor :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> AccountBrandingSettings -> ShowS
[AccountBrandingSettings] -> ShowS
AccountBrandingSettings -> String
(Int -> AccountBrandingSettings -> ShowS)
-> (AccountBrandingSettings -> String)
-> ([AccountBrandingSettings] -> ShowS)
-> Show AccountBrandingSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountBrandingSettings] -> ShowS
$cshowList :: [AccountBrandingSettings] -> ShowS
show :: AccountBrandingSettings -> String
$cshow :: AccountBrandingSettings -> String
showsPrec :: Int -> AccountBrandingSettings -> ShowS
$cshowsPrec :: Int -> AccountBrandingSettings -> ShowS
GHC.Show.Show,
AccountBrandingSettings -> AccountBrandingSettings -> Bool
(AccountBrandingSettings -> AccountBrandingSettings -> Bool)
-> (AccountBrandingSettings -> AccountBrandingSettings -> Bool)
-> Eq AccountBrandingSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountBrandingSettings -> AccountBrandingSettings -> Bool
$c/= :: AccountBrandingSettings -> AccountBrandingSettings -> Bool
== :: AccountBrandingSettings -> AccountBrandingSettings -> Bool
$c== :: AccountBrandingSettings -> AccountBrandingSettings -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON AccountBrandingSettings where
toJSON :: AccountBrandingSettings -> Value
toJSON AccountBrandingSettings
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"icon" Text -> Maybe AccountBrandingSettingsIcon'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings
-> Maybe AccountBrandingSettingsIcon'Variants
accountBrandingSettingsIcon AccountBrandingSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"logo" Text -> Maybe AccountBrandingSettingsLogo'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings
-> Maybe AccountBrandingSettingsLogo'Variants
accountBrandingSettingsLogo AccountBrandingSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"primary_color" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings -> Maybe Text
accountBrandingSettingsPrimaryColor AccountBrandingSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"secondary_color" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings -> Maybe Text
accountBrandingSettingsSecondaryColor AccountBrandingSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: AccountBrandingSettings -> Encoding
toEncoding AccountBrandingSettings
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"icon" Text -> Maybe AccountBrandingSettingsIcon'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings
-> Maybe AccountBrandingSettingsIcon'Variants
accountBrandingSettingsIcon AccountBrandingSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"logo" Text -> Maybe AccountBrandingSettingsLogo'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings
-> Maybe AccountBrandingSettingsLogo'Variants
accountBrandingSettingsLogo AccountBrandingSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"primary_color" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings -> Maybe Text
accountBrandingSettingsPrimaryColor AccountBrandingSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"secondary_color" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountBrandingSettings -> Maybe Text
accountBrandingSettingsSecondaryColor AccountBrandingSettings
obj))))
instance Data.Aeson.Types.FromJSON.FromJSON AccountBrandingSettings where
parseJSON :: Value -> Parser AccountBrandingSettings
parseJSON = String
-> (Object -> Parser AccountBrandingSettings)
-> Value
-> Parser AccountBrandingSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"AccountBrandingSettings" (\Object
obj -> ((((Maybe AccountBrandingSettingsIcon'Variants
-> Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text
-> Maybe Text
-> AccountBrandingSettings)
-> Parser
(Maybe AccountBrandingSettingsIcon'Variants
-> Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text
-> Maybe Text
-> AccountBrandingSettings)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe AccountBrandingSettingsIcon'Variants
-> Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text
-> Maybe Text
-> AccountBrandingSettings
AccountBrandingSettings Parser
(Maybe AccountBrandingSettingsIcon'Variants
-> Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text
-> Maybe Text
-> AccountBrandingSettings)
-> Parser (Maybe AccountBrandingSettingsIcon'Variants)
-> Parser
(Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text -> Maybe Text -> AccountBrandingSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe AccountBrandingSettingsIcon'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"icon")) Parser
(Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text -> Maybe Text -> AccountBrandingSettings)
-> Parser (Maybe AccountBrandingSettingsLogo'Variants)
-> Parser (Maybe Text -> Maybe Text -> AccountBrandingSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe AccountBrandingSettingsLogo'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"logo")) Parser (Maybe Text -> Maybe Text -> AccountBrandingSettings)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AccountBrandingSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"primary_color")) Parser (Maybe Text -> AccountBrandingSettings)
-> Parser (Maybe Text) -> Parser AccountBrandingSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"secondary_color"))
mkAccountBrandingSettings :: AccountBrandingSettings
mkAccountBrandingSettings :: AccountBrandingSettings
mkAccountBrandingSettings =
AccountBrandingSettings :: Maybe AccountBrandingSettingsIcon'Variants
-> Maybe AccountBrandingSettingsLogo'Variants
-> Maybe Text
-> Maybe Text
-> AccountBrandingSettings
AccountBrandingSettings
{ accountBrandingSettingsIcon :: Maybe AccountBrandingSettingsIcon'Variants
accountBrandingSettingsIcon = Maybe AccountBrandingSettingsIcon'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
accountBrandingSettingsLogo :: Maybe AccountBrandingSettingsLogo'Variants
accountBrandingSettingsLogo = Maybe AccountBrandingSettingsLogo'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
accountBrandingSettingsPrimaryColor :: Maybe Text
accountBrandingSettingsPrimaryColor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
accountBrandingSettingsSecondaryColor :: Maybe Text
accountBrandingSettingsSecondaryColor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data AccountBrandingSettingsIcon'Variants
= AccountBrandingSettingsIcon'Text Data.Text.Internal.Text
| AccountBrandingSettingsIcon'File File
deriving (Int -> AccountBrandingSettingsIcon'Variants -> ShowS
[AccountBrandingSettingsIcon'Variants] -> ShowS
AccountBrandingSettingsIcon'Variants -> String
(Int -> AccountBrandingSettingsIcon'Variants -> ShowS)
-> (AccountBrandingSettingsIcon'Variants -> String)
-> ([AccountBrandingSettingsIcon'Variants] -> ShowS)
-> Show AccountBrandingSettingsIcon'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountBrandingSettingsIcon'Variants] -> ShowS
$cshowList :: [AccountBrandingSettingsIcon'Variants] -> ShowS
show :: AccountBrandingSettingsIcon'Variants -> String
$cshow :: AccountBrandingSettingsIcon'Variants -> String
showsPrec :: Int -> AccountBrandingSettingsIcon'Variants -> ShowS
$cshowsPrec :: Int -> AccountBrandingSettingsIcon'Variants -> ShowS
GHC.Show.Show, AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool
(AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool)
-> (AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool)
-> Eq AccountBrandingSettingsIcon'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool
$c/= :: AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool
== :: AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool
$c== :: AccountBrandingSettingsIcon'Variants
-> AccountBrandingSettingsIcon'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON AccountBrandingSettingsIcon'Variants where
toJSON :: AccountBrandingSettingsIcon'Variants -> Value
toJSON (AccountBrandingSettingsIcon'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (AccountBrandingSettingsIcon'File File
a) = File -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON File
a
instance Data.Aeson.Types.FromJSON.FromJSON AccountBrandingSettingsIcon'Variants where
parseJSON :: Value -> Parser AccountBrandingSettingsIcon'Variants
parseJSON Value
val = case (Text -> AccountBrandingSettingsIcon'Variants
AccountBrandingSettingsIcon'Text (Text -> AccountBrandingSettingsIcon'Variants)
-> Result Text -> Result AccountBrandingSettingsIcon'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result AccountBrandingSettingsIcon'Variants
-> Result AccountBrandingSettingsIcon'Variants
-> Result AccountBrandingSettingsIcon'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((File -> AccountBrandingSettingsIcon'Variants
AccountBrandingSettingsIcon'File (File -> AccountBrandingSettingsIcon'Variants)
-> Result File -> Result AccountBrandingSettingsIcon'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result File
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result AccountBrandingSettingsIcon'Variants
-> Result AccountBrandingSettingsIcon'Variants
-> Result AccountBrandingSettingsIcon'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result AccountBrandingSettingsIcon'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success AccountBrandingSettingsIcon'Variants
a -> AccountBrandingSettingsIcon'Variants
-> Parser AccountBrandingSettingsIcon'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure AccountBrandingSettingsIcon'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser AccountBrandingSettingsIcon'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data AccountBrandingSettingsLogo'Variants
= AccountBrandingSettingsLogo'Text Data.Text.Internal.Text
| AccountBrandingSettingsLogo'File File
deriving (Int -> AccountBrandingSettingsLogo'Variants -> ShowS
[AccountBrandingSettingsLogo'Variants] -> ShowS
AccountBrandingSettingsLogo'Variants -> String
(Int -> AccountBrandingSettingsLogo'Variants -> ShowS)
-> (AccountBrandingSettingsLogo'Variants -> String)
-> ([AccountBrandingSettingsLogo'Variants] -> ShowS)
-> Show AccountBrandingSettingsLogo'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountBrandingSettingsLogo'Variants] -> ShowS
$cshowList :: [AccountBrandingSettingsLogo'Variants] -> ShowS
show :: AccountBrandingSettingsLogo'Variants -> String
$cshow :: AccountBrandingSettingsLogo'Variants -> String
showsPrec :: Int -> AccountBrandingSettingsLogo'Variants -> ShowS
$cshowsPrec :: Int -> AccountBrandingSettingsLogo'Variants -> ShowS
GHC.Show.Show, AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool
(AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool)
-> (AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool)
-> Eq AccountBrandingSettingsLogo'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool
$c/= :: AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool
== :: AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool
$c== :: AccountBrandingSettingsLogo'Variants
-> AccountBrandingSettingsLogo'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON AccountBrandingSettingsLogo'Variants where
toJSON :: AccountBrandingSettingsLogo'Variants -> Value
toJSON (AccountBrandingSettingsLogo'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (AccountBrandingSettingsLogo'File File
a) = File -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON File
a
instance Data.Aeson.Types.FromJSON.FromJSON AccountBrandingSettingsLogo'Variants where
parseJSON :: Value -> Parser AccountBrandingSettingsLogo'Variants
parseJSON Value
val = case (Text -> AccountBrandingSettingsLogo'Variants
AccountBrandingSettingsLogo'Text (Text -> AccountBrandingSettingsLogo'Variants)
-> Result Text -> Result AccountBrandingSettingsLogo'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result AccountBrandingSettingsLogo'Variants
-> Result AccountBrandingSettingsLogo'Variants
-> Result AccountBrandingSettingsLogo'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((File -> AccountBrandingSettingsLogo'Variants
AccountBrandingSettingsLogo'File (File -> AccountBrandingSettingsLogo'Variants)
-> Result File -> Result AccountBrandingSettingsLogo'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result File
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result AccountBrandingSettingsLogo'Variants
-> Result AccountBrandingSettingsLogo'Variants
-> Result AccountBrandingSettingsLogo'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result AccountBrandingSettingsLogo'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success AccountBrandingSettingsLogo'Variants
a -> AccountBrandingSettingsLogo'Variants
-> Parser AccountBrandingSettingsLogo'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure AccountBrandingSettingsLogo'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser AccountBrandingSettingsLogo'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a