{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module BDCS.Label.Types(Label(..),
labelDescriptions)
where
import Data.Aeson((.=), ToJSON, object, toJSON)
import qualified Data.Text as T
import Database.Persist.TH
data Label = DocsLabel
| FontsLabel
| InfoPageLabel
| LibraryLabel
| LicenseLabel
| ManPageLabel
| ServiceLabel
| TranslationLabel T.Text
deriving(Eq, Read, Show)
instance ToJSON Label where
toJSON (TranslationLabel lang) = object ["TranslationLabel" .= toJSON lang]
toJSON lbl = toJSON $ T.pack $ show lbl
derivePersistField "Label"
labelDescriptions :: [(String, String)]
labelDescriptions = [
("DocsLabel", "Documentation - mostly things in /usr/share/doc"),
("FontsLabel", "Fonts"),
("InfoPageLabel", "GNU info pages"),
("LibraryLabel", "Static and shared libraries"),
("LicenseLabel", "Files containing a software license"),
("ManPageLabel", "man pages"),
("ServiceLabel", "systemd .service files"),
("TranslationLabel", "Translations - takes a language code as argument")
]