{-|
Module: Model.Types.Misc
Description: Additional uncategorized types
-}

module Model.Types.Misc
  ( module Model.Types.Misc
  ) where

import Import.NoModel
import Control.Lens

import Data.Maybe (fromJust)

import qualified Data.Text as Text
import qualified Data.Text.Lens as Text


data StudyFieldType = FieldPrimary | FieldSecondary
  deriving (Eq, Ord, Enum, Show, Read, Bounded, Generic)
derivePersistField "StudyFieldType"


data Theme
  = ThemeDefault
  | ThemeLavender
  | ThemeNeutralBlue
  | ThemeAberdeenReds
  | ThemeMossGreen
  | ThemeSkyLove
  deriving (Eq, Ord, Bounded, Enum, Show, Read, Generic)

deriveJSON defaultOptions
  { constructorTagModifier = fromJust . stripPrefix "Theme"
  } ''Theme

instance Universe Theme
instance Finite Theme

nullaryPathPiece ''Theme $ camelToPathPiece' 1

$(deriveSimpleWith ''ToMessage 'toMessage (over Text.packed $ Text.intercalate " " . unsafeTail . splitCamel) ''Theme) -- describe theme to user

derivePersistField "Theme"
