{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoFieldSelectors #-}

module WikiMusic.Model.Mail
  ( MailCommandError (..),
    MailCommandOutcome (..),
    MailSendRequest (..),
  )
where

import Data.Aeson hiding (Success)
import Optics
import Relude

data MailCommandError = MailError Text | LogicError Text | NetworkError Text deriving (Int -> MailCommandError -> ShowS
[MailCommandError] -> ShowS
MailCommandError -> String
(Int -> MailCommandError -> ShowS)
-> (MailCommandError -> String)
-> ([MailCommandError] -> ShowS)
-> Show MailCommandError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MailCommandError -> ShowS
showsPrec :: Int -> MailCommandError -> ShowS
$cshow :: MailCommandError -> String
show :: MailCommandError -> String
$cshowList :: [MailCommandError] -> ShowS
showList :: [MailCommandError] -> ShowS
Show)

data MailCommandOutcome = MailSent | MailNotSent

data MailSendRequest = MailSendRequest
  { MailSendRequest -> Text
subject :: Text,
    MailSendRequest -> Text
email :: Text,
    MailSendRequest -> Maybe Text
name :: Maybe Text,
    MailSendRequest -> Text
body :: Text
  }
  deriving ((forall x. MailSendRequest -> Rep MailSendRequest x)
-> (forall x. Rep MailSendRequest x -> MailSendRequest)
-> Generic MailSendRequest
forall x. Rep MailSendRequest x -> MailSendRequest
forall x. MailSendRequest -> Rep MailSendRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MailSendRequest -> Rep MailSendRequest x
from :: forall x. MailSendRequest -> Rep MailSendRequest x
$cto :: forall x. Rep MailSendRequest x -> MailSendRequest
to :: forall x. Rep MailSendRequest x -> MailSendRequest
Generic, Maybe MailSendRequest
Value -> Parser [MailSendRequest]
Value -> Parser MailSendRequest
(Value -> Parser MailSendRequest)
-> (Value -> Parser [MailSendRequest])
-> Maybe MailSendRequest
-> FromJSON MailSendRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser MailSendRequest
parseJSON :: Value -> Parser MailSendRequest
$cparseJSONList :: Value -> Parser [MailSendRequest]
parseJSONList :: Value -> Parser [MailSendRequest]
$comittedField :: Maybe MailSendRequest
omittedField :: Maybe MailSendRequest
FromJSON, [MailSendRequest] -> Value
[MailSendRequest] -> Encoding
MailSendRequest -> Bool
MailSendRequest -> Value
MailSendRequest -> Encoding
(MailSendRequest -> Value)
-> (MailSendRequest -> Encoding)
-> ([MailSendRequest] -> Value)
-> ([MailSendRequest] -> Encoding)
-> (MailSendRequest -> Bool)
-> ToJSON MailSendRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: MailSendRequest -> Value
toJSON :: MailSendRequest -> Value
$ctoEncoding :: MailSendRequest -> Encoding
toEncoding :: MailSendRequest -> Encoding
$ctoJSONList :: [MailSendRequest] -> Value
toJSONList :: [MailSendRequest] -> Value
$ctoEncodingList :: [MailSendRequest] -> Encoding
toEncodingList :: [MailSendRequest] -> Encoding
$comitField :: MailSendRequest -> Bool
omitField :: MailSendRequest -> Bool
ToJSON, Int -> MailSendRequest -> ShowS
[MailSendRequest] -> ShowS
MailSendRequest -> String
(Int -> MailSendRequest -> ShowS)
-> (MailSendRequest -> String)
-> ([MailSendRequest] -> ShowS)
-> Show MailSendRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MailSendRequest -> ShowS
showsPrec :: Int -> MailSendRequest -> ShowS
$cshow :: MailSendRequest -> String
show :: MailSendRequest -> String
$cshowList :: [MailSendRequest] -> ShowS
showList :: [MailSendRequest] -> ShowS
Show, MailSendRequest -> MailSendRequest -> Bool
(MailSendRequest -> MailSendRequest -> Bool)
-> (MailSendRequest -> MailSendRequest -> Bool)
-> Eq MailSendRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MailSendRequest -> MailSendRequest -> Bool
== :: MailSendRequest -> MailSendRequest -> Bool
$c/= :: MailSendRequest -> MailSendRequest -> Bool
/= :: MailSendRequest -> MailSendRequest -> Bool
Eq)

makeFieldLabelsNoPrefix ''MailSendRequest