{- |
Module      : $Header$
Description : Definition of article
Copyright   : (c) Maciej Piechotka
License     : LGPL 3 or later

Maintainer  : uzytkownik2@gmail.com
Stability   : none
Portability : portable

This module contains definition of article
-}
module Network.NNTP.Internal.Article
  (
    Article(..),
  )
where
import Control.Arrow
import Data.ByteString.Lazy
{- |
Represents a single article. Please note that except the splitting into header
and body no parsing is done.
-}
data Article = Article {
      -- | Returns the article ID
      articleID :: String,
      -- | Returns the article header. 'Data.Maybe.Nothing' indicates not
      -- fetched header.
      articleHeader :: Maybe ByteString,
      -- | Returns the article body. 'Data.Maybe.Nothing' indicates not
      -- fetched body.
      articleBody :: Maybe ByteString
    }

instance Show Article where
    show = ("Article "++) . articleID
instance Eq Article where
    (==) = curry (articleID *** articleID >>> uncurry (==))