{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.RadarReviewResourceLocation 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
data RadarReviewResourceLocation = RadarReviewResourceLocation
{
RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationCity :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
RadarReviewResourceLocation -> Maybe Double
radarReviewResourceLocationLatitude :: (GHC.Maybe.Maybe GHC.Types.Double),
RadarReviewResourceLocation -> Maybe Double
radarReviewResourceLocationLongitude :: (GHC.Maybe.Maybe GHC.Types.Double),
RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationRegion :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> RadarReviewResourceLocation -> ShowS
[RadarReviewResourceLocation] -> ShowS
RadarReviewResourceLocation -> String
(Int -> RadarReviewResourceLocation -> ShowS)
-> (RadarReviewResourceLocation -> String)
-> ([RadarReviewResourceLocation] -> ShowS)
-> Show RadarReviewResourceLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RadarReviewResourceLocation] -> ShowS
$cshowList :: [RadarReviewResourceLocation] -> ShowS
show :: RadarReviewResourceLocation -> String
$cshow :: RadarReviewResourceLocation -> String
showsPrec :: Int -> RadarReviewResourceLocation -> ShowS
$cshowsPrec :: Int -> RadarReviewResourceLocation -> ShowS
GHC.Show.Show,
RadarReviewResourceLocation -> RadarReviewResourceLocation -> Bool
(RadarReviewResourceLocation
-> RadarReviewResourceLocation -> Bool)
-> (RadarReviewResourceLocation
-> RadarReviewResourceLocation -> Bool)
-> Eq RadarReviewResourceLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RadarReviewResourceLocation -> RadarReviewResourceLocation -> Bool
$c/= :: RadarReviewResourceLocation -> RadarReviewResourceLocation -> Bool
== :: RadarReviewResourceLocation -> RadarReviewResourceLocation -> Bool
$c== :: RadarReviewResourceLocation -> RadarReviewResourceLocation -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON RadarReviewResourceLocation where
toJSON :: RadarReviewResourceLocation -> Value
toJSON RadarReviewResourceLocation
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"city" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationCity RadarReviewResourceLocation
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationCountry RadarReviewResourceLocation
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"latitude" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Double
radarReviewResourceLocationLatitude RadarReviewResourceLocation
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"longitude" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Double
radarReviewResourceLocationLongitude RadarReviewResourceLocation
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"region" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationRegion RadarReviewResourceLocation
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: RadarReviewResourceLocation -> Encoding
toEncoding RadarReviewResourceLocation
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"city" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationCity RadarReviewResourceLocation
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationCountry RadarReviewResourceLocation
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"latitude" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Double
radarReviewResourceLocationLatitude RadarReviewResourceLocation
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"longitude" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Double
radarReviewResourceLocationLongitude RadarReviewResourceLocation
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"region" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= RadarReviewResourceLocation -> Maybe Text
radarReviewResourceLocationRegion RadarReviewResourceLocation
obj)))))
instance Data.Aeson.Types.FromJSON.FromJSON RadarReviewResourceLocation where
parseJSON :: Value -> Parser RadarReviewResourceLocation
parseJSON = String
-> (Object -> Parser RadarReviewResourceLocation)
-> Value
-> Parser RadarReviewResourceLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"RadarReviewResourceLocation" (\Object
obj -> (((((Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation
RadarReviewResourceLocation Parser
(Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation)
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
"city")) Parser
(Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation)
-> Parser (Maybe Text)
-> Parser
(Maybe Double
-> Maybe Double -> Maybe Text -> RadarReviewResourceLocation)
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
"country")) Parser
(Maybe Double
-> Maybe Double -> Maybe Text -> RadarReviewResourceLocation)
-> Parser (Maybe Double)
-> Parser
(Maybe Double -> Maybe Text -> RadarReviewResourceLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"latitude")) Parser (Maybe Double -> Maybe Text -> RadarReviewResourceLocation)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> RadarReviewResourceLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"longitude")) Parser (Maybe Text -> RadarReviewResourceLocation)
-> Parser (Maybe Text) -> Parser RadarReviewResourceLocation
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
"region"))
mkRadarReviewResourceLocation :: RadarReviewResourceLocation
mkRadarReviewResourceLocation :: RadarReviewResourceLocation
mkRadarReviewResourceLocation =
RadarReviewResourceLocation :: Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> RadarReviewResourceLocation
RadarReviewResourceLocation
{ radarReviewResourceLocationCity :: Maybe Text
radarReviewResourceLocationCity = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
radarReviewResourceLocationCountry :: Maybe Text
radarReviewResourceLocationCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
radarReviewResourceLocationLatitude :: Maybe Double
radarReviewResourceLocationLatitude = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing,
radarReviewResourceLocationLongitude :: Maybe Double
radarReviewResourceLocationLongitude = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing,
radarReviewResourceLocationRegion :: Maybe Text
radarReviewResourceLocationRegion = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}