{-# LANGUAGE MultiWayIf #-}
-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
{-# LANGUAGE OverloadedStrings #-}

-- | Contains the types generated from the schema AccountDashboardSettings
module StripeAPI.Types.AccountDashboardSettings 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 qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.account_dashboard_settings@ in the specification.
data AccountDashboardSettings = AccountDashboardSettings
  { -- | display_name: The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountDashboardSettings -> Maybe Text
accountDashboardSettingsDisplayName :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | timezone: The timezone used in the Stripe Dashboard for this account. A list of possible time zone values is maintained at the [IANA Time Zone Database](http:\/\/www.iana.org\/time-zones).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountDashboardSettings -> Maybe Text
accountDashboardSettingsTimezone :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> AccountDashboardSettings -> ShowS
[AccountDashboardSettings] -> ShowS
AccountDashboardSettings -> String
(Int -> AccountDashboardSettings -> ShowS)
-> (AccountDashboardSettings -> String)
-> ([AccountDashboardSettings] -> ShowS)
-> Show AccountDashboardSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountDashboardSettings] -> ShowS
$cshowList :: [AccountDashboardSettings] -> ShowS
show :: AccountDashboardSettings -> String
$cshow :: AccountDashboardSettings -> String
showsPrec :: Int -> AccountDashboardSettings -> ShowS
$cshowsPrec :: Int -> AccountDashboardSettings -> ShowS
GHC.Show.Show,
      AccountDashboardSettings -> AccountDashboardSettings -> Bool
(AccountDashboardSettings -> AccountDashboardSettings -> Bool)
-> (AccountDashboardSettings -> AccountDashboardSettings -> Bool)
-> Eq AccountDashboardSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountDashboardSettings -> AccountDashboardSettings -> Bool
$c/= :: AccountDashboardSettings -> AccountDashboardSettings -> Bool
== :: AccountDashboardSettings -> AccountDashboardSettings -> Bool
$c== :: AccountDashboardSettings -> AccountDashboardSettings -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON AccountDashboardSettings where
  toJSON :: AccountDashboardSettings -> Value
toJSON AccountDashboardSettings
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"display_name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountDashboardSettings -> Maybe Text
accountDashboardSettingsDisplayName AccountDashboardSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"timezone" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountDashboardSettings -> Maybe Text
accountDashboardSettingsTimezone AccountDashboardSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: AccountDashboardSettings -> Encoding
toEncoding AccountDashboardSettings
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"display_name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountDashboardSettings -> Maybe Text
accountDashboardSettingsDisplayName AccountDashboardSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"timezone" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountDashboardSettings -> Maybe Text
accountDashboardSettingsTimezone AccountDashboardSettings
obj))

instance Data.Aeson.Types.FromJSON.FromJSON AccountDashboardSettings where
  parseJSON :: Value -> Parser AccountDashboardSettings
parseJSON = String
-> (Object -> Parser AccountDashboardSettings)
-> Value
-> Parser AccountDashboardSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"AccountDashboardSettings" (\Object
obj -> ((Maybe Text -> Maybe Text -> AccountDashboardSettings)
-> Parser (Maybe Text -> Maybe Text -> AccountDashboardSettings)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text -> Maybe Text -> AccountDashboardSettings
AccountDashboardSettings Parser (Maybe Text -> Maybe Text -> AccountDashboardSettings)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AccountDashboardSettings)
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
"display_name")) Parser (Maybe Text -> AccountDashboardSettings)
-> Parser (Maybe Text) -> Parser AccountDashboardSettings
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
"timezone"))

-- | Create a new 'AccountDashboardSettings' with all required fields.
mkAccountDashboardSettings :: AccountDashboardSettings
mkAccountDashboardSettings :: AccountDashboardSettings
mkAccountDashboardSettings =
  AccountDashboardSettings :: Maybe Text -> Maybe Text -> AccountDashboardSettings
AccountDashboardSettings
    { accountDashboardSettingsDisplayName :: Maybe Text
accountDashboardSettingsDisplayName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      accountDashboardSettingsTimezone :: Maybe Text
accountDashboardSettingsTimezone = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }