module Language.Ltml.AST.Document
    ( Document (..)
    , DocumentHeading (..)
    , DocumentBody (..)
    , DocumentMainBody
    , DocumentIntro
    , DocumentExtro
    )
where

import Data.Map (Map)
import Language.Lsd.AST.Type.Document (DocumentFormat)
import Language.Ltml.AST.Footnote (Footnote)
import Language.Ltml.AST.Label (Label)
import Language.Ltml.AST.Section (SectionBody)
import Language.Ltml.AST.SimpleSection (SimpleSection)
import Language.Ltml.AST.Text (HeadingTextTree)
import Language.Ltml.Common (Flagged', NavTocHeaded, Parsed)

data Document
    = Document
        DocumentFormat
        (Parsed DocumentHeading)
        DocumentBody
        (Map Label Footnote)
    deriving (Int -> Document -> ShowS
[Document] -> ShowS
Document -> String
(Int -> Document -> ShowS)
-> (Document -> String) -> ([Document] -> ShowS) -> Show Document
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Document -> ShowS
showsPrec :: Int -> Document -> ShowS
$cshow :: Document -> String
show :: Document -> String
$cshowList :: [Document] -> ShowS
showList :: [Document] -> ShowS
Show)

-- | Document heading.
--   Unlike 'Language.Ltml.AST.Section.Heading', this does not incorporate
--   the heading's format, which is instead configured by the
--   'Language.Lsd.AST.Type.DocumentContainerFormat' (for the main document)
--   or 'Language.Lsd.AST.Type.AppendixSectionFormat' (for appendix documents).
newtype DocumentHeading = DocumentHeading [HeadingTextTree]
    deriving (Int -> DocumentHeading -> ShowS
[DocumentHeading] -> ShowS
DocumentHeading -> String
(Int -> DocumentHeading -> ShowS)
-> (DocumentHeading -> String)
-> ([DocumentHeading] -> ShowS)
-> Show DocumentHeading
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DocumentHeading -> ShowS
showsPrec :: Int -> DocumentHeading -> ShowS
$cshow :: DocumentHeading -> String
show :: DocumentHeading -> String
$cshowList :: [DocumentHeading] -> ShowS
showList :: [DocumentHeading] -> ShowS
Show)

data DocumentBody
    = DocumentBody
        (Maybe (Flagged' (NavTocHeaded (Parsed DocumentIntro))))
        (Flagged' (NavTocHeaded (Parsed DocumentMainBody)))
        (Maybe (Flagged' (NavTocHeaded (Parsed DocumentExtro))))
    deriving (Int -> DocumentBody -> ShowS
[DocumentBody] -> ShowS
DocumentBody -> String
(Int -> DocumentBody -> ShowS)
-> (DocumentBody -> String)
-> ([DocumentBody] -> ShowS)
-> Show DocumentBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DocumentBody -> ShowS
showsPrec :: Int -> DocumentBody -> ShowS
$cshow :: DocumentBody -> String
show :: DocumentBody -> String
$cshowList :: [DocumentBody] -> ShowS
showList :: [DocumentBody] -> ShowS
Show)

type DocumentMainBody = SectionBody

type DocumentIntro = [SimpleSection]

type DocumentExtro = [SimpleSection]