module Drasil.HGHC.Body (srs, si, symbMap, printSetting, fullSI) where

import Language.Drasil hiding (Manual) -- Citation name conflict. FIXME: Move to different namespace
import Drasil.SRSDocument
import qualified Language.Drasil.Sentence.Combinators as S

import Drasil.HGHC.HeatTransfer (fp, hghc, dataDefs, htInputs, htOutputs, 
    nuclearPhys, symbols)

import Data.Drasil.SI_Units (siUnits, fundamentals, derived, degree)
import Data.Drasil.People (spencerSmith)
import Data.Drasil.Concepts.Documentation (doccon, doccon')
import Data.Drasil.Concepts.Math (mathcon)
import Data.Drasil.Concepts.Thermodynamics as CT (heatTrans)  
import qualified Data.Drasil.Concepts.Documentation as Doc (srs)
  
srs :: Document
srs :: Document
srs = SRSDecl
-> (IdeaDict -> IdeaDict -> Sentence)
-> SystemInformation
-> Document
mkDoc SRSDecl
mkSRS IdeaDict -> IdeaDict -> Sentence
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> Sentence
S.forT SystemInformation
si

fullSI :: SystemInformation
fullSI :: SystemInformation
fullSI = SRSDecl -> SystemInformation -> SystemInformation
fillcdbSRS SRSDecl
mkSRS SystemInformation
si

printSetting :: PrintingInformation
printSetting :: PrintingInformation
printSetting = SystemInformation
-> Stage -> PrintingConfiguration -> PrintingInformation
piSys SystemInformation
fullSI Stage
Equational PrintingConfiguration
defaultConfiguration

si :: SystemInformation
si :: SystemInformation
si = SI {
  _sys :: CI
_sys         = CI
hghc,
  _kind :: CI
_kind        = CI
Doc.srs,
  _authors :: People
_authors     = [Person
spencerSmith],
  _quants :: [QuantityDict]
_quants      = [QuantityDict]
symbols,
  _purpose :: Purpose
_purpose     = [Sentence
purp],
  _background :: Purpose
_background  = [],
  _motivation :: Purpose
_motivation  = [],
  _scope :: Purpose
_scope       = [],
  _concepts :: [UnitalChunk]
_concepts    = [] :: [UnitalChunk],
  _instModels :: [InstanceModel]
_instModels  = [], -- FIXME; empty _instModels
  _datadefs :: [DataDefinition]
_datadefs    = [DataDefinition]
dataDefs,
  _configFiles :: [String]
_configFiles = [],
  _inputs :: [QuantityDict]
_inputs      = [QuantityDict]
htInputs,
  _outputs :: [QuantityDict]
_outputs     = [QuantityDict]
htOutputs,
  _defSequence :: [Block SimpleQDef]
_defSequence = [] :: [Block SimpleQDef],
  _constraints :: [ConstrainedChunk]
_constraints = [] :: [ConstrainedChunk],
  _constants :: [ConstQDef]
_constants   = [],
  _sysinfodb :: ChunkDB
_sysinfodb   = ChunkDB
symbMap,
  _usedinfodb :: ChunkDB
_usedinfodb  = ChunkDB
usedDB,
   refdb :: ReferenceDB
refdb       = BibRef -> [ConceptInstance] -> ReferenceDB
rdb [] [] -- FIXME?
}
  
mkSRS :: SRSDecl
mkSRS :: SRSDecl
mkSRS = [DocSection
TableOfContents,
    RefSec -> DocSection
RefSec (RefSec -> DocSection) -> RefSec -> DocSection
forall a b. (a -> b) -> a -> b
$
    Contents -> [RefTab] -> RefSec
RefProg Contents
intro [RefTab
TUnits, [TSIntro] -> RefTab
tsymb [TSIntro
TSPurpose, [Literature] -> TSIntro
SymbConvention [IdeaDict -> Literature
Lit (IdeaDict -> Literature) -> IdeaDict -> Literature
forall a b. (a -> b) -> a -> b
$ IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw IdeaDict
nuclearPhys, IdeaDict -> Literature
Manual (IdeaDict -> Literature) -> IdeaDict -> Literature
forall a b. (a -> b) -> a -> b
$ IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw IdeaDict
fp]]],
    SSDSec -> DocSection
SSDSec (SSDSec -> DocSection) -> SSDSec -> DocSection
forall a b. (a -> b) -> a -> b
$ [SSDSub] -> SSDSec
SSDProg [
      SolChSpec -> SSDSub
SSDSolChSpec (SolChSpec -> SSDSub) -> SolChSpec -> SSDSub
forall a b. (a -> b) -> a -> b
$ [SCSSub] -> SolChSpec
SCSProg [
          Purpose -> Fields -> SCSSub
TMs [] []
        , Purpose -> Fields -> DerivationDisplay -> SCSSub
GDs [] [] DerivationDisplay
HideDerivation
        , Purpose -> Fields -> DerivationDisplay -> SCSSub
DDs [] [Field
Label, Field
Symbol, Field
Units, Field
DefiningEquation,
          Verbosity -> InclUnits -> Field
Description Verbosity
Verbose InclUnits
IncludeUnits] DerivationDisplay
HideDerivation
        , Purpose -> Fields -> DerivationDisplay -> SCSSub
IMs [] [] DerivationDisplay
HideDerivation
      ]]]

purp :: Sentence
purp :: Sentence
purp = Purpose -> Sentence
foldlSent [String -> Sentence
S String
"describe", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
CT.heatTrans, String -> Sentence
S String
"coefficients related to clad"]

symbMap :: ChunkDB
symbMap :: ChunkDB
symbMap = [QuantityDict]
-> [IdeaDict]
-> [ConceptChunk]
-> [UnitDefn]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
forall q t c u.
(Quantity q, MayHaveUnit q, Idea t, Concept c, IsUnit u) =>
[q]
-> [t]
-> [c]
-> [u]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
cdb [QuantityDict]
symbols ((QuantityDict -> IdeaDict) -> [QuantityDict] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map QuantityDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [QuantityDict]
symbols [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (IdeaDict -> IdeaDict) -> [IdeaDict] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [IdeaDict]
doccon [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (UnitDefn -> IdeaDict) -> [UnitDefn] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map UnitDefn -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [UnitDefn]
fundamentals [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (UnitDefn -> IdeaDict) -> [UnitDefn] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map UnitDefn -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [UnitDefn]
derived
  [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ [IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw IdeaDict
fp, IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw IdeaDict
nuclearPhys, CI -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw CI
hghc, UnitDefn -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw UnitDefn
degree] [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (CI -> IdeaDict) -> [CI] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map CI -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [CI]
doccon' [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (ConceptChunk -> IdeaDict) -> [ConceptChunk] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map ConceptChunk -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [ConceptChunk]
mathcon)
  ([] :: [ConceptChunk])-- FIXME: Fill in concepts
  [UnitDefn]
siUnits [DataDefinition]
dataDefs [] [] [] [] [] [] []

usedDB :: ChunkDB
usedDB :: ChunkDB
usedDB = [QuantityDict]
-> [IdeaDict]
-> [ConceptChunk]
-> [UnitDefn]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
forall q t c u.
(Quantity q, MayHaveUnit q, Idea t, Concept c, IsUnit u) =>
[q]
-> [t]
-> [c]
-> [u]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
cdb ([] :: [QuantityDict]) ((QuantityDict -> IdeaDict) -> [QuantityDict] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map QuantityDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [QuantityDict]
symbols)
           ([] :: [ConceptChunk]) ([] :: [UnitDefn])
           [] [] [] [] [] [] [] ([] :: [Reference])