module Network.Xmpp.IM.PresenceTracker.Types where

import           Data.Map (Map)

import           Network.Xmpp.Types
import           Network.Xmpp.IM.Presence

-- Map from bare JIDs to a map of full JIDs to show maybe status.
--
-- Invariants:
-- * The outer map should not have entries for bare JIDs that have no
--   available resource, i.e. the inner map should never be empty
--
-- * The inner map keys' local and domain part coincide with the outer keys'
newtype Peers = Peers { Peers -> Map Jid (Map Jid (Maybe IMPresence))
unPeers :: Map Jid (Map Jid (Maybe IMPresence))}
                deriving (Int -> Peers -> ShowS
[Peers] -> ShowS
Peers -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Peers] -> ShowS
$cshowList :: [Peers] -> ShowS
show :: Peers -> String
$cshow :: Peers -> String
showsPrec :: Int -> Peers -> ShowS
$cshowsPrec :: Int -> Peers -> ShowS
Show)

data PeerStatus = PeerAvailable (Maybe IMPresence)
                | PeerUnavailable
                  deriving (Int -> PeerStatus -> ShowS
[PeerStatus] -> ShowS
PeerStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PeerStatus] -> ShowS
$cshowList :: [PeerStatus] -> ShowS
show :: PeerStatus -> String
$cshow :: PeerStatus -> String
showsPrec :: Int -> PeerStatus -> ShowS
$cshowsPrec :: Int -> PeerStatus -> ShowS
Show, PeerStatus -> PeerStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PeerStatus -> PeerStatus -> Bool
$c/= :: PeerStatus -> PeerStatus -> Bool
== :: PeerStatus -> PeerStatus -> Bool
$c== :: PeerStatus -> PeerStatus -> Bool
Eq)