{-# LANGUAGE OverloadedStrings #-} module Types where import Data.Text.Lazy (Text) import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.Aeson (ToJSON(..), object, (.=)) data Language = French | English deriving (Show, Eq) type TranslationKey = Text type TranslationValue = Text type Translation = Map TranslationKey TranslationValue data CommandResponse = CommandResponse { responseText :: Text , responseHtml :: Bool } deriving (Show) -- Instance ToJSON pour permettre la sérialisation JSON instance ToJSON CommandResponse where toJSON (CommandResponse text html) = object [ "responseText" .= text , "responseHtml" .= html ]