{-# LANGUAGE CPP #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

module Effectful.Notify.Internal.Data.NotifySystem
  ( -- * Platform-specific systems
    NotifySystemOs (..),
    defaultNotifySystemOs,

    -- * All systems
    NotifySystem (..),
    defaultNotifySystem,
    notifySystemToOs,
    notifySystemFromOs,

    -- * Exceptions
    NotifyParseException (..),
  )
where

{- ORMOLU_ENABLE -}

import Control.DeepSeq (NFData)
import Control.Monad.Catch (Exception (displayException))
import Data.List qualified as L
import Data.Text qualified as T
import Data.Text.Builder.Linear qualified as TBL
import Data.Text.Display (Display (displayBuilder))
import Effectful.Notify.Internal.Os (Os)
import Effectful.Notify.Internal.Os qualified as Os
import GHC.Generics (Generic)
import Optics.Core (A_Lens, LabelOptic (labelOptic), (^.))
import Optics.Core qualified as O

-- NOTE: No need for any abstraction here as the only expected changes
-- (new system) would require a major bump anyway.

-- | Represents all possible notification systems. This is useful for when
-- we want to choose the system in some way that works across multiple
-- platforms without requiring cpp.
--
-- @since 0.1
data NotifySystem
  = NotifySystemAppleScript
  | NotifySystemDBus
  | NotifySystemNotifySend
  | NotifySystemWindows
  deriving stock (NotifySystem
NotifySystem -> NotifySystem -> Bounded NotifySystem
forall a. a -> a -> Bounded a
$cminBound :: NotifySystem
minBound :: NotifySystem
$cmaxBound :: NotifySystem
maxBound :: NotifySystem
Bounded, Int -> NotifySystem
NotifySystem -> Int
NotifySystem -> [NotifySystem]
NotifySystem -> NotifySystem
NotifySystem -> NotifySystem -> [NotifySystem]
NotifySystem -> NotifySystem -> NotifySystem -> [NotifySystem]
(NotifySystem -> NotifySystem)
-> (NotifySystem -> NotifySystem)
-> (Int -> NotifySystem)
-> (NotifySystem -> Int)
-> (NotifySystem -> [NotifySystem])
-> (NotifySystem -> NotifySystem -> [NotifySystem])
-> (NotifySystem -> NotifySystem -> [NotifySystem])
-> (NotifySystem -> NotifySystem -> NotifySystem -> [NotifySystem])
-> Enum NotifySystem
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: NotifySystem -> NotifySystem
succ :: NotifySystem -> NotifySystem
$cpred :: NotifySystem -> NotifySystem
pred :: NotifySystem -> NotifySystem
$ctoEnum :: Int -> NotifySystem
toEnum :: Int -> NotifySystem
$cfromEnum :: NotifySystem -> Int
fromEnum :: NotifySystem -> Int
$cenumFrom :: NotifySystem -> [NotifySystem]
enumFrom :: NotifySystem -> [NotifySystem]
$cenumFromThen :: NotifySystem -> NotifySystem -> [NotifySystem]
enumFromThen :: NotifySystem -> NotifySystem -> [NotifySystem]
$cenumFromTo :: NotifySystem -> NotifySystem -> [NotifySystem]
enumFromTo :: NotifySystem -> NotifySystem -> [NotifySystem]
$cenumFromThenTo :: NotifySystem -> NotifySystem -> NotifySystem -> [NotifySystem]
enumFromThenTo :: NotifySystem -> NotifySystem -> NotifySystem -> [NotifySystem]
Enum, NotifySystem -> NotifySystem -> Bool
(NotifySystem -> NotifySystem -> Bool)
-> (NotifySystem -> NotifySystem -> Bool) -> Eq NotifySystem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NotifySystem -> NotifySystem -> Bool
== :: NotifySystem -> NotifySystem -> Bool
$c/= :: NotifySystem -> NotifySystem -> Bool
/= :: NotifySystem -> NotifySystem -> Bool
Eq, (forall x. NotifySystem -> Rep NotifySystem x)
-> (forall x. Rep NotifySystem x -> NotifySystem)
-> Generic NotifySystem
forall x. Rep NotifySystem x -> NotifySystem
forall x. NotifySystem -> Rep NotifySystem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. NotifySystem -> Rep NotifySystem x
from :: forall x. NotifySystem -> Rep NotifySystem x
$cto :: forall x. Rep NotifySystem x -> NotifySystem
to :: forall x. Rep NotifySystem x -> NotifySystem
Generic, Eq NotifySystem
Eq NotifySystem =>
(NotifySystem -> NotifySystem -> Ordering)
-> (NotifySystem -> NotifySystem -> Bool)
-> (NotifySystem -> NotifySystem -> Bool)
-> (NotifySystem -> NotifySystem -> Bool)
-> (NotifySystem -> NotifySystem -> Bool)
-> (NotifySystem -> NotifySystem -> NotifySystem)
-> (NotifySystem -> NotifySystem -> NotifySystem)
-> Ord NotifySystem
NotifySystem -> NotifySystem -> Bool
NotifySystem -> NotifySystem -> Ordering
NotifySystem -> NotifySystem -> NotifySystem
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: NotifySystem -> NotifySystem -> Ordering
compare :: NotifySystem -> NotifySystem -> Ordering
$c< :: NotifySystem -> NotifySystem -> Bool
< :: NotifySystem -> NotifySystem -> Bool
$c<= :: NotifySystem -> NotifySystem -> Bool
<= :: NotifySystem -> NotifySystem -> Bool
$c> :: NotifySystem -> NotifySystem -> Bool
> :: NotifySystem -> NotifySystem -> Bool
$c>= :: NotifySystem -> NotifySystem -> Bool
>= :: NotifySystem -> NotifySystem -> Bool
$cmax :: NotifySystem -> NotifySystem -> NotifySystem
max :: NotifySystem -> NotifySystem -> NotifySystem
$cmin :: NotifySystem -> NotifySystem -> NotifySystem
min :: NotifySystem -> NotifySystem -> NotifySystem
Ord, Int -> NotifySystem -> ShowS
[NotifySystem] -> ShowS
NotifySystem -> String
(Int -> NotifySystem -> ShowS)
-> (NotifySystem -> String)
-> ([NotifySystem] -> ShowS)
-> Show NotifySystem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotifySystem -> ShowS
showsPrec :: Int -> NotifySystem -> ShowS
$cshow :: NotifySystem -> String
show :: NotifySystem -> String
$cshowList :: [NotifySystem] -> ShowS
showList :: [NotifySystem] -> ShowS
Show)
  deriving anyclass (NotifySystem -> ()
(NotifySystem -> ()) -> NFData NotifySystem
forall a. (a -> ()) -> NFData a
$crnf :: NotifySystem -> ()
rnf :: NotifySystem -> ()
NFData)

-- | @since 0.1
instance Display NotifySystem where
  displayBuilder :: NotifySystem -> Builder
displayBuilder = \case
    NotifySystem
NotifySystemAppleScript -> Builder
"apple-script"
    NotifySystem
NotifySystemDBus -> Builder
"dbus"
    NotifySystem
NotifySystemNotifySend -> Builder
"notify-send"
    NotifySystem
NotifySystemWindows -> Builder
"windows"

-- | Converts platform-agnostic 'NotifySystem' to platform-specific
-- 'NotifySystemOs'. Useful for obtaining a valid system for the current
-- platform without cpp.
--
-- @since 0.1
notifySystemToOs :: NotifySystem -> Either NotifyParseException NotifySystemOs
{-# INLINEABLE notifySystemToOs #-}

-- | Inverse 'notifySystemToOs'.
--
-- @since 0.1
notifySystemFromOs :: NotifySystemOs -> NotifySystem

-- | @since 0.1
defaultNotifySystem :: NotifySystem

-- | @since 0.1
defaultNotifySystemOs :: NotifySystemOs

-- | @since 0.1
instance Display NotifySystemOs where
  displayBuilder :: NotifySystemOs -> Builder
displayBuilder = NotifySystem -> Builder
forall a. Display a => a -> Builder
displayBuilder (NotifySystem -> Builder)
-> (NotifySystemOs -> NotifySystem) -> NotifySystemOs -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NotifySystemOs -> NotifySystem
notifySystemFromOs

-- | Exceptions thrown when parsing 'NotifySystem' to 'NotifySystemOs'.
--
-- @since 0.1
data NotifyParseException = MkNotifyParseException
  { -- | The current 'Os'.
    NotifyParseException -> Os
os :: Os,
    -- | The 'NotifySystem' we attempted to use.
    NotifyParseException -> NotifySystem
system :: NotifySystem
  }
  deriving stock (Int -> NotifyParseException -> ShowS
[NotifyParseException] -> ShowS
NotifyParseException -> String
(Int -> NotifyParseException -> ShowS)
-> (NotifyParseException -> String)
-> ([NotifyParseException] -> ShowS)
-> Show NotifyParseException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotifyParseException -> ShowS
showsPrec :: Int -> NotifyParseException -> ShowS
$cshow :: NotifyParseException -> String
show :: NotifyParseException -> String
$cshowList :: [NotifyParseException] -> ShowS
showList :: [NotifyParseException] -> ShowS
Show)

-- | @since 0.1
instance Exception NotifyParseException where
  displayException :: NotifyParseException -> String
displayException NotifyParseException
ex =
    Text -> String
T.unpack
      (Text -> String) -> ([Builder] -> Text) -> [Builder] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
Builder -> Text
TBL.runBuilder
      (Builder -> Text) -> ([Builder] -> Builder) -> [Builder] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Builder] -> Builder
forall a. Monoid a => [a] -> a
mconcat
      ([Builder] -> String) -> [Builder] -> String
forall a b. (a -> b) -> a -> b
$ [ Builder
"Notification system '",
          NotifySystem -> Builder
forall a. Display a => a -> Builder
displayBuilder (NotifyParseException
ex NotifyParseException
-> Optic' A_Lens NoIx NotifyParseException NotifySystem
-> NotifySystem
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx NotifyParseException NotifySystem
#system),
          Builder
"' is unavailable on os ",
          Os -> Builder
forall a. Display a => a -> Builder
displayBuilder (NotifyParseException
ex NotifyParseException
-> Optic' A_Lens NoIx NotifyParseException Os -> Os
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx NotifyParseException Os
#os),
          Builder
". Available systems: ",
          Builder
availSystems,
          Builder
"."
        ]
    where
      availSystems :: Builder
availSystems =
        [Builder] -> Builder
forall a. Monoid a => [a] -> a
mconcat
          ([Builder] -> Builder)
-> ([NotifySystemOs] -> [Builder]) -> [NotifySystemOs] -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> [Builder] -> [Builder]
forall a. a -> [a] -> [a]
L.intersperse Builder
", "
          ([Builder] -> [Builder])
-> ([NotifySystemOs] -> [Builder]) -> [NotifySystemOs] -> [Builder]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NotifySystemOs -> Builder) -> [NotifySystemOs] -> [Builder]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NotifySystemOs -> Builder
forall a. Display a => a -> Builder
displayBuilder
          ([NotifySystemOs] -> Builder) -> [NotifySystemOs] -> Builder
forall a b. (a -> b) -> a -> b
$ [NotifySystemOs
forall a. Bounded a => a
minBound .. NotifySystemOs
forall a. Bounded a => a
maxBound :: NotifySystemOs]

-- | @since 0.1
instance
  (k ~ A_Lens, a ~ Os, b ~ Os) =>
  LabelOptic "os" k NotifyParseException NotifyParseException a b
  where
  labelOptic :: Optic k NoIx NotifyParseException NotifyParseException a b
labelOptic = LensVL NotifyParseException NotifyParseException a b
-> Lens NotifyParseException NotifyParseException a b
forall s t a b. LensVL s t a b -> Lens s t a b
O.lensVL (LensVL NotifyParseException NotifyParseException a b
 -> Lens NotifyParseException NotifyParseException a b)
-> LensVL NotifyParseException NotifyParseException a b
-> Lens NotifyParseException NotifyParseException a b
forall a b. (a -> b) -> a -> b
$ \a -> f b
f (MkNotifyParseException Os
a1 NotifySystem
a2) ->
    (Os -> NotifyParseException) -> f Os -> f NotifyParseException
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Os
b -> Os -> NotifySystem -> NotifyParseException
MkNotifyParseException Os
b NotifySystem
a2) (a -> f b
f a
Os
a1)
  {-# INLINE labelOptic #-}

-- | @since 0.1
instance
  (k ~ A_Lens, a ~ NotifySystem, b ~ NotifySystem) =>
  LabelOptic "system" k NotifyParseException NotifyParseException a b
  where
  labelOptic :: Optic k NoIx NotifyParseException NotifyParseException a b
labelOptic = LensVL NotifyParseException NotifyParseException a b
-> Lens NotifyParseException NotifyParseException a b
forall s t a b. LensVL s t a b -> Lens s t a b
O.lensVL (LensVL NotifyParseException NotifyParseException a b
 -> Lens NotifyParseException NotifyParseException a b)
-> LensVL NotifyParseException NotifyParseException a b
-> Lens NotifyParseException NotifyParseException a b
forall a b. (a -> b) -> a -> b
$ \a -> f b
f (MkNotifyParseException Os
a1 NotifySystem
a2) ->
    (NotifySystem -> NotifyParseException)
-> f NotifySystem -> f NotifyParseException
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\NotifySystem
b -> Os -> NotifySystem -> NotifyParseException
MkNotifyParseException Os
a1 NotifySystem
b) (a -> f b
f a
NotifySystem
a2)
  {-# INLINE labelOptic #-}

#if LINUX

notifySystemToOs :: NotifySystem -> Either NotifyParseException NotifySystemOs
notifySystemToOs = \case
  NotifySystem
NotifySystemDBus -> NotifySystemOs -> Either NotifyParseException NotifySystemOs
forall a. a -> Either NotifyParseException a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotifySystemOs
NotifySystemOsDBus
  NotifySystem
NotifySystemNotifySend -> NotifySystemOs -> Either NotifyParseException NotifySystemOs
forall a. a -> Either NotifyParseException a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotifySystemOs
NotifySystemOsNotifySend
  NotifySystem
other -> NotifyParseException -> Either NotifyParseException NotifySystemOs
forall a b. a -> Either a b
Left (NotifyParseException
 -> Either NotifyParseException NotifySystemOs)
-> NotifyParseException
-> Either NotifyParseException NotifySystemOs
forall a b. (a -> b) -> a -> b
$ Os -> NotifySystem -> NotifyParseException
MkNotifyParseException Os
Os.Linux NotifySystem
other

notifySystemFromOs :: NotifySystemOs -> NotifySystem
notifySystemFromOs = \case
  NotifySystemOs
NotifySystemOsDBus -> NotifySystem
NotifySystemDBus
  NotifySystemOs
NotifySystemOsNotifySend -> NotifySystem
NotifySystemNotifySend

defaultNotifySystem :: NotifySystem
defaultNotifySystem = NotifySystem
NotifySystemDBus

defaultNotifySystemOs :: NotifySystemOs
defaultNotifySystemOs = NotifySystemOs
NotifySystemOsDBus

-- | Notification system. Options are platform specific.
--
-- @since 0.1
data NotifySystemOs
  = NotifySystemOsDBus
  | NotifySystemOsNotifySend
  deriving stock (NotifySystemOs
NotifySystemOs -> NotifySystemOs -> Bounded NotifySystemOs
forall a. a -> a -> Bounded a
$cminBound :: NotifySystemOs
minBound :: NotifySystemOs
$cmaxBound :: NotifySystemOs
maxBound :: NotifySystemOs
Bounded, Int -> NotifySystemOs
NotifySystemOs -> Int
NotifySystemOs -> [NotifySystemOs]
NotifySystemOs -> NotifySystemOs
NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
NotifySystemOs
-> NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
(NotifySystemOs -> NotifySystemOs)
-> (NotifySystemOs -> NotifySystemOs)
-> (Int -> NotifySystemOs)
-> (NotifySystemOs -> Int)
-> (NotifySystemOs -> [NotifySystemOs])
-> (NotifySystemOs -> NotifySystemOs -> [NotifySystemOs])
-> (NotifySystemOs -> NotifySystemOs -> [NotifySystemOs])
-> (NotifySystemOs
    -> NotifySystemOs -> NotifySystemOs -> [NotifySystemOs])
-> Enum NotifySystemOs
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: NotifySystemOs -> NotifySystemOs
succ :: NotifySystemOs -> NotifySystemOs
$cpred :: NotifySystemOs -> NotifySystemOs
pred :: NotifySystemOs -> NotifySystemOs
$ctoEnum :: Int -> NotifySystemOs
toEnum :: Int -> NotifySystemOs
$cfromEnum :: NotifySystemOs -> Int
fromEnum :: NotifySystemOs -> Int
$cenumFrom :: NotifySystemOs -> [NotifySystemOs]
enumFrom :: NotifySystemOs -> [NotifySystemOs]
$cenumFromThen :: NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
enumFromThen :: NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
$cenumFromTo :: NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
enumFromTo :: NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
$cenumFromThenTo :: NotifySystemOs
-> NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
enumFromThenTo :: NotifySystemOs
-> NotifySystemOs -> NotifySystemOs -> [NotifySystemOs]
Enum, NotifySystemOs -> NotifySystemOs -> Bool
(NotifySystemOs -> NotifySystemOs -> Bool)
-> (NotifySystemOs -> NotifySystemOs -> Bool) -> Eq NotifySystemOs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NotifySystemOs -> NotifySystemOs -> Bool
== :: NotifySystemOs -> NotifySystemOs -> Bool
$c/= :: NotifySystemOs -> NotifySystemOs -> Bool
/= :: NotifySystemOs -> NotifySystemOs -> Bool
Eq, (forall x. NotifySystemOs -> Rep NotifySystemOs x)
-> (forall x. Rep NotifySystemOs x -> NotifySystemOs)
-> Generic NotifySystemOs
forall x. Rep NotifySystemOs x -> NotifySystemOs
forall x. NotifySystemOs -> Rep NotifySystemOs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. NotifySystemOs -> Rep NotifySystemOs x
from :: forall x. NotifySystemOs -> Rep NotifySystemOs x
$cto :: forall x. Rep NotifySystemOs x -> NotifySystemOs
to :: forall x. Rep NotifySystemOs x -> NotifySystemOs
Generic, Eq NotifySystemOs
Eq NotifySystemOs =>
(NotifySystemOs -> NotifySystemOs -> Ordering)
-> (NotifySystemOs -> NotifySystemOs -> Bool)
-> (NotifySystemOs -> NotifySystemOs -> Bool)
-> (NotifySystemOs -> NotifySystemOs -> Bool)
-> (NotifySystemOs -> NotifySystemOs -> Bool)
-> (NotifySystemOs -> NotifySystemOs -> NotifySystemOs)
-> (NotifySystemOs -> NotifySystemOs -> NotifySystemOs)
-> Ord NotifySystemOs
NotifySystemOs -> NotifySystemOs -> Bool
NotifySystemOs -> NotifySystemOs -> Ordering
NotifySystemOs -> NotifySystemOs -> NotifySystemOs
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: NotifySystemOs -> NotifySystemOs -> Ordering
compare :: NotifySystemOs -> NotifySystemOs -> Ordering
$c< :: NotifySystemOs -> NotifySystemOs -> Bool
< :: NotifySystemOs -> NotifySystemOs -> Bool
$c<= :: NotifySystemOs -> NotifySystemOs -> Bool
<= :: NotifySystemOs -> NotifySystemOs -> Bool
$c> :: NotifySystemOs -> NotifySystemOs -> Bool
> :: NotifySystemOs -> NotifySystemOs -> Bool
$c>= :: NotifySystemOs -> NotifySystemOs -> Bool
>= :: NotifySystemOs -> NotifySystemOs -> Bool
$cmax :: NotifySystemOs -> NotifySystemOs -> NotifySystemOs
max :: NotifySystemOs -> NotifySystemOs -> NotifySystemOs
$cmin :: NotifySystemOs -> NotifySystemOs -> NotifySystemOs
min :: NotifySystemOs -> NotifySystemOs -> NotifySystemOs
Ord, Int -> NotifySystemOs -> ShowS
[NotifySystemOs] -> ShowS
NotifySystemOs -> String
(Int -> NotifySystemOs -> ShowS)
-> (NotifySystemOs -> String)
-> ([NotifySystemOs] -> ShowS)
-> Show NotifySystemOs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotifySystemOs -> ShowS
showsPrec :: Int -> NotifySystemOs -> ShowS
$cshow :: NotifySystemOs -> String
show :: NotifySystemOs -> String
$cshowList :: [NotifySystemOs] -> ShowS
showList :: [NotifySystemOs] -> ShowS
Show)
  deriving anyclass (NotifySystemOs -> ()
(NotifySystemOs -> ()) -> NFData NotifySystemOs
forall a. (a -> ()) -> NFData a
$crnf :: NotifySystemOs -> ()
rnf :: NotifySystemOs -> ()
NFData)

#elif OSX

notifySystemToOs = \case
  NotifySystemAppleScript -> pure NotifySystemOsAppleScript
  other -> Left $ MkNotifyParseException Os.Osx other

notifySystemFromOs = \case
  NotifySystemOsAppleScript -> NotifySystemAppleScript

defaultNotifySystem = NotifySystemAppleScript

defaultNotifySystemOs = NotifySystemOsAppleScript

-- | Notification system. Options are platform specific.
--
-- @since 0.1
data NotifySystemOs = NotifySystemOsAppleScript
  deriving stock (Bounded, Enum, Eq, Generic, Ord, Show)
  deriving anyclass (NFData)

#else

notifySystemToOs = \case
  NotifySystemWindows -> pure NotifySystemOsWindows
  other -> Left $ MkNotifyParseException Os.Windows other

notifySystemFromOs = \case
  NotifySystemOsWindows -> NotifySystemWindows

defaultNotifySystem = NotifySystemWindows

defaultNotifySystemOs = NotifySystemOsWindows

-- | Notification system. Options are platform specific.
--
-- @since 0.1
data NotifySystemOs = NotifySystemOsWindows
  deriving stock (Bounded, Enum, Eq, Generic, Ord, Show)
  deriving anyclass (NFData)

#endif