{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric  #-}

{- |
Module      : Data.PEM.Types
License     : BSD-style
Copyright   : (c) 2010-2018 Vincent Hanquez <vincent@snarc.org>
Stability   : experimental
Portability : portable
-}

module Data.PEM.Types
  ( PEM (..)
  ) where

import           Control.DeepSeq ( NFData (..) )
import           Data.ByteString ( ByteString )
import           GHC.Generics ( Generic )

-- | A type representing single PEM sections.

data PEM = PEM
  { PEM -> String
pemName    :: String
    -- ^ The name of the section, found after the dash BEGIN tag.

  , PEM -> [(String, ByteString)]
pemHeader  :: [(String, ByteString)]
    -- ^ Optional key-value pairs header. The library does not currently

    -- serialize headers.

  , PEM -> ByteString
pemContent :: ByteString
    -- ^ Binary content of the section.

  }
  deriving (PEM -> PEM -> Bool
(PEM -> PEM -> Bool) -> (PEM -> PEM -> Bool) -> Eq PEM
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PEM -> PEM -> Bool
== :: PEM -> PEM -> Bool
$c/= :: PEM -> PEM -> Bool
/= :: PEM -> PEM -> Bool
Eq, (forall x. PEM -> Rep PEM x)
-> (forall x. Rep PEM x -> PEM) -> Generic PEM
forall x. Rep PEM x -> PEM
forall x. PEM -> Rep PEM x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PEM -> Rep PEM x
from :: forall x. PEM -> Rep PEM x
$cto :: forall x. Rep PEM x -> PEM
to :: forall x. Rep PEM x -> PEM
Generic, PEM -> ()
(PEM -> ()) -> NFData PEM
forall a. (a -> ()) -> NFData a
$crnf :: PEM -> ()
rnf :: PEM -> ()
NFData, Int -> PEM -> ShowS
[PEM] -> ShowS
PEM -> String
(Int -> PEM -> ShowS)
-> (PEM -> String) -> ([PEM] -> ShowS) -> Show PEM
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PEM -> ShowS
showsPrec :: Int -> PEM -> ShowS
$cshow :: PEM -> String
show :: PEM -> String
$cshowList :: [PEM] -> ShowS
showList :: [PEM] -> ShowS
Show)