module Drasil.SWHSNoPCM.Requirements (funcReqs, inputInitValsTable) where

import Control.Lens ((^.))

import Language.Drasil
import Drasil.DocLang (mkInputPropsTable)
import Language.Drasil.Chunk.Concept.NamedCombinators
import Theory.Drasil (InstanceModel)

import Data.Drasil.Concepts.Documentation (funcReqDom, input_, value)
import Data.Drasil.Quantities.PhysicalProperties (mass)

import Drasil.SWHS.DataDefs (waterMass, tankVolume, balanceDecayRate)
import Drasil.SWHS.IMods (heatEInWtr)
import Drasil.SWHS.Requirements (calcValues, checkWithPhysConsts,
  findMassConstruct, inReqDesc, oIDQConstruct, outputValues)

import Drasil.SWHSNoPCM.DataDefs (waterVolume)
import Drasil.SWHSNoPCM.IMods (eBalanceOnWtr)
import Drasil.SWHSNoPCM.Unitals (inputs)

--------------------------
--Section 5 : REQUIREMENTS
--------------------------

---------------------------------------
--Section 5.1 : FUNCTIONAL REQUIREMENTS
---------------------------------------

--
inputInitVals :: ConceptInstance
inputInitVals :: ConceptInstance
inputInitVals = forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
"inputInitVals" ([Sentence] -> Sentence
foldlSent [
  forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
input_, String -> Sentence
S String
"the following", forall n. NamedIdea n => n -> Sentence
plural IdeaDict
value, String -> Sentence
S String
"described in the table for",
  forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef LabelledContent
inputInitValsTable (String -> Sentence
S String
"Required Inputs")Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"which define", Sentence
inReqDesc])
  String
"Input-Initial-Values" ConceptChunk
funcReqDom

--
findMass :: ConceptInstance
findMass :: ConceptInstance
findMass = forall r s t.
(Referable r, HasShortName r, Referable s, HasShortName s,
 Referable t, HasShortName t) =>
r -> Sentence -> [s] -> [t] -> ConceptInstance
findMassConstruct ConceptInstance
inputInitVals (forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
mass) [InstanceModel
eBalanceOnWtr]
            [DataDefinition
waterMass, DataDefinition
waterVolume, DataDefinition
tankVolume]

--
oIDQVals :: [Sentence]
oIDQVals :: [Sentence]
oIDQVals = forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSent_ [
  [forall n. NounPhrase n => n -> Sentence
pluralNP (forall t. NamedIdea t => t -> NP
the IdeaDict
value), forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource ConceptInstance
inputInitVals],
  [forall n. NounPhrase n => n -> Sentence
phraseNP (forall t. NamedIdea t => t -> NP
the UnitalChunk
mass), forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource ConceptInstance
findMass],
  [forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch (DataDefinition
balanceDecayRate forall s a. s -> Getting a s a -> a
^. forall d. DefinesQuantity d => Getter d QuantityDict
defLhs), forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource DataDefinition
balanceDecayRate]
  ]

inputInitValsTable :: LabelledContent
inputInitValsTable :: LabelledContent
inputInitValsTable = forall i r.
(Quantity i, MayHaveUnit i, HasShortName r, Referable r) =>
[i] -> r -> LabelledContent
mkInputPropsTable [QuantityDict]
inputs ConceptInstance
inputInitVals

funcReqs :: [ConceptInstance]
funcReqs :: [ConceptInstance]
funcReqs = [ConceptInstance
inputInitVals, ConceptInstance
findMass, ConceptInstance
checkWithPhysConsts,
  [Sentence] -> ConceptInstance
oIDQConstruct [Sentence]
oIDQVals, [InstanceModel] -> ConceptInstance
calcValues [InstanceModel]
noPCMOutputs, [InstanceModel] -> ConceptInstance
outputValues [InstanceModel]
noPCMOutputs]

noPCMOutputs :: [InstanceModel]
noPCMOutputs :: [InstanceModel]
noPCMOutputs = [InstanceModel
eBalanceOnWtr, InstanceModel
heatEInWtr]

-------------------------------------------
--Section 5.2 : NON-FUNCTIONAL REQUIREMENTS
-------------------------------------------

--imports from SWHS