module Paddle.Client.ListUsersResponse where

import Data.Aeson (FromJSON, parseJSON, genericParseJSON)
import Protolude
import Prelude ()
import Paddle.FieldModifier (customJSONOptions)
import Paddle.Amount

data ListUsersResponse = ListUsersResponse
  { ListUsersResponse -> Integer
subscriptionId :: Integer
  , ListUsersResponse -> Integer
planId :: Integer
  , ListUsersResponse -> Integer
userId :: Integer
  , ListUsersResponse -> Text
userEmail :: Text
  , ListUsersResponse -> Bool
marketingConsent :: Bool
  , ListUsersResponse -> Payment
lastPayment :: Payment
  , ListUsersResponse -> Maybe Payment
nextPayment :: Maybe Payment
  , ListUsersResponse -> Text
updateUrl :: Text
  , ListUsersResponse -> Text
cancelUrl :: Text
  -- TODO: state, signup_date, paused_at, paused_from
  } deriving (Int -> ListUsersResponse -> ShowS
[ListUsersResponse] -> ShowS
ListUsersResponse -> String
(Int -> ListUsersResponse -> ShowS)
-> (ListUsersResponse -> String)
-> ([ListUsersResponse] -> ShowS)
-> Show ListUsersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUsersResponse] -> ShowS
$cshowList :: [ListUsersResponse] -> ShowS
show :: ListUsersResponse -> String
$cshow :: ListUsersResponse -> String
showsPrec :: Int -> ListUsersResponse -> ShowS
$cshowsPrec :: Int -> ListUsersResponse -> ShowS
Show, (forall x. ListUsersResponse -> Rep ListUsersResponse x)
-> (forall x. Rep ListUsersResponse x -> ListUsersResponse)
-> Generic ListUsersResponse
forall x. Rep ListUsersResponse x -> ListUsersResponse
forall x. ListUsersResponse -> Rep ListUsersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUsersResponse x -> ListUsersResponse
$cfrom :: forall x. ListUsersResponse -> Rep ListUsersResponse x
Generic)

instance FromJSON ListUsersResponse where
  parseJSON :: Value -> Parser ListUsersResponse
parseJSON = Options -> Value -> Parser ListUsersResponse
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customJSONOptions

data Payment = Payment
  { Payment -> Amount
amount :: Amount
  , Payment -> Text
currency :: Text
  , Payment -> Text
date :: Text
  } deriving (Int -> Payment -> ShowS
[Payment] -> ShowS
Payment -> String
(Int -> Payment -> ShowS)
-> (Payment -> String) -> ([Payment] -> ShowS) -> Show Payment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Payment] -> ShowS
$cshowList :: [Payment] -> ShowS
show :: Payment -> String
$cshow :: Payment -> String
showsPrec :: Int -> Payment -> ShowS
$cshowsPrec :: Int -> Payment -> ShowS
Show, (forall x. Payment -> Rep Payment x)
-> (forall x. Rep Payment x -> Payment) -> Generic Payment
forall x. Rep Payment x -> Payment
forall x. Payment -> Rep Payment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Payment x -> Payment
$cfrom :: forall x. Payment -> Rep Payment x
Generic)

instance FromJSON Payment where
  parseJSON :: Value -> Parser Payment
parseJSON = Options -> Value -> Parser Payment
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customJSONOptions