{-# Language TemplateHaskell #-}
{-|
Module      : Client.UserHost
Description : Type for tracking user, host and account
Copyright   : (c) Eric Mertens, 2019
License     : ISC
Maintainer  : emertens@gmail.com

-}

module Client.UserHost
  (
  -- * User information
    UserAndHost(..)
  , uhUser
  , uhHost
  , uhAccount
  ) where

import           Control.Lens (makeLenses)
import           Data.Text (Text)

-- | Pair of username and hostname. Empty strings represent missing information.
data UserAndHost = UserAndHost
  { UserAndHost -> Text
_uhUser    :: {-# UNPACK #-}!Text -- ^ username
  , UserAndHost -> Text
_uhHost    :: {-# UNPACK #-}!Text -- ^ hostname
  , UserAndHost -> Text
_uhAccount :: {-# UNPACK #-}!Text -- ^ services account
  }
  deriving (ReadPrec [UserAndHost]
ReadPrec UserAndHost
Int -> ReadS UserAndHost
ReadS [UserAndHost]
(Int -> ReadS UserAndHost)
-> ReadS [UserAndHost]
-> ReadPrec UserAndHost
-> ReadPrec [UserAndHost]
-> Read UserAndHost
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserAndHost]
$creadListPrec :: ReadPrec [UserAndHost]
readPrec :: ReadPrec UserAndHost
$creadPrec :: ReadPrec UserAndHost
readList :: ReadS [UserAndHost]
$creadList :: ReadS [UserAndHost]
readsPrec :: Int -> ReadS UserAndHost
$creadsPrec :: Int -> ReadS UserAndHost
Read, Int -> UserAndHost -> ShowS
[UserAndHost] -> ShowS
UserAndHost -> String
(Int -> UserAndHost -> ShowS)
-> (UserAndHost -> String)
-> ([UserAndHost] -> ShowS)
-> Show UserAndHost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserAndHost] -> ShowS
$cshowList :: [UserAndHost] -> ShowS
show :: UserAndHost -> String
$cshow :: UserAndHost -> String
showsPrec :: Int -> UserAndHost -> ShowS
$cshowsPrec :: Int -> UserAndHost -> ShowS
Show)

makeLenses ''UserAndHost