-- SPDX-FileCopyrightText: 2024 Sarah Vaupel <sarah.vaupel@uniworx.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later

module Settings.OAuth2
  ( AzureConf(..)
  , _azureClientId, _azureClientSecret, _azureTenantId, _azureScopes
  ) where

import ClassyPrelude

import Data.Aeson
import Data.Aeson.TH
import Data.UUID

import Utils.Lens.TH
import Utils.PathPiece (camelToPathPiece')


-- TODO: use better types
data AzureConf = AzureConf
  { azureClientId     :: UUID
  , azureClientSecret :: Text
  , azureTenantId     :: UUID
  , azureScopes       :: Set Text -- TODO: use better type
  } deriving (Show)

makeLenses_ ''AzureConf

deriveFromJSON defaultOptions
  { fieldLabelModifier = camelToPathPiece' 1
  } ''AzureConf
