{-# 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 PortalBusinessProfile
module StripeAPI.Types.PortalBusinessProfile 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.portal_business_profile@ in the specification.
data PortalBusinessProfile = PortalBusinessProfile
  { -- | headline: The messaging shown to customers in the portal.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PortalBusinessProfile -> Maybe Text
portalBusinessProfileHeadline :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | privacy_policy_url: A link to the business’s publicly available privacy policy.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PortalBusinessProfile -> Text
portalBusinessProfilePrivacyPolicyUrl :: Data.Text.Internal.Text,
    -- | terms_of_service_url: A link to the business’s publicly available terms of service.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PortalBusinessProfile -> Text
portalBusinessProfileTermsOfServiceUrl :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> PortalBusinessProfile -> ShowS
[PortalBusinessProfile] -> ShowS
PortalBusinessProfile -> String
(Int -> PortalBusinessProfile -> ShowS)
-> (PortalBusinessProfile -> String)
-> ([PortalBusinessProfile] -> ShowS)
-> Show PortalBusinessProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortalBusinessProfile] -> ShowS
$cshowList :: [PortalBusinessProfile] -> ShowS
show :: PortalBusinessProfile -> String
$cshow :: PortalBusinessProfile -> String
showsPrec :: Int -> PortalBusinessProfile -> ShowS
$cshowsPrec :: Int -> PortalBusinessProfile -> ShowS
GHC.Show.Show,
      PortalBusinessProfile -> PortalBusinessProfile -> Bool
(PortalBusinessProfile -> PortalBusinessProfile -> Bool)
-> (PortalBusinessProfile -> PortalBusinessProfile -> Bool)
-> Eq PortalBusinessProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortalBusinessProfile -> PortalBusinessProfile -> Bool
$c/= :: PortalBusinessProfile -> PortalBusinessProfile -> Bool
== :: PortalBusinessProfile -> PortalBusinessProfile -> Bool
$c== :: PortalBusinessProfile -> PortalBusinessProfile -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PortalBusinessProfile where
  toJSON :: PortalBusinessProfile -> Value
toJSON PortalBusinessProfile
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"headline" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalBusinessProfile -> Maybe Text
portalBusinessProfileHeadline PortalBusinessProfile
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"privacy_policy_url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalBusinessProfile -> Text
portalBusinessProfilePrivacyPolicyUrl PortalBusinessProfile
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"terms_of_service_url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalBusinessProfile -> Text
portalBusinessProfileTermsOfServiceUrl PortalBusinessProfile
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PortalBusinessProfile -> Encoding
toEncoding PortalBusinessProfile
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"headline" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalBusinessProfile -> Maybe Text
portalBusinessProfileHeadline PortalBusinessProfile
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"privacy_policy_url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalBusinessProfile -> Text
portalBusinessProfilePrivacyPolicyUrl PortalBusinessProfile
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"terms_of_service_url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalBusinessProfile -> Text
portalBusinessProfileTermsOfServiceUrl PortalBusinessProfile
obj)))

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

-- | Create a new 'PortalBusinessProfile' with all required fields.
mkPortalBusinessProfile ::
  -- | 'portalBusinessProfilePrivacyPolicyUrl'
  Data.Text.Internal.Text ->
  -- | 'portalBusinessProfileTermsOfServiceUrl'
  Data.Text.Internal.Text ->
  PortalBusinessProfile
mkPortalBusinessProfile :: Text -> Text -> PortalBusinessProfile
mkPortalBusinessProfile Text
portalBusinessProfilePrivacyPolicyUrl Text
portalBusinessProfileTermsOfServiceUrl =
  PortalBusinessProfile :: Maybe Text -> Text -> Text -> PortalBusinessProfile
PortalBusinessProfile
    { portalBusinessProfileHeadline :: Maybe Text
portalBusinessProfileHeadline = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      portalBusinessProfilePrivacyPolicyUrl :: Text
portalBusinessProfilePrivacyPolicyUrl = Text
portalBusinessProfilePrivacyPolicyUrl,
      portalBusinessProfileTermsOfServiceUrl :: Text
portalBusinessProfileTermsOfServiceUrl = Text
portalBusinessProfileTermsOfServiceUrl
    }