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

module Settings.OAuth2
  ( AzureConf(..)
  , _azureConfClientId, _azureConfClientSecret, _azureConfTenantId, _azureConfScopes
  ) where

import ClassyPrelude

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

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


data AzureConf = AzureConf
  { azureConfClientId     :: UUID
  , azureConfClientSecret :: Text
  , azureConfTenantId     :: UUID
  , azureConfScopes       :: Set Text -- TODO: use AzureScopes type?
  }
  deriving (Show)

makeLenses_ ''AzureConf

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