{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes       #-}

module Keys where

import           Data.ByteString      (ByteString)
import           Network.OAuth.OAuth2
import           URI.ByteString.QQ

weiboKey :: OAuth2
weiboKey = OAuth2 { oauthClientId = "1962132691"
                  , oauthClientSecret = "a2ad30383bdff9bcb12be6a3d30deeb1"
                  , oauthCallback = Just [uri|http://127.0.0.1:9988/oauth2/callback|]
                  , oauthOAuthorizeEndpoint = [uri|https://api.weibo.com/oauth2/authorize|]
                  , oauthAccessTokenEndpoint = [uri|https://api.weibo.com/oauth2/access_token|]
                  }

-- | http://developer.github.com/v3/oauth/
githubKey :: OAuth2
githubKey = OAuth2 { oauthClientId = "bf86d338485a96a93c88"
                   , oauthClientSecret = "a1c00dada665dc00aa6fafe0495c7c885f82d1ce"
                   , oauthCallback = Just [uri|http://127.0.0.1:9988/oauth2/callback|]
                   , oauthOAuthorizeEndpoint = [uri|https://github.com/login/oauth/authorize|]
                   , oauthAccessTokenEndpoint = [uri|https://github.com/login/oauth/access_token|]
                   }

-- | oauthCallback = Just "https://developers.google.com/oauthplayground"
googleKey :: OAuth2
googleKey = OAuth2 { oauthClientId = "886894027376.apps.googleusercontent.com"
                   , oauthClientSecret = "27w98gwGB1h8N5a6JQ2bT_nm"
                   , oauthCallback = Just [uri|http://127.0.0.1:9988/oauth2/callback|]
                   , oauthOAuthorizeEndpoint = [uri|https://accounts.google.com/o/oauth2/auth|]
                   , oauthAccessTokenEndpoint = [uri|https://www.googleapis.com/oauth2/v3/token|]
                   }


facebookKey :: OAuth2
facebookKey = OAuth2 { oauthClientId = "414630782030965"
                     , oauthClientSecret = "0e648eae100da4d03f16594f231fc1d0"
                     , oauthCallback = Just [uri|http://127.0.0.1:9988/oauth2/callback|]
                     , oauthOAuthorizeEndpoint = [uri|https://www.facebook.com/dialog/oauth|]
                     , oauthAccessTokenEndpoint = [uri|https://graph.facebook.com/v2.3/oauth/access_token|]
                     }

doubanKey :: OAuth2
doubanKey = OAuth2 { oauthClientId = "02a914cf299ca31607fb3e6d7cd5e942"
                   , oauthClientSecret = "3c0fdef13b0dd271"
                   , oauthCallback = Just [uri|http://localhost:9999/oauthCallback|]
                   , oauthOAuthorizeEndpoint = [uri|https://www.douban.com/service/auth2/auth|]
                   , oauthAccessTokenEndpoint = [uri|https://www.douban.com/service/auth2/token|]
                   }

fitbitKey :: OAuth2
fitbitKey = OAuth2 { oauthClientId = "229LN9"
                   , oauthClientSecret = "2f4aa9a275c2d4bb9eb616efbd2c1311"
                   , oauthCallback = Just [uri|http://localhost:9988/oauth2/callback|]
                   , oauthOAuthorizeEndpoint = [uri|https://www.fitbit.com/oauth2/authorize|]
                   , oauthAccessTokenEndpoint = [uri|https://api.fitbit.com/oauth2/token|]
                   }

-- fix key from your application edit page
-- https://stackapps.com/apps/oauth
stackexchangeAppKey :: ByteString
stackexchangeAppKey = "xxxxxx"

stackexchangeKey :: OAuth2
stackexchangeKey = OAuth2 { oauthClientId = "7185"
                          , oauthClientSecret = "K5hK)ET*dbFGFmNFVtqIyA(("
                          , oauthCallback = Just [uri|http://c.haskellcn.org/cb|]
                          , oauthOAuthorizeEndpoint = [uri|https://stackexchange.com/oauth|]
                          , oauthAccessTokenEndpoint = [uri|https://stackexchange.com/oauth/access_token|]
                          }

dropboxKey :: OAuth2
dropboxKey = OAuth2 { oauthClientId = "zbyxxox19gz6dgg"
                    , oauthClientSecret = "ihhui0ysp85oi8s"
                    , oauthCallback = Just [uri|http://localhost:9988/oauth2/callback|]
                    , oauthOAuthorizeEndpoint = [uri|https://www.dropbox.com/1/oauth2/authorize|]
                    , oauthAccessTokenEndpoint = [uri|https://api.dropboxapi.com/oauth2/token|]
                    }

oktaKey :: OAuth2
oktaKey = OAuth2 { oauthClientId = "0oad3popatwUIhWV40h7"
                 , oauthClientSecret = "YFqXRjtsy7IYRbueiG2tcgHzhaawLccxqq5ruPfN"
                 , oauthCallback = Just [uri|http://localhost:9988/oauth2/callback|]
                 , oauthOAuthorizeEndpoint = [uri|https://dev-148986.oktapreview.com/oauth2/v1/authorize|]
                 , oauthAccessTokenEndpoint = [uri|https://dev-148986.oktapreview.com/oauth2/v1/token|]
                 }

azureADKey :: OAuth2
azureADKey = OAuth2 { oauthClientId = "xxx"
                    , oauthClientSecret = "xxx"
                    , oauthCallback = Just [uri|http://localhost:9988/oauth2/callback|]
                    , oauthOAuthorizeEndpoint = [uri|https://login.windows.net/common/oauth2/authorize|]
                    , oauthAccessTokenEndpoint = [uri|https://login.windows.net/common/oauth2/token|]
                    }
