{-# LANGUAGE TemplateHaskell #-}

module PayPal.Adaptive.Core.Client where

import           Data.Aeson.TH
import           Data.Aeson.Types (camelTo)

import           Import

data Client = Client
  { _clAppId        :: Text
  , _clUserId       :: Text
  , _clEnvironment  :: Environment
  , _clPassword     :: Text
  , _clSignature    :: Text
  , _clAccountEmail :: Text
  -- ^ Not needed for authentication, but deposits are sent
  -- to here and withdrawals are sent from here. Must be the
  -- email associated with your PayPal app.
  } deriving (Eq, Show)

data Environment = Sandbox | Production deriving (Eq, Show, Read)

$(deriveJSON defaultOptions { fieldLabelModifier = camelTo '_' . drop 3 } ''Client)
$(deriveJSON defaultOptions { constructorTagModifier = id } ''Environment)
$(makeLenses ''Client)
$(makePrisms ''Environment)